Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #include <a_samp>
- #if defined FILTERSCRIPT
- #endif
- enum Info
- {
- AdminLevel,
- }
- new muted[MAX_PLAYERS];
- new MGCount[MAX_PLAYERS];
- new ChatMGTime[MAX_PLAYERS][3];
- #define AutoUnmuteTime 2 //You can adjust this (2 minutes)
- new PlayerInfo[MAX_PLAYERS][Info];
- new MG [] = //You can add more symbols, characters in here
- {
- "PG",
- "MG",
- "RK",
- "admin",
- "id",
- "hack",
- "bug",
- "SK",
- "BK"
- };
- public OnPlayerText(playerid, text[])
- {
- for(new i = 0; i < sizeof(MG); i++)
- {
- if(strfind(text, MG[i], true) != -1 && IsPlayerAdmin(playerid) || PlayerInfo[playerid][AdminLevel] == 0)
- {
- AntiMG(playerid);
- muted[playerid] = 1;
- SendClientMessage(playerid, -1, "Meta Gaming! If you MG three times you will be kick");
- return 0;
- }
- }
- if(muted[playerid] == 1)
- {
- SendClientMessage(playerid, 0xFF0000FF, "You have been muted!");
- return 0;
- }
- return 1;
- }
- stock AntiMG(playerid)
- {
- MGCount[playerid]++;
- switch (MGCount[playerid])
- {
- case 1:
- {
- ChatMGTime[playerid][0]=gettime();
- }
- case 2:
- {
- if((gettime()-ChatMGTime[playerid][0])<30)
- {
- SendClientMessage(playerid,0xFF0000FF,"You have received a warning (1/3)! (Reason: MG)");
- ChatMGTime[playerid][1]=gettime();
- }
- else MGCount[playerid]=0;
- }
- case 3:
- {
- if((gettime()-ChatMGTime[playerid][1])<30)
- {
- SendClientMessage(playerid,0xFF0000FF,"You have received a warning (2/3)! (Reason: Spam)");
- ChatMGTime[playerid][2]=gettime();
- }
- else MGCount[playerid]=0;
- }
- case 4..50:
- {
- new string[128],name[24];
- GetPlayerName(playerid,name,24);
- if((gettime()-ChatMGTime[playerid][2])<30)
- {
- format(string,sizeof(string),"Player %s has been muted for 2 minutes! (Reason: Spam!)",name);
- SendClientMessageToAll(0xFF0000FF,string);
- SendClientMessage(playerid,0xFF0000FF,"You have received your final warning (3/3)! (Reason: Spam)");
- muted[playerid]=1;
- SetTimerEx("AutoUnMute",AutoUnmuteTime*60000,false,"i",playerid);
- }
- }
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- MGCount[playerid]=0;
- muted[playerid]=0;
- return 1;
- }
- forward AutoUnMute(pID);
- public AutoUnMute(pID)
- {
- muted[pID] = 0;
- MGCount[pID]=0;
- SendClientMessage(pID, 0xFF0000FF, "You have been unmuted automatically!");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment