Some function trouble
#1

I'm trying to make a special drug command but i doesn't work as i wanted it to. I've made the basics i needed but i need the function to get the players health and then add to it not setting it i've tryed this

SetPlayerHealth(playerid, GetPlayerHealth(playerid) + 25);
it gave me an error
i've tryed like on wiki still error

I don't know what to do if someone can help me it'll be apreciated, thanks in advance.
Reply
#2

pawn Код:
new Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health+25);
Reply
#3

Or you can use a custom function, add this to somewhere (maybe the bottom) of your code:

pawn Код:
stock GivePlayerHealth(playerid, Float:amount)
{
     static Float:health;
     GetPlayerHealth(playerid, health);
     SetPlayerHealth(playerid, health+amount);
}
Then instead of having a block of code to do one thing, just call the function above.

(GivePlayerHealth(playerid, amount))
Reply
#4

thanks alot ,i owe ya one
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)