help pls
#1

i made timer for using command, they have to wait 3 seconds to use the command again but i wanna disable it for admins bec there is slap cmd and i wanna spam it but i can't bec i have to wait 3 secs so i want to disable it for admins only

code :

PHP код:
new lastcommand[MAX_PLAYERS];
public 
OnPlayerDisconnect(playeridreason)
{  
    
lastcommand[playerid]=0//reset command cooldown time
    
return 1;
}
public 
OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    if(!
success)
    {
        new 
string[128];
        
format(stringsizeof(string), "{FF6600}[DBot]: {FFFFFF}Command {FF0000}%s{FFFFFF} not found, Type {FF6600}/cmds {FFFFFF}to see server commands"cmdtext);
        
SendClientMessage(playeridCOLOR_WHITEstring);
    }
    else if(
success)
    {
        
lastcommand[playerid]=gettime();
    }
    return 
1;
}
public 
OnPlayerCommandReceived(playeridcmdtext[]) //command cooldown
{
    if(
lastcommand[playerid] != && gettime()-lastcommand[playerid] < 3)
    {
        
SendClientMessage(playeridCOLOR_RED"Please wait {AFAFAF}3 {FF0000}seconds before using any command again!");
        return 
0;
    }
    return 
1;

Reply


Messages In This Thread
help pls - by DeStRoY232 - 20.10.2017, 11:12
Re: help pls - by DonaldDuck - 20.10.2017, 11:14
Re: help pls - by DeStRoY232 - 20.10.2017, 11:15
Re: help pls - by DonaldDuck - 20.10.2017, 11:18
Re: help pls - by DeStRoY232 - 20.10.2017, 11:19
Re: help pls - by DonaldDuck - 20.10.2017, 11:20
Re: help pls - by DeStRoY232 - 20.10.2017, 11:21
Re: help pls - by FrezQ - 20.10.2017, 11:29
Re: help pls - by FrezQ - 20.10.2017, 11:32
Re: help pls - by DeStRoY232 - 20.10.2017, 12:03

Forum Jump:


Users browsing this thread: 2 Guest(s)