Health after respawn - 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)
+--- Thread: Health after respawn (
/showthread.php?tid=563665)
Health after respawn -
Supermaxultraswag - 16.02.2015
I want to add player 100 health
after he die and spawn.
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SetTimerEx("Health", 4000,false, "i", playerid);
return 1;
}
forward Health(playerid);
public Health(playerid)
{
SetPlayerHealth(playerid, 100);
}
Is it the best way to do it?
Re: Health after respawn -
M4D - 16.02.2015
no ! just create a new variable that will be true if player die! just look at the example script:
pawn Код:
new bool:PlayerDead[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
PlayerDead[playerid] = false;
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerDead[playerid] = true;
return 1;
}
public OnPlayerSpawn(playerid)
{
if(PlayerDead[playerid] == true)
{
SetPlayerHealth(playerid, 100);
PlayerDead[playerid] = false;
}
return 1;
}
Re: Health after respawn -
Supermaxultraswag - 16.02.2015
Jeez im so dumb... Thank you!