Setting timer in command
#3

PHP код:
new last[MAX_PLAYERS]; //global
COMMAND:hello(playerid,params[])
{
    if(
last[playerid] < gettime())
    {
        
last[playerid] = gettime()+5;
        
//your "hello"-command
        
return 1;
    }
    else
    {
        new 
string[145];
        
format(string,sizeof(string),"You have to wait %i seconds.",last[playerid]-gettime());
        
SendClientMessage(playerid,-1,string);
    }
    return 
1;

Here is a second example with gettime(). Now you have two options how you want to realize this command.

@Sascha:
SendClientMessage can maximal sends 145 letters.
Reply


Messages In This Thread
Setting timer in command - by eikzdej - 02.02.2016, 14:20
Re: Setting timer in command - by Sascha - 02.02.2016, 14:34
Re: Setting timer in command - by Mencent - 02.02.2016, 15:58
Re: Setting timer in command - by eikzdej - 03.02.2016, 06:56

Forum Jump:


Users browsing this thread: 2 Guest(s)