Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public e_COMMAND_ERRORS: OnPlayerCommandReceived(playerid, const cmdtext[], e_COMMAND_ERRORS:success) {
- if(!isPlayerLogged(playerid)) {
- defer KickEx(playerid);
- return COMMAND_ZERO_RET;
- }
- if(InRegister[playerid] > 0) return COMMAND_ZERO_RET;
- if(iGMXTick > 0) {
- if(!isScripter(playerid) || !EstiFondator(playerid))
- {
- SendClientMessage(playerid, COLOR_GREY, "Nu poti folosi comenzi in timp ce serverul se restarteaza.");
- return COMMAND_ZERO_RET;
- }
- }
- // -- ANTI SPAM -- //
- 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) {
- if(!strcmp(cmdtext, LastText[playerid]) && strlen(LastText[playerid]) > 0) return COMMAND_ZERO_RET;
- strcpy(LastText[playerid], cmdtext, 128);
- }
- if(LastTextTime[playerid] >= GetTickCount() && !pVar[playerid][pAdmin]) {
- TextCount[playerid]++;
- if(TextCount[playerid] > 5) {
- pVar[playerid][pMuted] = 1;
- pVar[playerid][pMuteTime] += 10;
- TextCount[playerid] = 0;
- varUpdate(playerid, "Muted", 1);
- varUpdate(playerid, "MuteTime", pVar[playerid][pMuteTime]);
- SendClientMessage(playerid, COLOR_DARKPINK, "You have been auto-muted for spamming. You will be unmuted in 10 seconds.");
- return COMMAND_ZERO_RET;
- }
- }
- LastTextTime[playerid] = GetTickCount() + 1000*3;
- // -- ANTI SPAM -- //
- //---- Anti Reclama ----//
- new word[30];
- new Cache: adv = mysql_query(SQL, "SELECT * FROM `adv`");
- for(new ix, jx = cache_get_row_count (); ix != jx; ++ix) {
- cache_get_field_content(ix, "word", word);
- if(strfind(cmdtext, word, true) != -1) {
- if(pVar[playerid][pAdmin] < 6) {
- SendAdminMessage(COLOR_RED2, "%s (%d, level %d) may be server advertising (word found %s):", 1, GetName(playerid), playerid, pVar[playerid][pLevel], word);
- SendAdminMessage(COLOR_RED2, cmdtext, 1);
- SCM(playerid, COLOR_LIGHTGREEN3, "Este interzis sa discuti despre alte servere sau sa faci reclama altor servere.");
- return COMMAND_ZERO_RET;
- }
- }
- }
- cache_delete(adv);
- // Command blocked
- new command[128];
- new Cache: result = mysql_query(SQL, "SELECT * FROM `blocked_cmd`");
- for(new i, j = cache_get_row_count(); i != j; ++i) {
- cache_get_field_content(i, "command", command);
- if(strcmp(cmdtext, command, true, strlen(command)) == 0) {
- SCM(playerid, COLOR_LIGHTGREEN3, "Aceasta comanda a fost dezactivata temporar de catre un administrator.");
- return COMMAND_ZERO_RET;
- }
- }
- cache_delete(result);
- // sleep
- if(pVar[playerid][pSleeping] == 1) {
- if(strcmp(cmdtext, "/sleep", true) == -1) {
- SendClientMessage(playerid, COLOR_LIGHTRED, "You are sleeping, you can't use commands.");
- return COMMAND_ZERO_RET;
- }
- }
- foreach(new x : Player) {
- if(Spectate[x] == playerid) {
- SCMf(x, COLOR_DARKPINK, "%s has used command %s.",GetName(playerid), cmdtext);
- }
- }
- return COMMAND_OK;
- }
- public e_COMMAND_ERRORS:OnPlayerCommandPerformed(playerid, const cmdtext[], e_COMMAND_ERRORS:success) {
- if(!isPlayerLogged(playerid)) {
- defer KickEx(playerid);
- return COMMAND_ZERO_RET;
- }
- if(success) SpamCheck[playerid] = GetTickCount();
- if(success != COMMAND_OK) {
- SCM(playerid, COLOR_WHITE,"ERROR: This command doesn't exist. Type /help!");
- return COMMAND_OK;
- }
- return COMMAND_OK;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement