Deduct HP instead of setting it to a negative point
#1

I wish to deduct HP. For example, if a player does something, I want 60 hp points to be deducted from him.

I know it's not SetPlayerHealth... or is it?
Reply
#2

Well you have to use this
PHP код:
 new Float:HP;//  You can change the fload name from HP to what ever. 
then
PHP код:
    GetPlayerHealth(playeridHP); //We're saving it to our new Float:HP variable.
    
SetPlayerHealth(playerid, (HP60)); 
//you can change the ammount to 50 or...
Reply
#3

Make sure the value doesn't go negative aswel:

pawn Код:
new Float:hp;
GetPlayerHealth(playerid, hp);
SetPlayerHealth(playerid, (hp - 60 >= 0) ? (hp - 60) : 0);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)