/Donut
#4

Put this in your command:

pawn Код:
// Set a repeating timer to call function 'donutHealth' every second.
SetPVarInt(playerid, "donutHealth", SetTimerEx("donutHealth", 1000, true, "i", playerid));
and out of your command:

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;
}
Untested.
Reply


Messages In This Thread
/Donut - by G*Mafia - 08.03.2011, 18:13
Re: /Donut - by xRyder - 08.03.2011, 19:08
Re: /Donut - by antonio112 - 08.03.2011, 20:32
Re: /Donut - by Calgon - 08.03.2011, 20:43
Re: /Donut - by Steven82 - 08.03.2011, 23:44
Re: /Donut - by G*Mafia - 09.03.2011, 10:32
Re: /Donut - by boelie - 09.03.2011, 10:38
Re: /Donut - by HyperZ - 09.03.2011, 11:38
Re: /Donut - by Sasino97 - 09.03.2011, 11:46
Re: /Donut - by Mean - 09.03.2011, 12:33

Forum Jump:


Users browsing this thread: 1 Guest(s)