Advertisement
Guest User

ycmd

a guest
Nov 19th, 2020
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.38 KB | None | 0 0
  1. public e_COMMAND_ERRORS: OnPlayerCommandReceived(playerid, const cmdtext[], e_COMMAND_ERRORS:success) {
  2.     if(!isPlayerLogged(playerid)) {
  3.         defer KickEx(playerid);
  4.         return COMMAND_ZERO_RET;
  5.     }
  6.     if(InRegister[playerid] > 0) return COMMAND_ZERO_RET;
  7.     if(iGMXTick > 0) {
  8.         if(!isScripter(playerid) || !EstiFondator(playerid))
  9.         {
  10.             SendClientMessage(playerid, COLOR_GREY, "Nu poti folosi comenzi in timp ce serverul se restarteaza.");
  11.             return COMMAND_ZERO_RET;
  12.         }
  13.     }
  14.  
  15.     // -- ANTI SPAM -- //
  16.     if(strfind(cmdtext, "/s ", true) != -1 || strfind(cmdtext, "/b ", true) != -1 || strfind(cmdtext, "/sms ", true) != -1 || strfind(cmdtext, "/reply ", true) != -1 || strfind(cmdtext, "/wt ", true) != -1) {
  17.         if(!strcmp(cmdtext, LastText[playerid]) && strlen(LastText[playerid]) > 0) return COMMAND_ZERO_RET;
  18.         strcpy(LastText[playerid], cmdtext, 128);
  19.     }
  20.     if(LastTextTime[playerid] >= GetTickCount() && !pVar[playerid][pAdmin]) {
  21.         TextCount[playerid]++;
  22.         if(TextCount[playerid] > 5) {
  23.             pVar[playerid][pMuted] = 1;
  24.             pVar[playerid][pMuteTime] += 10;
  25.             TextCount[playerid] = 0;
  26.             varUpdate(playerid, "Muted", 1);
  27.             varUpdate(playerid, "MuteTime", pVar[playerid][pMuteTime]);
  28.             SendClientMessage(playerid, COLOR_DARKPINK, "You have been auto-muted for spamming. You will be unmuted in 10 seconds.");
  29.             return COMMAND_ZERO_RET;
  30.         }
  31.     }
  32.     LastTextTime[playerid] = GetTickCount() + 1000*3;
  33.     // -- ANTI SPAM -- //
  34.  
  35.     //---- Anti Reclama ----//
  36.     new word[30];
  37.     new Cache: adv = mysql_query(SQL, "SELECT * FROM `adv`");
  38.     for(new ix, jx = cache_get_row_count (); ix != jx; ++ix) {
  39.         cache_get_field_content(ix, "word", word);
  40.         if(strfind(cmdtext, word, true) != -1) {
  41.             if(pVar[playerid][pAdmin] < 6) {
  42.                 SendAdminMessage(COLOR_RED2, "%s (%d, level %d) may be server advertising (word found %s):", 1, GetName(playerid), playerid, pVar[playerid][pLevel], word);
  43.                 SendAdminMessage(COLOR_RED2, cmdtext, 1);
  44.                 SCM(playerid, COLOR_LIGHTGREEN3, "Este interzis sa discuti despre alte servere sau sa faci reclama altor servere.");
  45.                 return COMMAND_ZERO_RET;
  46.             }
  47.         }
  48.     }
  49.     cache_delete(adv);
  50.  
  51.     // Command blocked
  52.     new command[128];
  53.     new Cache: result = mysql_query(SQL, "SELECT * FROM `blocked_cmd`");
  54.  
  55.     for(new i, j = cache_get_row_count(); i != j; ++i) {
  56.         cache_get_field_content(i, "command", command);
  57.         if(strcmp(cmdtext, command, true, strlen(command)) == 0) {
  58.             SCM(playerid, COLOR_LIGHTGREEN3, "Aceasta comanda a fost dezactivata temporar de catre un administrator.");
  59.             return COMMAND_ZERO_RET;
  60.         }
  61.     }
  62.     cache_delete(result);
  63.  
  64.     // sleep
  65.     if(pVar[playerid][pSleeping] == 1) {
  66.         if(strcmp(cmdtext, "/sleep", true) == -1) {
  67.             SendClientMessage(playerid, COLOR_LIGHTRED, "You are sleeping, you can't use commands.");
  68.             return COMMAND_ZERO_RET;
  69.         }
  70.     }
  71.     foreach(new x : Player) {
  72.         if(Spectate[x] == playerid) {
  73.             SCMf(x, COLOR_DARKPINK, "%s has used command %s.",GetName(playerid), cmdtext);
  74.         }
  75.     }
  76.     return COMMAND_OK;
  77. }
  78.  
  79. public e_COMMAND_ERRORS:OnPlayerCommandPerformed(playerid, const cmdtext[], e_COMMAND_ERRORS:success) {
  80.     if(!isPlayerLogged(playerid)) {
  81.         defer KickEx(playerid);
  82.         return COMMAND_ZERO_RET;
  83.     }
  84.     if(success) SpamCheck[playerid] = GetTickCount();
  85.     if(success != COMMAND_OK) {
  86.             SCM(playerid, COLOR_WHITE,"ERROR: This command doesn't exist. Type /help!");
  87.             return COMMAND_OK;
  88.         }
  89.     return COMMAND_OK;
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement