Anti-Advertise Help+Rep
#1

ok so a friend gave me an anti.advertise..

PHP код:
Error This Line  if(strfind(text":7777"true) != -1)
    {
        
GetPlayerName(playeridsendername24);
        
format(string256"AdmCmd: %s was kicked, reason: Server Advertise"sendername);
        
SendClientMessageToAll(COLOR_LIGHTREDstring);
        
KickLog(string);
        
Kick(giveplayerid);
        return 
0;
    }
(
26884) : error 017undefined symbol "text" 
Reply
#2

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 iport and hostort format
but the script you have will stop any normal setup.


HTH's
Reply
#3

Код:
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
Reply
#4

what does it mean if its 0 and not 1??

PlayerInfo[playerid][pHackTog] = 0; Here 0,is it on or off?
Reply
#5

well it would depend on your code
but general coding practice is 0= false and 1 = true
Reply
#6

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?
Reply
#7

ah i got a problem forgot to 2 that their 2 problems..
each time when i enter my server it says

PHP код:
DOCYour Medical Bill comes to $%dHave 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] == && PlayerInfo[playerid][pJailed] == && PlayerPaintballing[playerid] == 0)
        {
            new 
string[256];
            new 
cut deathcost//PlayerInfo[playerid][pLevel]*deathcost;
            
GivePlayerCash(playerid, -cut);
            
format(stringsizeof(string), "DOC: Your Medical Bill comes to $%d, Have a nice day."cut);
            
SendClientMessage(playeridTEAM_CYAN_COLORstring);
            
MedicBill[playerid] = 0;
            
MedicTime[playerid] = 0;
            
NeedMedicTime[playerid] = 0;
            
PlayerInfo[playerid][pDeaths] += 1;
            
SetPlayerHealth(playerid100.0); 
the first post Madd Kat Rep (first one who helped me got rep!)
Reply
#8

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);
Reply
#9

which one do i comment it out?? all of it??
Reply
#10

Quote:
Originally Posted by iPLEOMAX
Посмотреть сообщение
Edited:

pawn Код:
// CODE
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)