Spam question?!
#9

Quote:
Originally Posted by _Jay_
I wouldn't recommend using a timer for this. Try GetTickCount()

Код:
static n_PlayerLastUsedCommand[MAX_PLAYERS];

public OnPlayerDisconnect(playerid)
{
  n_PlayerLastUsedCommand[playerid] = 0;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp(cmdtext, "/somecmd"))
  {
    if(n_PlayerLastUsedCommand[playerid] != 0 && GetTickCount() - n_PlayerLastUsedCommand[playerid] < 5*60*1000)
    {
      SendClientMessage(playerid, COLOR_RED, "You can only use this once every 5 minutes."); 
      return 1;
    } 
  
    n_PlayerLastUsedCommand[playerid] = GetTickCount();
 
   // rest of the cmd
    
  }
}
he was saying about both .If any one use GetTickCount in command the other commands will also stop working ,In which you use GetTickCount .That`s why i didnt post here about GetTickCount or its easy for me to explain rather then variables!
Reply


Messages In This Thread
Spam question?! - by DarkPower - 15.03.2010, 13:22
Re: Spam question?! - by DarkPower - 15.03.2010, 13:33
Re: Spam question?! - by Naxix - 15.03.2010, 13:46
Re: Spam question?! - by Deat_Itself - 15.03.2010, 13:48
Re: Spam question?! - by DarkPower - 15.03.2010, 13:56
Re: Spam question?! - by Deat_Itself - 15.03.2010, 13:58
Re: Spam question?! - by DarkPower - 15.03.2010, 13:59
Re: Spam question?! - by Jay_ - 15.03.2010, 14:02
Re: Spam question?! - by Deat_Itself - 15.03.2010, 14:10

Forum Jump:


Users browsing this thread: 1 Guest(s)