08.03.2011, 20:43
Put this in your command:
and out of your command:
Untested.
pawn Код:
// Set a repeating timer to call function 'donutHealth' every second.
SetPVarInt(playerid, "donutHealth", SetTimerEx("donutHealth", 1000, true, "i", playerid));
pawn Код:
// Forward our function
forward donutHealth(playerid);
// Create our function
public donutHealth(playerid) {
// Create a temp. variable to store the player's health
new
Float: fHealth;
// Get the player's health
GetPlayerHealth(playerid, fHealth);
// Check if the player has MORE than 100 health.
if(fHealth > 100) {
return KillTimer(GetPVarInt(playerid, "donutHealth")); // Cancel the timer/function and don't add health
}
// Add health if everything is okay!
SetPlayerHealth(playerid, fHealth+5);
return 1;
}
