Help this error
#1

I got this error everytime i compiled.. please help

error code :
Код:
C:\Users\GW\Desktop\Test\myscript.pwn(6613) : error 003: declaration of a local variable must appear in a compound block
C:\Users\GW\Desktop\Test\myscript.pwn(6619) : error 021: symbol already defined: "GetPlayerName"
C:\Users\GW\Desktop\Test\myscript.pwn(6621) : error 010: invalid function or declaration
C:\Users\GW\Desktop\Test\myscript.pwn(6637) : error 021: symbol already defined: "KickMessage"
C:\Users\GW\Desktop\Test\myscript.pwn(6646) : error 010: invalid function or declaration
C:\Users\GW\Desktop\Test\myscript.pwn(6648) : error 010: invalid function or declaration
C:\Users\GW\Desktop\Test\myscript.pwn(6651) : error 010: invalid function or declaration
C:\Users\GW\Desktop\Test\myscript.pwn(6652) : error 010: invalid function or declaration
C:\Users\GW\Desktop\Test\myscript.pwn(6654) : error 021: symbol already defined: "dini_Set"
C:\Users\GW\Desktop\Test\myscript.pwn(6655) : error 010: invalid function or declaration
C:\Users\GW\Desktop\Test\myscript.pwn(6659) : error 010: invalid function or declaration
C:\Users\GW\Desktop\Test\myscript.pwn(6661) : error 010: invalid function or declaration
C:\Users\GW\Desktop\Test\myscript.pwn(6664) : error 010: invalid function or declaration
C:\Users\GW\Desktop\Test\myscript.pwn(6665) : error 010: invalid function or declaration
C:\Users\GW\Desktop\Test\myscript.pwn(6667) : error 021: symbol already defined: "dini_Set"
C:\Users\GW\Desktop\Test\myscript.pwn(6668) : error 010: invalid function or declaration
C:\Users\GW\Desktop\Test\myscript.pwn(6672) : error 010: invalid function or declaration
C:\Users\GW\Desktop\Test\myscript.pwn(6674) : error 010: invalid function or declaration
C:\Users\GW\Desktop\Test\myscript.pwn(6677) : error 010: invalid function or declaration
C:\Users\GW\Desktop\Test\myscript.pwn(6678) : error 010: invalid function or declaration
C:\Users\GW\Desktop\Test\myscript.pwn(6680) : error 021: symbol already defined: "dini_Set"
C:\Users\GW\Desktop\Test\myscript.pwn(6681) : error 010: invalid function or declaration
C:\Users\GW\Desktop\Test\myscript.pwn(6685) : error 010: invalid function or declaration
C:\Users\GW\Desktop\Test\myscript.pwn(6687) : error 010: invalid function or declaration
C:\Users\GW\Desktop\Test\myscript.pwn(6690) : error 010: invalid function or declaration
Pawn error

pawn Код:
new playername[24], FactionFileAndOkay[50];
    GetPlayerName(playerid, playername, sizeof(playername));
   
   
   
   
    GetPlayerName(playerid, aname, sizeof(aname));

    if((strfind(aname, "1") != -1 || strfind(aname, "2") != -1 || strfind(aname, "3") != -1 || strfind(aname, "4") != -1
    || strfind(aname, "5") != -1 || strfind(aname, "6") != -1 || strfind(aname, "7") != -1 || strfind(aname, "8") != -1
    || strfind(aname, "9") != -1 || strfind(aname, "0") != -1 || strfind(aname, "_") == -1 || strfind(aname, "!") != -1
    || strfind(aname, "@") != -1 || strfind(aname, "#") != -1 || strfind(aname, "$") != -1 || strfind(aname, "%") != -1
    || strfind(aname, "^") != -1 || strfind(aname, "&") != -1 || strfind(aname, "*") != -1 || strfind(aname, "(") != -1
    || strfind(aname, ")") != -1 || strfind(aname, "-") != -1 || strfind(aname, "=") != -1 || strfind(aname, "+") != -1
    || strfind(aname, "`") != -1 || strfind(aname, "~") != -1 || strfind(aname, "'") != -1 || strfind(aname, ";") != -1
    || strfind(aname, "/") != -1 || strfind(aname, ",") != -1 || strfind(aname, ".") != -1 || strfind(aname, "?") != -1
    || strfind(aname, "{") != -1 || strfind(aname, "}") != -1 || strfind(aname, "[") != -1 || strfind(aname, "]") != -1
    || strfind(aname, ":") != -1 || strfind(aname, "<") != -1 || strfind(aname, ">") != -1) && Kicked[playerid] == false)
    {
        SendClientMessage(playerid, COLOR_INFO, "(Info): This server requiers you to have a roleplay (realistic) name.");
        SendClientMessage(playerid, COLOR_INFO, "(Info): Therefore you will be kicked from the server until you login with one.");
        SendClientMessage(playerid, COLOR_INFO, "(Info): A roleplay name should be a name without numbers, and should have an underline in it.");
        SendClientMessage(playerid, COLOR_INFO, "(Info): An example of a roleplay name is: John_Washington, try a name using the following format.");
        SendClientMessage(playerid, COLOR_INFO, "(Info): The roleplay name format should be: firstname_lastname, good luck logging in next time!");
        KickMessage(playerid, "[ADMIN] You have been kicked from the server due to not having a roleplay name.");
        Kicked[playerid] = true;
    }
   
   
   
   
   
   
    if(dUserINT(playername).("playerteam") == 1)
    {
        for(new i = 0; i < 150; i++)
        {
            format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
            if(strcmp(dini_Get("Corleone.ini", FactionFileAndOkay), playername) == 0) break;
            if(strcmp(dini_Get("Corleone.ini", FactionFileAndOkay), "None") == 0)
            {
                dini_Set("Corleone.ini", FactionFileAndOkay, playername);
                break;
            }
        }
    }
    else if(dUserINT(playername).("playerteam") == 2)
    {
        for(new i = 0; i < 150; i++)
        {
            format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
            if(strcmp(dini_Get("Tattaglia.ini", FactionFileAndOkay), playername) == 0) break;
            if(strcmp(dini_Get("Tattaglia.ini", FactionFileAndOkay), "None") == 0)
            {
                dini_Set("Tattaglia.ini", FactionFileAndOkay, playername);
                break;
            }
        }
    }
    else if(dUserINT(playername).("playerteam") == 3)
    {
        for(new i = 0; i < 150; i++)
        {
            format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
            if(strcmp(dini_Get("Stracci.ini", FactionFileAndOkay), playername) == 0) break;
            if(strcmp(dini_Get("Stracci.ini", FactionFileAndOkay), "None") == 0)
            {
                dini_Set("Stracci.ini", FactionFileAndOkay, playername);
                break;
            }
        }
    }
    else if(dUserINT(playername).("playerteam") == 4)
    {
        for(new i = 0; i < 150; i++)
        {
            format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
            if(strcmp(playername, dini_Get("Cuneo.ini", FactionFileAndOkay)) == 0) break;
Reply
#2

anyone?
Reply
#3

This is one nasty way to check if name is valid roleplay name. What if I use \r in my name? Whitelists are almost always better than blacklists when speaking about security.

Quote:

declaration of a local variable must appear in a compound block

Your code is outside of any callback it seems.
Reply
#4

You could use this code instead

Код:
new name[MAX_PLAYER_NAME], pos = -1;

GetPlayerName(playerid, name, sizeof name);

while (name[++pos] != '\0')
{
    if ((name[pos] < 'a' || name[pos] > 'a' + 25) && (name[pos] < 'A' || name[pos] > 'A' + 25) && name[pos] != 95)	         
    {
        SendClientMessage(playerid, 0xFFFFFF00, "...");
        ...
        Kick(playerid);
	break;
    }
}
The part 'A' + 25 covers all capital letters, 'a' + 25 covers all small letters and name[pos] != 95 covers the underscore. Anything which does not match those three conditions will kick the player.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)