25.08.2013, 11:52
Hello, I have currently made a command that heals me over time and until I reach 100 HP.
How could I make the command to last for only 30 seconds?
Here is the code!
How could I make the command to last for only 30 seconds?
Here is the code!
Код:
new healer_timer[MAX_PLAYERS]; forward public HealSlowly( playerid );
Код:
if (strcmp("/heal", cmdtext, true, 10) == 0)
{
healer_timer[ playerid ] = SetTimerEx("HealSlowly", 2000, 1, "d", playerid);
ApplyAnimation(playerid,"SMOKING","M_smk_in",4.2,0,0,0,0,0,1);
SendClientMessage(playerid, 0xFF0000AA, "You are on drugs, health refilling until 100!");
return 1;
}
Код:
public HealSlowly( playerid )
{
new Float:health;
GetPlayerHealth(playerid, health);
if( health == 100)
{
KillTimer(healer_timer[playerid]);
}
else SetPlayerHealth( playerid, health + 3 );
return 1;
}
Код:
public OnPlayerDisconnect(playerid, reason)
{
KillTimer(healer_timer[playerid]);
return 1;
}

