a little problem

Started by burpy, Mar 08, 2018, 01:09 PM

Previous topic - Next topic

burpy

hello guys, i dont wanna spam or anything, actually im new in this community
and i think i liked it from the first time i saw it from (was yesterday).
so, i wanted to play this game again after i left it since 4 years ago by mistake, and i couldn't
find the original game of vice city to put the mp on it but it worked yesterday so i made a server
and i have a problem with it.
actually im sorry that i didn't understand the search of this site because i don't understand much
in the servers and scripting so i tried to make teams, so i made the classes with teams lik 1, 2, 3 etc
and i though that it will be teams which their players can't shot themselves but i can shot player in my team
i want to make them friendly (they can't kill themselves)
also i want to know how to change the spawn of skins of the teams and spawn them in the place that i like.
and last thing i want to know how to make for every team a color like RED, GREEN, etc.
and sorry if i'm stupid, that's because i'm new! thanks in advance <3

Retard

You can change the spawn Location and add anti friendly kill all in server.conf

umar4911

Hello, If you remember, we met in your server yesterday. OK let's help you. First, if you have any problem with scripting, post a topic in Scripting and Server Management. Now your problem.

Friendly Fire
Change FriendlyFire to true.

Skins and Spawnloc
You can add skins in two places, Server.conf or Main.nut. I prefer main.nut because it is easy and help in later use. To add skins in main.nut, remove all classes in Server.conf to avoid bugs. After that use function AddClass in onScriptLoad()
The syntax of AddClass is:
AddClass( class, color, skin, position, angle, weapon1, ammo1 ,weapon2, ammo2, weapon3, ammo3 );Example
OnScriptLoad()
{
AddClass(1, RGB(23, 135, 34), 48, Vector(482.096, -92.4237, 10.2305), -3.1172, 21, 999 ,1, 1, 25, 255 );
AddClass(1, RGB(23, 135, 34), 55, Vector(43.4619, 1086.43, 14.5223), 1.83129, 21, 999 ,1, 1, 25, 255 );
AddClass(2, RGB(100, 149, 237), 1, Vector(-657.091, 762.422, 11.5998), -3.13939, 21, 999 ,1, 1, 25, 255 );
AddClass(2, RGB(100, 149, 237), 2, Vector(509.529, 510.066, 11.9236), -1.5148, 21, 999 ,1, 1, 25, 255 );
AddClass(3, RGB(200, 0, 0), 5, Vector(-823.187, 1150.35, 12.4111), 0.00513555, 21, 999 ,1, 1, 25, 255 );
AddClass(3, RGB(200, 0, 0), 6, Vector(-696.485, 768.47, 11.0846), 130.0325, 21, 999 ,1, 1, 25, 255 );
}
If you add this in OnScriptLoad() function(dont make 2 onscriptload functions, place all code in one), your skins will be updated according to the syntax.

If you want to change the spawnloc of the player, change the vector the function. The Syntax is:
Vector(x-axis, y-axis, z-axis)
To add colors to a player, you need to add set player colour using player.Colour on onplayerSpawn function.
E.g.
onplayerSpawn(player)
{
  if(player.Team == 1) player.Colour = RGB( 255, 0, 0);
}
When player Spawn, his colour is changed to Red.

The colour will only change on player spawn.

To announce on spawn screen, you need to modify the function onPlayerRequestClass
function onPlayerRequestClass( player, classID, team, skin )
{
 if(player.Skin == 15)
{
Announce("~y~Team Yellow - Civilian # 1", player, 8);
}
if(player.Skin == 7)
{
Announce("~y~Team Yellow - Civilian # 2", player, 8);
}
}
It is an example.

I think your problem will be solved now. If it still resists, reply to the topic.
Visit the Wiki. It is help you alot.
Link:http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Functions
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

burpy

@thx ali
@umar yo bro, sure i still remember you very well :D
thanks for all what did u say, first of all how can you even know the x, y and z of a place like "BANK"
for example i want to put to put police team in the "police office" but i dont know the "police office" w, y and z
so i can't put my police team into the place that i want, do u understand me ? :D
if there is a way to know the x, y and z of all places like bank and police office then i really need to know it from you ^_^.
second tbh i don't know if when i made your way to put colors to the teams worked or not as i don't have somebody to
test it for me by joining the server so i see his name color, but u told me way to make RED team color, but i dont know how
to make GREEN team color, for me i changed the "255" number from first the first "," sign to the second "," sign but i still
don't know if that gonna work or not, so if im right then you can say you are right and if im not then please tell me the correct
way as i don't understand anything here :P thx again <3
OH BTW, if i made police team color as red color will their phrases on the chat color be red as their team color ?
thx again bro and also thx for answering ^^

umar4911

Quote from: burpy on Mar 10, 2018, 05:19 AM@thx ali
@umar yo bro, sure i still remember you very well :D
thanks for all what did u say, first of all how can you even know the x, y and z of a place like "BANK"
for example i want to put to put police team in the "police office" but i dont know the "police office" w, y and z
so i can't put my police team into the place that i want, do u understand me ? :D
if there is a way to know the x, y and z of all places like bank and police office then i really need to know it from you ^_^.
second tbh i don't know if when i made your way to put colors to the teams worked or not as i don't have somebody to
test it for me by joining the server so i see his name color, but u told me way to make RED team color, but i dont know how
to make GREEN team color, for me i changed the "255" number from first the first "," sign to the second "," sign but i still
don't know if that gonna work or not, so if im right then you can say you are right and if im not then please tell me the correct
way as i don't understand anything here :P thx again <3
OH BTW, if i made police team color as red color will their phrases on the chat color be red as their team color ?
thx again bro and also thx for answering ^^
To know the x, y and z axis and Angle copy this code in the function onplayerCommand
else if(command == "pos")
{
MessagePlayer("[#FFFF00]X-Axis:[#FFFFFF]"+player.Pos.x, player);
MessagePlayer("[#FFFF00]Y-Axis:[#FFFFFF]"+player.Pos.y, player);
MessagePlayer("[#FFFF00]Z-Axis:[#FFFFFF]"+player.Pos.z, player);
MessagePlayer("[#FFFF00]Angle:[#FFFFFF]"+player.Angle, player);
}
Use command pos


I will join your server again. To test your colour, if your colour on chat is changed, means the colour is set. These colour are made using RGB. If you want to get colours, search on google: Colour Finder and you will get the Hex code and RGB colours too.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

burpy

@umar
so yeah i tried to remove all skins from the server.confg and put it on main.nut
and the colors worked. but, when i put the message of pos that u told me about to know the x, y and z axis and angle
it gives me an error when i open the server it says:
[MODULE]  Loaded SqVCMP 0.4 frontend by Stormeus. (v1.0)
scripts/main.nut line = (126) column = (13) : error expression expected
[WARNING] Could not load script 'scripts/main.nut'
[WARNING] expression expected
[ERROR]   No Squirrel gamemode was specified.
[MODULE]  Loaded server.conf Loader for 0.4 by Stormeus
[MODULE]     >> Loaded server.conf for parsing
[MODULE]     >> Applied settings
[MODULE]     >> Loaded classes
[WARNING] Please define a world for your vehicle. (See docs)
[MODULE]     >> Loaded vehicles
[MODULE]     >> Loaded pickups
[MODULE]  Loaded server.conf successfully

so when i join the server i see all of the skins are removed but i still see 1 skin (the normal gta player who i dont know his name tbh xd but he is the player of gta single player) in the police station place with an orange colour team which i didn't edit it like this.
so idk, colours worked but i still dont know how to know the x, y and z axis and angle.
but thx for fixing colours problem, and if u know how to help me in the axis and angle then i will try it and tell you fast. thx! ^^

umar4911

Quote from: burpy on Mar 11, 2018, 12:49 PM@umar
so yeah i tried to remove all skins from the server.confg and put it on main.nut
and the colors worked. but, when i put the message of pos that u told me about to know the x, y and z axis and angle
it gives me an error when i open the server it says:
[MODULE]  Loaded SqVCMP 0.4 frontend by Stormeus. (v1.0)
scripts/main.nut line = (126) column = (13) : error expression expected
[WARNING] Could not load script 'scripts/main.nut'
[WARNING] expression expected
[ERROR]   No Squirrel gamemode was specified.
[MODULE]  Loaded server.conf Loader for 0.4 by Stormeus
[MODULE]     >> Loaded server.conf for parsing
[MODULE]     >> Applied settings
[MODULE]     >> Loaded classes
[WARNING] Please define a world for your vehicle. (See docs)
[MODULE]     >> Loaded vehicles
[MODULE]     >> Loaded pickups
[MODULE]  Loaded server.conf successfully

so when i join the server i see all of the skins are removed but i still see 1 skin (the normal gta player who i dont know his name tbh xd but he is the player of gta single player) in the police station place with an orange colour team which i didn't edit it like this.
so idk, colours worked but i still dont know how to know the x, y and z axis and angle.
but thx for fixing colours problem, and if u know how to help me in the axis and angle then i will try it and tell you fast. thx! ^^
This happens when there is a error in your code. As they told that you missed an expression on line 127. Possibly a semi-colon ";" is missed usually. Give me the code written on line 127, I will fix that
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

burpy

here is function onplayerCommand on my main.nut
function onPlayerCommand( player, cmd, text )
{
   if(cmd == "heal")
   {
      local hp = player.Health;
      if(hp == 100) Message("[#FF3636]Error - [#8181FF]Use this command when you have less than 100% hp !");
      else {
         player.Health = 100.0;
         MessagePlayer( "[#FFFF81]---> You have been healed !", player );
      }
   }
   
   else if(cmd == "goto") {
      if(!text) MessagePlayer( "Error - Correct syntax - /goto <Name/ID>' !",player );
      else {
         local plr = FindPlayer(text);
         if(!plr) MessagePlayer( "Error - Unknown player !",player);
         else {
            player.Pos = plr.Pos;
            MessagePlayer( "[ /" + cmd + " ] " + player.Name + " was sent to " + plr.Name, player );
         }
      }
      
   }
   else if(cmd == "bring") {
      if(!text) MessagePlayer( "Error - Correct syntax - /bring <Name/ID>' !",player );
      else {
         local plr = FindPlayer(text);
         if(!plr) MessagePlayer( "Error - Unknown player !",player);
         else {
            plr.Pos = player.Pos;
            MessagePlayer( "[ /" + cmd + " ] " + plr.Name + " was sent to " + player.Name, player );
         }
      }
   }
   
   else if(cmd == "exec")
   {
      if( !text ) MessagePlayer( "Error - Syntax: /exec <Squirrel code>", player);
      else
      {
         try
         {
            local script = compilestring( text );
            script();
         }
         catch(e) MessagePlayer( "Error: " + e, player);
      }
   }
   return 1;       
}

Retard

Quote from: burpy on Mar 13, 2018, 12:40 PMhere is function onplayerCommand on my main.nut
function onPlayerCommand( player, cmd, text )
{
   if(cmd == "heal")
   {
      local hp = player.Health;
      if(hp == 100) Message("[#FF3636]Error - [#8181FF]Use this command when you have less than 100% hp !");
      else {
         player.Health = 100.0;
         MessagePlayer( "[#FFFF81]---> You have been healed !", player );
      }
   }
   
   else if(cmd == "goto") {
      if(!text) MessagePlayer( "Error - Correct syntax - /goto <Name/ID>' !",player );
      else {
         local plr = FindPlayer(text);
         if(!plr) MessagePlayer( "Error - Unknown player !",player);
         else {
            player.Pos = plr.Pos;
            MessagePlayer( "[ /" + cmd + " ] " + player.Name + " was sent to " + plr.Name, player );
         }
      }
      
   }
   else if(cmd == "bring") {
      if(!text) MessagePlayer( "Error - Correct syntax - /bring <Name/ID>' !",player );
      else {
         local plr = FindPlayer(text);
         if(!plr) MessagePlayer( "Error - Unknown player !",player);
         else {
            plr.Pos = player.Pos;
            MessagePlayer( "[ /" + cmd + " ] " + plr.Name + " was sent to " + player.Name, player );
         }
      }
   }
   
   else if(cmd == "exec")
   {
      if( !text ) MessagePlayer( "Error - Syntax: /exec <Squirrel code>", player);
      else
      {
         try
         {
            local script = compilestring( text );
            script();
         }
         catch(e) MessagePlayer( "Error: " + e, player);
      }
   }
   return 1;       
}
According to my knowledge there is a reason why we use the code option.

burpy

yea sorry i always forget code option :P

umar4911

I recommend you that use software notepad++ which will help you find line number and colum number easily.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

burpy

@umar can u just type the command in the code i typed and i paste it ? :D its better i think :P

umar4911

I checked. There was no error in the code.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

burpy

sorry for answering late, had to study
then what is the problem? what should i do? i have vps and i wanted to make the server on it but this problem is annoying me so much

umar4911

Quote from: burpy on Mar 29, 2018, 12:31 PMsorry for answering late, had to study
then what is the problem? what should i do? i have vps and i wanted to make the server on it but this problem is annoying me so much

Quote from: umar4911 on Mar 15, 2018, 08:40 AMI recommend you that use software notepad++ which will help you find line number and colum number easily.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter