SA-MP Forums Archive
[HELP] String errors.. - 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: [HELP] String errors.. (/showthread.php?tid=341181)



[HELP] String errors.. - Oscii - 09.05.2012

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));



Re: [HELP] String errors.. - ViniBorn - 09.05.2012

pawn Код:
new string[100];



Re: [HELP] String errors.. - Oscii - 09.05.2012

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)
    {



Re: [HELP] String errors.. - ViniBorn - 09.05.2012

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;
}



Re: [HELP] String errors.. - Oscii - 09.05.2012

Still same errors..


Re: [HELP] String errors.. - Face9000 - 09.05.2012

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.


Re: [HELP] String errors.. - Oscii - 09.05.2012

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;
}



Re: [HELP] String errors.. - ViniBorn - 09.05.2012

Post the complete public


Re: [HELP] String errors.. - Face9000 - 09.05.2012

Oscii,you tried the code i gave you?

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


Re: [HELP] String errors.. - Snipa - 09.05.2012

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..