HoangNamMapper

errors

Sep 29th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.41 KB | None | 0 0
  1. #define FILTERSCRIPT
  2.  
  3. #include <a_samp>
  4.  
  5. #if defined FILTERSCRIPT
  6. #endif
  7. enum Info
  8. {
  9.    AdminLevel,
  10. }
  11. new muted[MAX_PLAYERS];
  12. new MGCount[MAX_PLAYERS];
  13. new ChatMGTime[MAX_PLAYERS][3];
  14. #define AutoUnmuteTime 2 //You can adjust this (2 minutes)
  15. new PlayerInfo[MAX_PLAYERS][Info];
  16. new MG [] = //You can add more symbols, characters in here
  17. {
  18.     "PG",
  19.     "MG",
  20.     "RK",
  21.     "admin",
  22.     "id",
  23.     "hack",
  24.     "bug",
  25.     "SK",
  26.     "BK"
  27. };
  28. public OnPlayerText(playerid, text[])
  29. {
  30.         for(new i = 0; i < sizeof(MG); i++)
  31.     {
  32.        if(strfind(text, MG[i], true) != -1 && IsPlayerAdmin(playerid) || PlayerInfo[playerid][AdminLevel] == 0)
  33.         {
  34.             AntiMG(playerid);
  35.             muted[playerid] = 1;
  36.             SendClientMessage(playerid, -1, "Meta Gaming! If you MG three times you will be kick");
  37.             return 0;
  38.         }
  39.     }
  40.        
  41.         if(muted[playerid] == 1)
  42.         {
  43.             SendClientMessage(playerid, 0xFF0000FF, "You have been muted!");
  44.             return 0;
  45.         }
  46.  
  47.         return 1;
  48.  
  49. }
  50.  
  51. stock AntiMG(playerid)
  52. {
  53.     MGCount[playerid]++;
  54.     switch (MGCount[playerid])
  55.     {
  56.         case 1:
  57.         {
  58.             ChatMGTime[playerid][0]=gettime();
  59.         }
  60.         case 2:
  61.         {
  62.             if((gettime()-ChatMGTime[playerid][0])<30)
  63.             {
  64.                 SendClientMessage(playerid,0xFF0000FF,"You have received a warning (1/3)! (Reason: MG)");
  65.                 ChatMGTime[playerid][1]=gettime();
  66.             }
  67.             else MGCount[playerid]=0;
  68.         }
  69.         case 3:
  70.         {
  71.             if((gettime()-ChatMGTime[playerid][1])<30)
  72.             {
  73.                 SendClientMessage(playerid,0xFF0000FF,"You have received a warning (2/3)! (Reason: Spam)");
  74.                 ChatMGTime[playerid][2]=gettime();
  75.             }
  76.             else MGCount[playerid]=0;
  77.         }
  78.         case 4..50:
  79.         {
  80.             new string[128],name[24];
  81.             GetPlayerName(playerid,name,24);
  82.             if((gettime()-ChatMGTime[playerid][2])<30)
  83.             {
  84.                 format(string,sizeof(string),"Player %s has been muted for 2 minutes! (Reason: Spam!)",name);
  85.                 SendClientMessageToAll(0xFF0000FF,string);
  86.                 SendClientMessage(playerid,0xFF0000FF,"You have received your final warning (3/3)! (Reason: Spam)");
  87.                 muted[playerid]=1;
  88.                 SetTimerEx("AutoUnMute",AutoUnmuteTime*60000,false,"i",playerid);
  89.             }
  90.         }
  91.     }
  92.     return 1;
  93. }
  94. public OnPlayerConnect(playerid)
  95. {
  96.     MGCount[playerid]=0;
  97.     muted[playerid]=0;
  98.     return 1;
  99. }
  100.  
  101. forward AutoUnMute(pID);
  102. public AutoUnMute(pID)
  103. {
  104.     muted[pID] = 0;
  105.     MGCount[pID]=0;
  106.     SendClientMessage(pID, 0xFF0000FF, "You have been unmuted automatically!");
  107.     return 1;
  108. }
Advertisement
Add Comment
Please, Sign In to add comment