anti command spam problem
#5

pawn Код:
new SpamCount[MAX_PLAYERS] = 0;

public OnPlayerCommandReceived(playerid, cmdtext[])
{
   if(pInfo[playerid][Jailed] == 1 && pInfo[playerid][pLevel] == 0) return SendClientMessage(playerid,red,"You can not use commands in Jail");
   if(pInfo[playerid][Logged] != 1) return 0;
   new pNAme[30], string[128];
   SpamCount++;
   if(SpamCount == 3)
   {
      GetPlayerName(playerid, pName, sizeof(pName));
      format(string, sizeof(string), "[Anti-Spam]: %s has been kicked for command spamming.", pName);
      SendClientMessageToAll(0xFFFFFFFF, KMessage);
      print(KMessage);
      Kick(playerid);
   }
   SetTimerEx("ResetCount", SpamLimit, false, "i", playerid);
   if(ReadCommands == 1)
   {
      format(Cmdstr, sizeof(Cmdstr), ">>> %s(%d) Used command: %s", GetName(playerid),playerid,cmdtext);
      foreach(Player, i)
      {
         if(pInfo[i][pLevel] >= 1 && pInfo[i][pLevel] > pInfo[playerid][pLevel] && i != playerid)
         {
            SendClientMessage(i, Cmdcolor, Cmdstr);
         }
      }
   }
   return 1;
}

forward ResetCount(playerid);
public ResetCount(playerid)
{
   SpamCount[playerid] = 0;
   return 1;
}
Reply


Messages In This Thread
anti command spam problem - by Mijata - 13.03.2015, 16:36
Re: anti command spam problem - by Nabster - 13.03.2015, 16:57
Re: anti command spam problem - by Mijata - 13.03.2015, 16:59
Re: anti command spam problem - by Mijata - 13.03.2015, 17:45
Re: anti command spam problem - by ReD_HunTeR - 13.03.2015, 18:09

Forum Jump:


Users browsing this thread: 5 Guest(s)