Code implement - 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: Code implement (
/showthread.php?tid=588330)
Code implement -
Kursed - 07.09.2015
Код:
stock CheckServerAd(szInput[])
{
new
iCount,
iPeriod,
iPos,
iChar,
iColon;
while((iChar = szInput[iPos++])) {
if('0' <= iChar <= '9') iCount++;
else if(iChar == '.') iPeriod++;
else if(iChar == ':') iColon++;
}
if(iCount >= 7 && iPeriod >= 3 && iColon >= 1) {
return 1;
}
return 0;
}
Код:
stock AntiAdv(playerid, text[])
{
// Anti Adv
new strR[255], is1=0, r=0;
while(strlen(text[is1]))
{
if('0'<=text[is1]<='9')
{
new is2=is1+1, p=0;
while(p==0)
{
if('0'<=text[is2]<='9'&&strlen(text[is2]))
{
is2++;
}
else
{
strmid(strR[r],text,is1,is2,255);
if(strval(strR[r])<255) r++;
is1=is2;
p=1;
}
}
}
is1++;
}
if(r>=4)
{
new strMy[255];
format(strMy, sizeof(strMy), "AdmCmd: %s is attempting to Server Advertise: %s", GetPlayerNameEx(playerid), text);
ABroadCast(COLOR_YELLOW, strMy, 2);
new pr2;
for(new z=0;z<r;z++)
{
while((pr2=strfind(text,strR[z],true))!=-1)
{
for(new i=pr2,j=pr2+strlen(strR[z]);i<j;i++)
{
text[i]='*';
}
}
}
return 1;
}
return 0;
}
how can i use the second one but without admin warning (message does not send). 2nd one blocks ">,<" characters
Re: Code implement -
Kursed - 09.09.2015
bump
Re: Code implement -
SickAttack - 09.09.2015
https://sampforum.blast.hk/showthread.php?tid=588163
First link (anti_advert).
More info:
https://sampforum.blast.hk/showthread.php?tid=568668
anti_advert is a re-creation of anti_advert_regex in pawn. The plugin used in the thread of anti_advert_regex may cause your server to crash in some cases. And anti_advert is 3 times faster than anti_advert_regex in processing text and validating it. Consider using anti_advert instead of anti_advert_regex.
Note: Only detects valid IP Addresses.