07.12.2009, 17:15
I take advantage of your code:
[size=14px]ChangePlayerHealth(playerid, method=increase, Float:amount);[/size]
playerid - id of the player you want to change health for.
method - increase or decrease
Float:amount - how much you want to decrease/increase health with (in float)
EDIT:
I forgot a little important piece of code...
Add this on top:
Correct me if this code is totally wrong, unefficient and not working.
EDIT2: Oh and if the code actually works, here's example usage:
I know these commands are pretty unefficient, lol. Just some simple examplesxD
****NOTE: This code is NOT compiled nor tested!****
It's probally not even compiling, but oh well...
Sorry if my english is fcked, lol
[size=14px]ChangePlayerHealth(playerid, method=increase, Float:amount);[/size]
playerid - id of the player you want to change health for.
method - increase or decrease
Float:amount - how much you want to decrease/increase health with (in float)
EDIT:
I forgot a little important piece of code...
Add this on top:
pawn Код:
#define increase 1
#define decrease 2
pawn Код:
stock ChangePlayerHealth(playerid, Float:amount, method=increase)
{
new Float:health;
GetPlayerHealth(playerid, health);
switch(method)
{
case increase: SetPlayerHealth(playerid, health+amount);
case decrease: SetPlayerHealth(playerid, health-amount);
}
return true;
}
EDIT2: Oh and if the code actually works, here's example usage:
pawn Код:
//increase
dcmd_ihealth(playerid, p[])
return ChangePlayerHealth(playerid, strval(p));
//decrease
dcmd_dhealth(playerid, p[])
return ChangePlayerHealth(playerid, strval(p), decrease);
****NOTE: This code is NOT compiled nor tested!****
It's probally not even compiling, but oh well...
Sorry if my english is fcked, lol