[Tutorial] Using less timers (1 timer for everything - faster script)
#10

Quote:
Originally Posted by AndreT
View Post
pawn Code:
COMMAND:heal(playerid, params[])
{
    if((gettime() - heal_reload[playerid]) < 10)
        return SendClientMessage(playerid, 0xFF0000FF, "Please wait before using this command again!"), true;
    heal_reload[playerid] = gettime();

    SetPlayerHealth(playerid,100.0);
    SendClientMessage(playerid,0xFFFFFFFF,"You've healed yourself.");
    return 1;
}
You can also use this way.

pawn Code:
COMMAND:heal(playerid, params[])
{
    if(heal_reload[playerid]) >= gettime()) return SendClientMessage(playerid, 0xFF0000FF, "Please wait before using this command again!"), true;
    heal_reload[playerid] = gettime() + 10;

    SetPlayerHealth(playerid,100.0);
    SendClientMessage(playerid,0xFFFFFFFF,"You've healed yourself.");
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)