Increase Health - 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: Increase Health (
/showthread.php?tid=112242)
Increase Health -
GreenHammy - 06.12.2009
hi, im wondering how you can increase health like for example, you walk into a checkpoint and it gives you 5 more health, im trying to do this but it just sets to that health level
any help?
Re: Increase Health -
jonrb - 06.12.2009
something like this? (not tested)
Код:
new oldhealth,newhealth;
GetPlayerHealth(playerid,oldhealth);
if(oldhealth<95) newhealth = oldhealth+5;
else newhealth = 100;
SetPlayerHealth(playerid,newhealth);
Re: Increase Health -
Sergei - 06.12.2009
pawn Код:
new Float:health; GetPlayerHealth(playerid,health);
if(health >= 95) SetPlayerHealth(playerid,100);
else SetPlayerHealth(playerid, floatround(health) + 5);
Re: Increase Health -
GreenHammy - 06.12.2009
what is floataround, i get error with it :S
Re: Increase Health -
Correlli - 06.12.2009
It's floatround, it rounds to the nearest integer.
Re: Increase Health -
Sergei - 06.12.2009
Quote:
Originally Posted by GreenHammy
what is floataround, i get error with it :S
|
Typo, floatround it is.
Re: Increase Health -
jonrb - 06.12.2009
you need to say what kind of rounding,
see here:
https://sampwiki.blast.hk/wiki/Floatround
and here:
https://sampwiki.blast.hk/wiki/Scripting...Old#floatround
Re: Increase Health -
GreenHammy - 06.12.2009
lol of course, thanks it works
Re: Increase Health -
omidi - 01.08.2010
Quote:
Originally Posted by Sergei
pawn Код:
new Float:health; GetPlayerHealth(playerid,health); if(health >= 95) SetPlayerHealth(playerid,100); else SetPlayerHealth(playerid, floatround(health) + 5);
|
can u put timer to do that code automaticly incearse 5 value per 10 sec