Banning Spammers - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Banning Spammers (
/showthread.php?tid=439134)
Banning Spammers -
Geeboi_Mehdi - 23.05.2013
can some one help me make a anti cheat that detects if the player says some thing more than 7 times he gets banned i already got a anti here is one of them
pawn Код:
new wep = GetPlayerWeapon(playerid);
if(wep==1||wep==2||wep==3||wep==4||wep==5||wep==6||wep==7||wep==8||wep==9||wep==10||wep==11||wep==12||wep==13||wep==14||wep==15||wep==16||wep==17||wep==18||wep==22||wep==23||wep==24||wep==25||wep==26||wep==27||wep==28||wep==29||wep==30||wep==31||wep==32||wep==33||wep==34||wep==35||wep==36||wep==37||wep==38||wep==39||wep==40||wep==41||wep==42||wep==43||wep==44||wep==45)
{
BanUser(playerid, "Weapon hacks", "Johnny");
}
some thing like this but instead of banning for weapons it bans for people who flood/spam thanks
Re: Banning Spammers -
DobbysGamertag - 24.05.2013
Let me search my script for the one i've got
I'll modify it for you so it bans(hopefully)
Edit
pawn Код:
#define TIME_BETWEEN_MESSAGES 3 //thats 3 seconds between each message.
#define MAX_SPAM_WARNS 3 //thats 3 spam warnings too
new LastSpoke[MAX_PLAYERS],SpamWarns[MAX_PLAYERS];
public OnPlayerText(playerid,inputtext[])
{
if(LastSpoke[playerid] > gettime())
{
new string[128];
SpamWarns[playerid] ++;
if(SpamWarns[playerid] >= MAX_SPAM_WARNS)
{
format(string,sizeof(string),"%s has been banned for spamming",PlayerName);
SendClientMessageToAll(-1,string);
Ban(playerid);
}
else
{
SendClientMessage(playerid,-1,"You can't talk for "#TIME_BETWEEN_MESSAGES" seconds.");
SendClientMessage(playerid,-1,"Do not repeat yourself.");
}
return 0;
}
LastSpoke[playerid] = gettime() + TIME_BETWEEN_MESSAGES;
return 1;
}
Let me know if it's ok for what you need
Re: Banning Spammers -
Geeboi_Mehdi - 24.05.2013
Hey can you add it for me? i am getting a lot of errors here is the hole anti thing
pawn Код:
public AntiCheat()
{
for(new playerid; playerid<MAX_PLAYERS; playerid++)
{
if(IsPlayerConnected(playerid))
{
if(PlayerLogged[playerid] == 1 && PlayerSpawned[playerid] == 1 && PInfo[playerid][AdminLevel] == 6)
{
new wep = GetPlayerWeapon(playerid);
if(wep==1||wep==2||wep==3||wep==4||wep==5||wep==6||wep==7||wep==8||wep==9||wep==10||wep==11||wep==12||wep==13||wep==14||wep==15||wep==16||wep==17||wep==18||wep==22||wep==23||wep==24||wep==25||wep==26||wep==27||wep==28||wep==29||wep==30||wep==31||wep==32||wep==33||wep==34||wep==35||wep==36||wep==37||wep==38||wep==39||wep==40||wep==41||wep==42||wep==43||wep==44||wep==45)
{
BanUser(playerid, "Weapon hacks", "Johnny");
}
new Float:Armour;
GetPlayerArmour(playerid, Armour);
if(Armour > 0)
{
BanUser(playerid, "Armour hacks", "Johnny");
}
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
{
if(PInfo[playerid][AdminLevel] >= 0)
BanUser(playerid, "Jetpack hacks", "Johnny");
}
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
if(vfuel[vehicleid] > 0)
{
new speed = floatround(GetVehicleSpeed(vehicleid, 0), floatround_round);
if(speed > 239 && PInfo[playerid][TotalScore] < 10) //240 mph && under 10 score
{
BanUser(playerid, "Speed hack", "Johnny");
}
else if(speed > 205) //210 mph
{
new string[156];
format(string,sizeof(string),"[SPEED WARNING] %s(%d) is going %d MPH! /spec them!", PlayerName(playerid), playerid, speed);
SendAdminMessage(COLOR_ADMIN, string);
}
}
}
}
}
}
}