Anti-Advertise Help+Rep -
Dan_Barocu - 19.02.2012
ok so a friend gave me an anti.advertise..
PHP код:
Error This Line if(strfind(text, ":7777", true) != -1)
{
GetPlayerName(playerid, sendername, 24);
format(string, 256, "AdmCmd: %s was kicked, reason: Server Advertise", sendername);
SendClientMessageToAll(COLOR_LIGHTRED, string);
KickLog(string);
Kick(giveplayerid);
return 0;
}
(26884) : error 017: undefined symbol "text"
Re: Anti-Advertise Help+Rep -
Madd Kat - 19.02.2012
is this in your OnPlayerCommandText callback
if so change text to cmdtext
edit:
also this will just stop the ones using port 7777
some people use 77777 or the likes
what you need is a function that checks for an ip
ort and host
ort format
but the script you have will stop any normal setup.
HTH's
Re: Anti-Advertise Help+Rep -
Sufyan - 19.02.2012
Код:
Under OnPlayerText
if(stringContainsIP(text))
{
new
string[128]
;
GetPlayerName(playerid, string, 20);
format(string, sizeof(string), "[!] \"%s\" named player has been banned from the server! [Reason: IP advertisements]", string);
SendClientMessageToAll(0xFFFFFFFF, string);
return Ban(playerid), false;
}
//anywhere
stock stringContainsIP(string[])
{
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);
}
this func by Ryder` :D
try this
Re: Anti-Advertise Help+Rep -
Dan_Barocu - 19.02.2012
what does it mean if its 0 and not 1??
PlayerInfo[playerid][pHackTog] = 0; Here 0,is it on or off?
Re: Anti-Advertise Help+Rep -
Madd Kat - 19.02.2012
well it would depend on your code
but general coding practice is 0= false and 1 = true
Re: Anti-Advertise Help+Rep -
iPLEOMAX - 19.02.2012
Edited:
pawn Код:
public OnPlayerText(playerid, text[])
{
if(stringContainsIP(text))
{
new sendername[MAX_PLAYER_NAME], string[128];
// ^ Remove this line if sendername & string is already defined.
GetPlayerName(playerid, sendername, 24);
format(string, sizeof string, "AdmCmd: %s was kicked, reason: Server Advertise", sendername);
SendClientMessageToAll(COLOR_LIGHTRED, string);
KickLog(string);
Kick(playerid);
return 0;
}
//Other stuff..
return 1;
}
stock stringContainsIP(const szStr[])
{
new
iDots,
i
;
while(szStr[i] != EOS)
{
if('0' <= szStr[i] <= '9')
{
do
{
if(szStr[i] == '.')
iDots++;
i++;
}
while(('0' <= szStr[i] <= '9') || szStr[i] == '.' || szStr[i] == ':');
}
if(iDots > 2)
return 1;
else
iDots = 0;
i++;
}
return 0;
}
Easy to read?
Re: Anti-Advertise Help+Rep -
Dan_Barocu - 19.02.2012
ah i got a problem forgot to 2 that their 2 problems..
each time when i enter my server it says
PHP код:
DOC: Your Medical Bill comes to $%d, Have a nice day.
Well i dont want that every time i enter my server its says DOC:Your medical Bill.. bla bla please help i dont want that..
if(MedicBill[playerid] == 1 && PlayerInfo[playerid][pJailed] == 0 && PlayerPaintballing[playerid] == 0)
{
new string[256];
new cut = deathcost; //PlayerInfo[playerid][pLevel]*deathcost;
GivePlayerCash(playerid, -cut);
format(string, sizeof(string), "DOC: Your Medical Bill comes to $%d, Have a nice day.", cut);
SendClientMessage(playerid, TEAM_CYAN_COLOR, string);
MedicBill[playerid] = 0;
MedicTime[playerid] = 0;
NeedMedicTime[playerid] = 0;
PlayerInfo[playerid][pDeaths] += 1;
SetPlayerHealth(playerid, 100.0);
the first post Madd Kat Rep (first one who helped me got rep!)
Re: Anti-Advertise Help+Rep -
Madd Kat - 19.02.2012
just comment it out using //
pawn Код:
//new string[256];
new cut = deathcost; //PlayerInfo[playerid][pLevel]*deathcost;
GivePlayerCash(playerid, -cut);
// format(string, sizeof(string), "DOC: Your Medical Bill comes to $%d, Have a nice day.", cut);
// SendClientMessage(playerid, TEAM_CYAN_COLOR, string);
Re: Anti-Advertise Help+Rep -
Dan_Barocu - 19.02.2012
which one do i comment it out?? all of it??
Re: Anti-Advertise Help+Rep -
RyDeR` - 19.02.2012
Quote:
Originally Posted by iPLEOMAX
|
Just took a quick look again and actually realized that it contains some bugs. Here's a better version:
http://forum.sa-mp.com/showthread.ph...698#post780698