warning 203: symbol is never used
#1

Hi,

After finishing my Anti-Weapon hack, I had a problem I get this warning:

pawn Код:
warning 203: symbol is never used: "ForbiddenWeapons"
I have already used it so I don't know why it is not working!

At the top of my script I have:

pawn Код:
new ForbiddenWeapons[][] =
{
    44,
    45,
    36,
    38,
    36,
    35,
    39,
    40
};
And under OnPlayerUpdate, I have this:

pawn Код:
new
        w = 0;

    while(w < (sizeof(ForbiddenWeapons)))
    {
        if(GetPlayerWeapon(playerid) == w)
        {
            if(pInfo[playerid][pAdmin] == 0 )
            {
                for(new i = 0; i < 50; i++) SendClientMessage(playerid, COLOR_WHITE," ");
                new str[128],
                    name[MAX_PLAYER_NAME];
                GetPlayerName(playerid,name,MAX_PLAYER_NAME);
                format(str, sizeof (str), "[AUTO - BAN] %s has been automatically banned from the server. Reason: Forbidden weapons!", name);
                SendClientMessageToAll(RED, str);
                new Dialog[952], pName[MAX_PLAYER_NAME];
                GetPlayerName(playerid, pName, sizeof(pName));

                new
                    query[315], IP[16], Name[MAX_PLAYER_NAME];
                GetPlayerIp(playerid, IP, sizeof(IP));

                GetPlayerName(playerid, Name, sizeof(Name));

                format(Dialog, sizeof(Dialog), "{FF0000}You are banned from this server! Ban details:\n\n{FF0000}Name:{FFFFFF} %s \n{FF0000}IP:{FFFFFF} %s\n{FF0000}Reason:{FFFFFF} Jetpack Hacks \n{FF0000}Banned By:{FFFFFF} Anti - Cheat\n\n{FF0000}You will never unbanned!\n\n{FF0000}If you think this ban is unfair, you can apply for an unban appeal at our forums\n{FF0000}Note - We do not unban hackers, or people who lie in their appeal", Name, IP);
                ShowPlayerDialog(playerid, DIALOG_BAN, DIALOG_STYLE_MSGBOX, "{FF0000}Banned!", Dialog, "Close", "");

                format(query,sizeof(query), "INSERT INTO bans (Name, IP, Reason, BannedBy, Date, Status) VALUES('%s', '%s', 'Forbidden weapons', 'Anti - Cheat', NOW(), '1')", GetName(playerid), IP, gettime());
                mysql_query(query);

            }
        }
    }
Can anyone please help me?
Reply
#2

This code is as wrong as can be. I only needed to examine the first four lines to see that this won't do what you expect it to do. Then there is the issue of OnPlayerUpdate. Never, ever, use loops in OnPlayerUpdate unless you seriously know what you're doing!

Your code will compile as:

pawn Код:
while(w < 8)
{
    if(GetPlayerWeapon(playerid) == w /* 0 through 7 */)
    {
Which means everyone gets banned (having weaponid 0).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)