02.12.2012, 12:55
(
Last edited by Dark Killer; 03/12/2012 at 08:59 AM.
)
Hello everyone
this is my 1st TUT
I Hope you will like it
Big but easy to understand
You Can Change 3 to the max_warns you want
like MAX_SPAMWARNS 5
Same with spam lines
You can change 2000 to 3000 - 4000 etc etc [Here 1000 = 1 sec 2000 = 2 secs and so on]
Everything is given in comments though
1st of all we will check if playerspam is more then spamlines or not if its true then the player will be give a warn with the a textdraw else playerspam will be reseted to 0
Same here too If warns are greater than max_spamwarns then the player will be telelported to jail and then will be kicked 
Here we are creating textdraw for the players at 7.000000, 123.000000 pixels of the screen [640*480 i guess]
Here when the player connects his/her spam is setted to 0 and spam warns too
and a timer is started
It will restart forwards every 2secs [#define SPAMRATESECS 2000 //here
]
here when the player disconnects his spam is setted to 0 and the timers are
killed
Then here when the player types text playersSpam is added +1 and if this is not reached to 3 then its resseted in our
Here is the fs
Here
Thats all

I Hope you will like it

Big but easy to understand
Quote:
#define MAX_SPAMWARNS 3 |

Same with spam lines
Quote:
#define SPAMRATESECS 2000 |
Code:
// 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;
Code:
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; }
Code:
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; }

Code:
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; }
Code:
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; }
and a timer is started
It will restart forwards every 2secs [#define SPAMRATESECS 2000 //here

Code:
public OnPlayerDisconnect(playerid, reason) { playersSPAM[playerid] = 0; KillTimer(timer[playerid]); KillTimer(timer2[playerid]); return 1; }

Code:
public OnPlayerText(playerid, text[]) { playersSPAM[playerid] +=1; return 1; }
Code:
public cSPAM(playerid)
Here
Thats all