delay command
#2

There's an easier way to do that. At first you define a variable which saves the timestamp at the moment where the player used that command.
And when he uses the command again, you simply subtract that value from the current timestamp and check whether the value is less than 10 (for 10 seconds) or not.

pawn Code:
new lastCommandUsed[MAX_PLAYERS];

YCMD:money(playerid, params[], help)
{
    if((gettime() - lastCommandUsed[playerid]) < 10)
    return SendFormatMessage(playerid,-1,"Nu poti sa utilizezi aceasta comanda timp de %i secunde",delay[playerid]);
    // your code
    lastCommandUsed[playerid] = gettime();
    return 1;
}
Reply


Messages In This Thread
delay command - by Calinut200 - 16.05.2020, 18:50
Re: delay command - by Skimmer - 16.05.2020, 19:02

Forum Jump:


Users browsing this thread: 1 Guest(s)