need a better way to do this - 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: need a better way to do this (
/showthread.php?tid=232171)
need a better way to do this -
marinov - 27.02.2011
pawn Код:
forward RegenerateZombieHealth(playerid);
public RegenerateZombieHealth(playerid)
{
if(pInfo[playerid][Team] == 2)
{
new Float:hp;
GetPlayerHealth(playerid, hp);
if(hp < 200) SetPlayerHealth(playerid, hp+5);
CheckPlayerHealth(playerid, 200);
}
return 1;
}
This works, but sometimes health pass 200 and my anti hack bans the player, how can I do this but dont let life pass 200 (even if it stops realing if health is like 198 or something :P)
Re: need a better way to do this -
admantis - 27.02.2011
pawn Код:
if (hp > 200) { hp = 200; }
Re: need a better way to do this -
marinov - 27.02.2011
Quote:
Originally Posted by admantis
pawn Код:
if (hp > 200) { hp = 200; }
|
Can u also explain why (so I will learn :P)
Re: need a better way to do this -
Retardedwolf - 27.02.2011
if(hp < 195) SetPlayerHealth(playerid, hp+5);
Re: need a better way to do this -
marinov - 27.02.2011
Quote:
Originally Posted by Retardedwolf
if(hp < 195) SetPlayerHealth(playerid, hp+5);
|
Uhhhmmm didnt think of that, that will probrably work
Re: need a better way to do this -
admantis - 27.02.2011
Quote:
Originally Posted by marinov
Can u also explain why (so I will learn :P)
|
If player health is over 200 it will automatically turn to 200 so your anticheat won't do anything too bad, but Retardedwolf's solution is reliable as well