Scripting - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Scripting (
/showthread.php?tid=663662)
Scripting -
jhonloyd20 - 08.02.2019
Hi guyz can someone Tutor me here i`m slow Learner
and I want to give Weapon depend on class
thank you for who help
Re: Scripting -
TokicMajstor - 08.02.2019
That class should be a variable for player?
You can do it like this
Код:
new Variable[MAX_PLAYERS]; // this should be your class
public OnPlayerSpawn(playerid)
{
if(Variable[playerid] == 1) // if this is true it is gonna to do the following
{
GivePlayerWeapon(playerid,24,50) // this gives weapon, 24 is id of desert eagle, 50 is ammo which is goona be given to that player
}
else if(Variable[playerid] == 2) // and now the same thing but this time if Variable is set to 2 and you should put another weapon here
{
GivePlayerWeapon(playerid, 25, 50)
}
return 1;
}
Re: Scripting -
jhonloyd20 - 08.02.2019
Quote:
Originally Posted by TokicMajstor
That class should be a variable for player?
You can do it like this
Код:
new Variable[MAX_PLAYERS]; // this should be your class
public OnPlayerSpawn(playerid)
{
if(Variable[playerid] == 1) // if this is true it is gonna to do the following
{
GivePlayerWeapon(playerid,24,50) // this gives weapon, 24 is id of desert eagle, 50 is ammo which is goona be given to that player
}
else if(Variable[playerid] == 2) // and now the same thing but this time if Variable is set to 2 and you should put another weapon here
{
GivePlayerWeapon(playerid, 25, 50)
}
return 1;
}
|
like this one
new HITMAN[MAX_PLAYERS]; // this should be your class
public OnPlayerSpawn(playerid)
{
if(HITMAN[playerid] == 1) // if this is true it is gonna to do the following
{
GivePlayerWeapon(playerid,24,50) // this gives weapon, 24 is id of desert eagle, 50 is ammo which is goona be given to that player
}
else if(Variable[playerid] == 2) // and now the same thing but this time if Variable is set to 2 and you should put another weapon here
{
GivePlayerWeapon(playerid, 25, 50)
}
return 1;
}
Re: Scripting -
TheToretto - 08.02.2019
Код:
else if(HITMAN[playerid] == 2)
But the variable Hitman doesn't mean player is a Hitman, it's its value that count.