stringContainsIP
#1

While searching around the forums for Anti-AD i found Ryder's Code (Anti-AD)
it all works fine.

but when i'm going to type the reaction contest it returns

Код:
Romel: 770821
instead of

Код:
Romel (0): 77021
When i remove the Server-AD on OnPlayerText all works fine.
i want to avoid this how to do it?

pawn Код:
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;
}
Reply
#2

its small bug i can fix it but first i need reaptuion to fix it
Reply
#3

i will not give a reputation just to help me i will wait for someone to reply instead of repping some noobs
Reply
#4

Up Up
Reply
#5

here is my OnPlayerText

pawn Код:
public OnPlayerText(playerid, text[])
{
    new str[128];
    if(dini_Int(DataPath(playerid), "Ban") == 1 && CheckBan(IP))
    {
        SendClientMessage(playerid, COLOR_RED, "*** You cannot use chat you are banned! ***");
        return 0;
    }
    if(pData[playerid][Mute] == 1)
    {
        SendClientMessage(playerid, COLOR_RED, "*** You are mute you cannot talk! ***");
        return 0;
    }
    if(CapsLock(text))
    {
        SendClientMessage(playerid, COLOR_RED, "*** Disable your caps lock, because it annoys a player! ***");
        return 0;
    }
    if(stringContainsIP(text))
    {
        format(str, sizeof(str), "%s(%d) has been kick for Server Advertising", GetpName(playerid), playerid);
        SendClientMessageToAll(COLOR_RED, str);
        SendClientMessage(playerid, COLOR_RED, "*** You have been kicked for Server Advertising ***");
        Kick(playerid);
        return 0;
    }
    for(new i=0; i<MAX_ENTRY; i++)
    {
        if(!Swear[i][0]) continue;
        Cenzura(text, Swear[i]);
    }
    if(text[0] == '!' && strfind(GetpName(playerid), "[iP]", false) != -1)
    {
        format(str, sizeof(str), "[iP] Clan Chat: %s: "white"%s", GetpName(playerid), text[1]);
        SendMessageToiPMember(COLOR_LIGHTGREEN, str);
        return 0;
    }
    else if(text[0] == '@' && pData[playerid][Admin] > 1)
    {
        format(str, sizeof(str), "Admin Chat: %s: "white"%s", GetpName(playerid), text[1]);
        SendMessageToAdmins(COLOR_RED, str);
        return 0;
    }
    else if(text[0] == '#' && pData[playerid][VIP] > 1)
    {
        format(str, sizeof(str), "VIP Chat: %s: "white"%s", GetpName(playerid), text[1]);
        SendMessageToVIP(COLOR_YELLOW, str);
        return 0;
    }
    if(strval(text) == ContestAnswer && ContestAnswer != -1)
    {
        new string[128];
        KillTimer(ContestTimer);
        format(string,sizeof string,"CONTEST: %s(%d) has won the reaction-contest", GetpName(playerid), playerid);
        SendClientMessageToAll(0x00FFFFFF,string);
        GivePlayerMoney(playerid,CONTEST_PRIZE);
        SetPlayerScore(playerid, GetPlayerScore(playerid) + CONTEST_PRIZE2);
        ContestAnswer = -1;
        return 0;
    }
        if(strfind(GetpName(playerid), "Annoymous[iP]", false) != -1)
    {
        format(str, sizeof(str), "[iP] Co-Owner: %s"white" (%d) %s", GetpName(playerid), playerid, text);
        SendClientMessageToAll(COLOR_ORANGE, str);
        IRC_GroupSay(gGroupID, IRC_Channel, str);
        return 0;
    }
    else if(strfind(GetpName(playerid), "[iP]", false) != -1)
    {
        format(str, sizeof(str), "[iP] Member: %s"white" (%d) %s", GetpName(playerid), playerid, text);
        SendClientMessageToAll(COLOR_LIGHTBLUE, str);
        IRC_GroupSay(gGroupID, IRC_Channel, str);
        return 0;
    }
    format(str, sizeof(str), "%s (%d): "white"%s", GetpName(playerid), playerid, text);
    SendClientMessageToAll(GetPlayerColor(playerid), str);
    IRC_GroupSay(gGroupID, IRC_Channel, str);
    format(str, MAX_CHATBUBBLE_LENGTH, "%s", text);
    SetPlayerChatBubble(playerid, str, COLOR_YELLOW, 13.0, 10000);
    return 0;
}
Reply
#6

I will let ****** reply to fix the problem Romel.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)