slight problem.. can anyone help? - 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: slight problem.. can anyone help? (
/showthread.php?tid=306050)
slight problem.. can anyone help? -
chaosnz - 24.12.2011
I have a killstreak system in my server where the killer gets rewarded with health and Armour with every succession of a kill, but whats happening is that the health and Armour stays at 10, and doesnt increase what so ever..
Код:
new Float: PHealth;
new Float: PArmour;
SetPlayerArmour(killerid,GetPlayerArmour(killerid, PArmour) + 10);
SetPlayerHealth(killerid,GetPlayerHealth(killerid, PHealth) + 10);
Am i missing something out? as to why it wont work how i want it to?
Re: slight problem.. can anyone help? -
Dark_Kostas - 24.12.2011
GetPlayerAmour/Health doesn't "return" the value but stores it to a variable. So you need to do it like that
pawn Код:
new Float: PHealth;
new Float: PArmour;
GetPlayerHealth(killerid, PHealth);
GetPlayerArmour(killerid, PArmour);
SetPlayerHealth(killerid, PHealth + 10);
SetPlayerArmour(killerid, PArmour + 10);
Make sure you do some checks so the health/armour does't go over 100(unless you don't care)