SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 16/11/2013, 07:30 PM   #1
kingcrome
Big Clucker
 
Join Date: Oct 2013
Posts: 89
Reputation: 0
Exclamation timer after command

How can i add a timer so
. Vip use command /kitvip.
How can i make a timer so person cant use command after like 20min
kingcrome is offline   Reply With Quote
Old 16/11/2013, 07:35 PM   #2
Diogo123
High-roller
 
Diogo123's Avatar
 
Join Date: Aug 2011
Location: No Mundo de SAO ;)
Posts: 1,146
Reputation: 119
Default Re: timer after command

pawn Code:
new Temp[MAX_PLAYERS];

//OnPlayerConnect:
Temp[playerid] = 0;

//Begin the command
if(gettime() - Temp[playerid] < 20)  return SendClientMessage(playerid, 0xFF0000FF, "Wait time is up");
Temp[playerid] = gettime();



change the 20 to the value you want
__________________
Desenvolvimentos:

New Life RP
Assassins City Freeroam BR [ 39%]

Atualmente criando sistema de eventos
Comming ...
Diogo123 is offline   Reply With Quote
Old 16/11/2013, 07:37 PM   #3
Skimmer
Gangsta
 
Skimmer's Avatar
 
Join Date: Oct 2012
Location: Germany
Posts: 484
Reputation: 56
Default AW: timer after command

Simple. Create a variable, which saves the time of using the command.

pawn Code:
new KITVIP_TICKER[MAX_PLAYERS];

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/kitvip", cmdtext, true, 10) == 0)
    {
        if((gettime() - KITVIP_TICKER[playerid]) < ((1000 * 60) * 20)) return SendClientMessage(playerid, -1, "Please wait before using this command again.");

        KITVIP_TICKER[playerid] = gettime();
        // The command
        return 1;
    }
    return 0;
}

Don't forgot to reset variable after quit. (OnPlayerDisconnect)
Skimmer is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command Timer c0smiNN Scripting Help 1 30/04/2013 06:10 PM
Timer on Command - How!? FL3GM4 Scripting Help 0 05/01/2013 08:19 PM
Command timer FL3GM4 Scripting Help 2 17/12/2012 10:44 PM
[HELP] A timer on a command(triggered, whatever) + find command Biesmen Help Archive 5 07/10/2010 08:01 PM
Command timer DauerDicht Help Archive 3 13/09/2009 12:01 PM


All times are GMT. The time now is 06:25 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.