11.12.2009, 22:43
hey,i wanted to make if player enters checkpoint,then he will get the thing only once,and the checkpoint wont dissapear,how to do that?Thanks,or if u dont know,how to make that it gives 1 hp per sec?
new HealthTimer;
forward RaiseHealth(playerid, Float:Health);
public RaiseHealth(playerid)
{
new
Float:Health;
GetPlayerHealth(playerid, Float:Health);
SetPlayerHealth(playerid, Float:Health+1.00);
return true;
}
public OnPlayerEnterCheckpoint(playerid)
{
HealthTimer = SetTimerEx("RaiseHealth", 1000, true, "f", playerid);
return true;
}
public OnPlayerLeaveCheckpoint(playerid)
{
KillTimer(HealthTimer);
return true;
}
Originally Posted by Aber▲
I took it to myself to create it for you. Edit it how you like. (Untested)
pawn Код:
|
new
healthTimer[MAX_PLAYERS];
forward RaiseHealth(playerid);
public RaiseHealth(playerid)
{
new
Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, floatround(health) + 1);
if(health >= 100.0)
{
KillTimer(healthTimer[playerid]);
SetPlayerHealth(playerid, 100);
}
return true;
}
public OnPlayerEnterCheckpoint(playerid)
{
healthTimer[playerid] = SetTimerEx("RaiseHealth", 1000, true, "i", playerid);
return true;
}
public OnPlayerLeaveCheckpoint(playerid)
{
KillTimer(healthTimer[playerid]);
return true;
}