SA-MP Forums Archive
How to increase players health by 5 - 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: How to increase players health by 5 (/showthread.php?tid=129368)



How to increase players health by 5 - Torran - 21.02.2010

Hello,

Im wanting to increase a players health by 5,
How would i do that?


Re: How to increase players health by 5 - RoamPT - 21.02.2010

Don't know, maybe(not sure lol):
pawn Код:
SetPlayerHealth(playerid, +5);



Re: How to increase players health by 5 - Torran - 21.02.2010

Quote:
Originally Posted by RoamPT
Don't know, maybe(not sure lol):
pawn Код:
SetPlayerHealth(playerid, +5);
Ive tried that it didnt work


Re: How to increase players health by 5 - RoamPT - 21.02.2010

Hm i guess it isn't possible then.


Re: How to increase players health by 5 - Rizard - 21.02.2010

it is and this will

new Float:hp;
GetPlayerHealth(playerid,hp);
SetPlayerHealth(playerid,hp+5);

EDIT: sorry it's late

big auch if it won't xD


Re: How to increase players health by 5 - Torran - 21.02.2010

Quote:
Originally Posted by RoamPT
Hm i guess it isn't possible then.
Lol it is, You mix setplayerhealth with getplayerhealth but i cant remember how exactly

EDIT: Thanks


Re: How to increase players health by 5 - Correlli - 21.02.2010

pawn Код:
new
    Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, floatround(health) + 5);



Re: How to increase players health by 5 - Rizard - 21.02.2010

Quote:
Originally Posted by Don Correlli
pawn Код:
new
    Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, floatround(health) + 5);
auch anyway, cause, that's kinda what I posted , wait I notice something (shit it's late) is the floatround realy needed?


Re: How to increase players health by 5 - Correlli - 21.02.2010

Quote:
Originally Posted by Rizard
auch anyway, cause, that's kinda what I posted
Your example was wrong, you've edited it while i was posting mine.

Quote:
Originally Posted by Rizard
wait I notice something (shit it's late) is the floatround realy needed?
Amount of health with SetPlayerHealth is an integer type in 0.3, not float anymore, so i'm using floatround to round the health variable to an integer.


Re: How to increase players health by 5 - Rizard - 21.02.2010

alrighty then but I posted wrong the first time and editedcorrected later cause it's fucking late xD

and thnx, I have learned