Health after respawn
#1

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?
Reply
#2

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;
}
Reply
#3

Jeez im so dumb... Thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)