#define MAX_SPAMWARNS 3 |
#define SPAMRATESECS 2000 |
// global vairiables new SPAMwarns[MAX_PLAYERS]; //SPAM WARNS R DEFAULT TO 3 YOU CAN CHANGE THEM IN Max_SPAMwarns :) new playersSPAM[MAX_PLAYERS]; //it will increase +1 as player types text later when we give instructions :D new timer[MAX_PLAYERS]; new timer2[MAX_PLAYERS]; // now the forwards call back functions forward cSPAM(playerid); //to check the number of SPAMs by a player forward cSPAMwarns(playerid); // checking number of SPAM warns new Text:warn; new Text:credits;
public cSPAM(playerid) { if (playersSPAM[playerid] >= SPAMLINES) // if playerspam is greater then SPAMlines then SPAM warns will be +1 { SPAMwarns[playerid] +=1; SendClientMessage(playerid,0x10F441AA,"You have been warned for SPAMing"); new string[256]; TextDrawShowForPlayer(playerid,warn); format(string,256, "Warned~n~~r~~n~You are warned for~n~~r~~n~SPAMing~n~~n~~w~Click Fire Button to close ~n~this box"); TextDrawSetString(warn,string); playersSPAM[playerid] =0; } else playersSPAM[playerid] =0; return 1; }
public cSPAMwarns(playerid) { if (SPAMwarns[playerid] >= MAX_SPAMWARNS ) // if SPAM warns are more then or = 3 the player will get kicked :D { new string[256]; new pname[126]; GetPlayerName(playerid,pname,sizeof(pname)); SetPlayerInterior(playerid,10); SetPlayerPos(playerid,215.5644,110.7332,999.0156); Kick(playerid); format(string,sizeof(string),"%s[%d] has been kicked from the server for SPAMing"); SendClientMessageToAll(0xFF0000C8,string); SPAMwarns[playerid] =0; } return 1; }
public OnFilterScriptInit() { print("\n--------------------------------------"); print("Anti SPAM by Pulkit :D"); print("--------------------------------------\n"); warn = TextDrawCreate(7.000000, 123.000000, ""); TextDrawAlignment(warn, 0); TextDrawLetterSize(warn, 0.399999, 0.800000); TextDrawColor(warn, 0xffff00ff); TextDrawSetOutline(warn, 1); TextDrawSetProportional(warn, 1); TextDrawSetShadow(warn, 1); credits = TextDrawCreate(7.000000, 123.000000, ""); TextDrawAlignment(credits, 0); TextDrawLetterSize(credits, 0.399999, 0.800000); TextDrawColor(credits, 0xffff00ff); TextDrawSetOutline(credits, 1); TextDrawSetProportional(credits, 1); TextDrawSetShadow(credits, 1); return 1; }
public OnPlayerConnect(playerid) { playersSPAM[playerid] = 0; SPAMwarns[playerid] =0; timer[playerid] = SetTimerEx("cSPAM",SPAMRATESECS,true,"i",playerid); timer2[playerid] = SetTimerEx("cSPAMwarns",SPAMRATESECS,true,"i",playerid); return 1; }
public OnPlayerDisconnect(playerid, reason) { playersSPAM[playerid] = 0; KillTimer(timer[playerid]); KillTimer(timer2[playerid]); return 1; }
public OnPlayerText(playerid, text[]) { playersSPAM[playerid] +=1; return 1; }
public cSPAM(playerid)