Need help knowing wich forward is...
#1

Anyoen can tell me where to make a public that read "if(playerhealth <= 20)"
To freeze him on the floor waiting an ambulance?

some1 told me that is OnPlayerUpdate.

Is he right? Can you tell me with forward/public is? And then the include.

Thank you

Shellegg
Reply
#2

You could use OnPlayerUpdate.

pawn Code:
public OnPlayerUpdate(playerid)
{
  new Float:Health;
  GetPlayerHealth(playerid,Health);
  if(Health <= 20)
  {
    TogglePlayerControllable(playerid,0);
    //And the rest or w/e
  }
  return 1;
}
Reply
#3

I would make new function and call it.. lets say every 1 to 2 seconds. I don't know how often is OnPlayerUpdate is called, haven't tested.. but probably a lot. So, timer might be better way to go.
Reply
#4

Quote:
Originally Posted by 13th
I would make new function and call it.. lets say every 1 to 2 seconds. I don't know how often is OnPlayerUpdate is called, haven't tested.. but probably a lot. So, timer might be better way to go.
an example?
Reply
#5

Code:
forward CheckHealth();

public OnGameModeInit()
{
	SetTimer("CheckHealth",1500,true);
}

public CheckHealth()
{
	new Float: PlayerHealth;
	
	for( new playerid; playerid <= GetMaxPlayers(); playerid++ )
	{
	  if( IsPlayerConnected(playerid) )
	  {
			GetPlayerHealth(playerid, PlayerHealth);
			if( PlayerHealth < 20 )
			{
			  TogglePlayerControllable(playerid, false);
			}
	  }
	}
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)