23.06.2015, 23:24
how I can make that player will appear in red if it lacks health, and detect if the player moves or not
public OnGameModeInit()
{
SetTimer("CheckHealth",2000,1);
return 1;
}
forward CheckHealth();
public CheckHealth()
{
new Float:h;
GetPlayerHealth(playerid,h);
if(h <= 10)
{
SetPlayerColor(playerid,COLOR_RED);
return 1;
}
return 1;
}
public OnGameModeInit()
{
SetTimer("MovingPlayer",5000,1);
return 1;
}
forward MovingPlayer(playerid);
public MovingPlayer(playerid)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x+1,y,z);
GameTextForPlayer(playerid,"~r~You are moving",3000,5);
}
new Float:old_x, Float:old_y, Float:old_z; public OnPlayerUpdate(playerid) { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); if(old_x != x && old_y != y && old_z != z) { OnPlayerMove(playerid); GetPlayerPos(old_x, old_y, old_z); } } forward OnPlayerMove(playerid); public OnPlayerMove(playerid) { // Do domething when the player moves }