server advertising ban bugged - 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: server advertising ban bugged (
/showthread.php?tid=431757)
server advertising ban bugged -
Geeboi_Mehdi - 19.04.2013
when i do some thing like . . . i get banned for advertising but if you post a Real ip u do get banned but still how can i know if some one is actually is advertising and some one isnt here is the part
pawn Код:
stock IsIp(const string[])
{
new count = 0;
new pos[50];
new length = strlen(string);
for(new n=0; n<length; n++)
{
if(string[n] == '.')
{
if(count < 50)
{
pos[count] = n;
}
count++;
}
}
if(count >= 3)
{
new res[50];
for(new n=0; n<count; n++)
{
if(n != (count - 1) && n != count)
{
if((pos[n+1] - pos[n]) > 4 || (pos[n+1] - pos[n]) == 1)
{
res[n] = 0;
}
else
{
res[n] = 1;
}
}
}
new result = 0;
for(new n=0; n<count; n++)
{
if(res[n] == 1) result++;
}
if(result >= 2)
{
return 1;
}
}
return 0;
}
i think this is the ip because here is the were he bans
pawn Код:
if(IsIp(text) && PInfo[playerid][AdminLevel] < 5)
{
new string[256];
format(string, sizeof(string), "{FFFFFF}Administrator {FF9900}Johnny{FFFFFF} Thinks {FF9900}%s(%d){FFFFFF} is server Advertising!!", PlayerName(playerid),playerid);
SendClientMessageToAll(COLOR_ERROR, string);
return 0;
}
if this isnt it just let me know
Re: server advertising ban bugged -
DaTa[X] - 19.04.2013
this is my anti ip ad
pawn Код:
stock IpAds(string[]) // i dont remember who made this
{
new
dotCount
;
for(new i; string[i] != EOS; ++i)
{
if(('0' <= string[i] <= '9') || string[i] == '.' || string[i] == ':')
{
if((string[i] == '.') && (string[i + 1] != '.') && ('0' <= string[i - 1] <= '9'))
{
++dotCount;
}
continue;
}
}
return (dotCount > 2);
}
public OnPlayerText(playerid, text[])
{
if(IpAds(text))
{
BanEx(playerid,"Advertise");
return 0;
}
}
i suggest tp use regex
Re: server advertising ban bugged -
Face9000 - 19.04.2013
pawn Код:
stock IsAdvertisement(text[])
{
new NuCnt,DotCnt;
for (new i = 0, l = strlen(text); i < l; i++)
{
if ('0' <= text[i] <= '9'){
NuCnt++; continue;}
if(text[i] == '.' || text[i] == ':' || text[i] == '_')
if(text[i+1] != '.' && text[i+1] != ':' && text[i+1] != '_')
DotCnt++;
if (NuCnt >= 7 && DotCnt >= 3)
return true;
}
return false;
}
OnPlayerText:
pawn Код:
if(IsAdvertisement(text))
{
return Kick(playerid);
}
Re: server advertising ban bugged -
Geeboi_Mehdi - 19.04.2013
thanks but can you just try to fix mine? i already have a anti cheat for banning :X
Re: server advertising ban bugged -
Face9000 - 19.04.2013
pawn Код:
if(string[n] == '.')
{
if(count < 50)
{
pos[count] = n;
}
count++;
}
This is the problem, you're only searching for "." in the text.
Re: server advertising ban bugged -
Geeboi_Mehdi - 22.04.2013
So how can i fix it?