Adding a new value to a variable - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Adding a new value to a variable (
/showthread.php?tid=119668)
Adding a new value to a variable -
string227 - 08.01.2010
Alright, on the
public OnPlayerDeath, im trying to define a variable that if the killer kills a player on the TEAM_ZOMBIE, that will add 1 value to the var_KILL. And once the var kill is at least 1, the player gets a new weapon. And a newer one once var = 2 and so on and so forth. I already #defined var_KILL at the top of the script. Heres the code im trying to use:
Код:
if(gTeam[killerid] == TEAM_ZOMBIE);
var_KILL == 1
Could anyone help with this?
Re: Adding a new value to a variable -
Toad - 08.01.2010
at the top:
new Kills[MAX_PLAYERS];
onplayerdeath
Kills[killerid] ++; //this makes it increase by 1
if(Kills[killerid] == 1) GivePlayerWeapon(killerid, 22, 100);//if he has 1 kill he gets this weapon
else if(Kills[killerid] == 2) GivePlayerWeapon(killerid, 25, 100);//at 2 kills this one
else if(Kills[killerid] == 3) GivePlayerWeapon(killerid, 28 , 300);//and with 3 kills he receives this weapon