Posts: 417
Threads: 104
Joined: Jul 2011
Reputation:
0
18.11.2011, 23:45
(
Последний раз редактировалось Azzeto; 19.11.2011 в 00:34.
)
EDIT: Another Question: How would I get a players health then subtract like -5 health from it? Using GetPlayerHealth and SetPlayerHealth, Thanks.
Posts: 417
Threads: 104
Joined: Jul 2011
Reputation:
0
Updated main post with another help question
Posts: 6,129
Threads: 36
Joined: Jan 2009
pawn Код:
new Float: fHealth;
GetPlayerHealth(playerid, fHealth);
SetPlayerHealth(playerid, fHealth-5);
Subtraction with floats is just as simple as it is with integers.
Posts: 398
Threads: 19
Joined: Aug 2011
Reputation:
0
^ Unneed lined though and it's a variable not a float.
Posts: 6,129
Threads: 36
Joined: Jan 2009
Quote:
Originally Posted by Cody_Maverak
Heres how I would do it:
pawn Код:
new health; health = GetPlayerHealth(playerid); health = health-5; SetPlayerHealth(playerid, health);
|
That wouldn't work, GetPlayerHealth returns a float to the variable that is the second parameter of the function, you can't use integers and you've written the function parameters incorrectly.
https://sampwiki.blast.hk/wiki/GetPlayerHealth