[HELP] String errors..
#1

pawn Код:
if(strfind(cmdtext, "|", true) != -1)
    {
        SendClientMessageEx(playerid, COLOR_RED, "You cannot use the '|' character in commands.");
        return 0;
    }
   
        if(strfind(cmdtext, "duffelswithbags", true) != -1)
        format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /duffelswithbags... <-- dumbass", GetPlayerNameEx(playerid));
        ABroadCast(COLOR_YELLOW,string,1);
 {
    PlayerInfo[playerid][pBanned] = 1;
    new ip[32];
    GetPlayerIp(playerid,ip,sizeof(ip));
    AddBan(ip);
    Kick(playerid);
                return 1;
        return 0;
    }
I dont know whats wrong with this.. but it gives me the following errors.

error 017: undefined symbol "string"
error 017: undefined symbol "string"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

All Errors are on this line:

format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /duffelswithbags... <-- dumbass", GetPlayerNameEx(playerid));
Reply
#2

pawn Код:
new string[100];
Reply
#3

Hello, Thank you! this has fixed my errors.. but now i have these warnings

warning 225: unreachable code
warning 225: unreachable code

on the lines

pawn Код:
First WARNING-      return 0;
    }

SECOND WARNING -    if(PlayerInfo[playerid][pAdmin] < 1)
    {
Reply
#4

pawn Код:
if(strfind(cmdtext, "|", true) != -1)
{
    SendClientMessageEx(playerid, COLOR_RED, "You cannot use the '|' character in commands.");
    return 0;
}

if(strfind(cmdtext, "duffelswithbags", true) != -1)
{
    format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /duffelswithbags... <-- dumbass", GetPlayerNameEx(playerid));
    ABroadCast(COLOR_YELLOW,string,1);
    PlayerInfo[playerid][pBanned] = 1;
    new ip[32];
    GetPlayerIp(playerid,ip,sizeof(ip));
    AddBan(ip);
    Kick(playerid);
    return 0;
}
Reply
#5

Still same errors..
Reply
#6

Why u're using -1 to:

pawn Код:
ABroadCast(COLOR_YELLOW,string,1);
-1 means color white,you've already defined the color. (COLOR_YELLOW).

pawn Код:
if(strfind(cmdtext, "|", true) != -1)
{
    SendClientMessage(playerid, COLOR_RED, "You cannot use the '|' character in commands.");
    return 0;
}

if(strfind(cmdtext, "duffelswithbags", true) != -1)
{
    new string[128];
    format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /duffelswithbags... <-- dumbass", GetPlayerNameEx(playerid));
    ABroadCast(COLOR_YELLOW,string);
    PlayerInfo[playerid][pBanned] = 1;
    new ip[32];
    GetPlayerIp(playerid,ip,sizeof(ip));
    AddBan(ip);
    Kick(playerid);
    return 1;
}
And...you don't need to use SendClientMessageEx,just use the normal SendClientMessage.
Reply
#7

Whole Code thing with additions like string[100]

pawn Код:
if(strfind(cmdtext, "|", true) != -1)
    {
        SendClientMessageEx(playerid, COLOR_RED, "You cannot use the '|' character in commands.");
        return 0;
    }
        new string[100];
        if(strfind(cmdtext, "duffelswithbags", true) != -1)
        format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /duffelswithbags... <-- dumbass", GetPlayerNameEx(playerid));
        ABroadCast(COLOR_YELLOW,string,2);
 {
    PlayerInfo[playerid][pBanned] = 1;
    new ip[32];
    GetPlayerIp(playerid,ip,sizeof(ip));
    AddBan(ip);
    Kick(playerid);
                return 1;
        return 1;
    }

    if(PlayerInfo[playerid][pAdmin] < 1)
    {
        if(strfind(cmdtext, ":", true) != -1)
        {

            new
                i_numcount,
                i_period,
                i_pos;

            while(cmdtext[i_pos]) {
                if('0' <= cmdtext[i_pos] <= '9') i_numcount++;
                else if(cmdtext[i_pos] == '.') i_period++;
                i_pos++;
            }
            if(i_numcount >= 8 && i_period >= 5) {
                new string[128];
                format(string,sizeof(string),"Warning: %s may be server advertising: '%s'.", GetPlayerNameEx(playerid),cmdtext);
                SendAdminMessage(COLOR_RED, string);
                return 0;
            }
        }
    }
    return 1;
}
Reply
#8

Post the complete public
Reply
#9

Oscii,you tried the code i gave you?

P.S No offence but,your code looks heavly bad organized.
Reply
#10

Quote:
Originally Posted by Logitech90
Посмотреть сообщение
Oscii,you tried the code i gave you?

P.S No offence but,your code looks heavly bad organized.
Probably not even his..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)