if ( playerData[playerid][playerLevel] < Level_Here )
#1

pawn Code:
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(67) : warning 225: unreachable code
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(294) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(371) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(416) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(443) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(480) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(508) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(613) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(685) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(721) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(765) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(1000) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(1038) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(2936) : warning 225: unreachable code
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(2959) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(6964) : warning 225: unreachable code
E:\UCNR updated (Sultan)\gamemodes\CnR1.pwn(3619) : warning 219: local variable "playerFPS" shadows a variable at a preceding level
E:\UCNR updated (Sultan)\gamemodes\CnR1.pwn(3620) : warning 219: local variable "playerDrunkLevel" shadows a variable at a preceding level
E:\UCNR updated (Sultan)\gamemodes\CnR1.pwn(4157) : warning 203: symbol is never used: "playerDrunkLevel"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


13 Errors.
All of the errors are from } or return 0 / 1;

Also these errors came up when I put this line in my scripts

pawn Code:
if ( playerData[playerid][playerLevel] < Level_Here )
        return SendClientMessage(playerid, COLOR_WHITE, "{F81414}[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command." );
Reply
#2

Quote:
Originally Posted by Y_Less
View Post
What is COLOR_WHITE?
Defining color I guess? Have I used it wrong here?

Assist me friend - Do I have to add -1 instead of COLOR_WHITE?
Reply
#3

Quote:
Originally Posted by Hammad123
View Post
Defining color I guess? Have I used it wrong here?

Assist me friend - Do I have to add -1 instead of COLOR_WHITE?
Yes, it's the same and shorter
Reply
#4

pawn Code:
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(67) : warning 225: unreachable code
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(294) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(371) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(416) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(443) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(480) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(508) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(613) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(685) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(721) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(765) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(1000) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(1038) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(2936) : warning 225: unreachable code
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(2959) : error 029: invalid expression, assumed zero
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(5786) : error 017: undefined symbol "i"
E:\UCNR updated (Sultan)\pawno\include\cnr/cnr_admincommands.inc(6964) : warning 225: unreachable code
E:\UCNR updated (Sultan)\gamemodes\CnR1.pwn(3619) : warning 219: local variable "playerFPS" shadows a variable at a preceding level
E:\UCNR updated (Sultan)\gamemodes\CnR1.pwn(3620) : warning 219: local variable "playerDrunkLevel" shadows a variable at a preceding level
E:\UCNR updated (Sultan)\gamemodes\CnR1.pwn(4157) : warning 203: symbol is never used: "playerDrunkLevel"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


14 Errors.
I got these (Same errors)

even after changing COLOR_WHITE into -1
Reply
#5

I don't see anything wrong with the code you posted. (Assuming you're putting a level instead of "Level Here").

I think the problem should be searched elsewhere.

Try to post some erorr lines. (294, 371, 416, 2936).
Reply
#6

294 :
pawn Code:
COMMAND:playertokens(playerid, params[])
{
    if(playerData[playerid][playerLoggedIn])
    {
        if ( playerData[playerid][playerLevel] < 6 )
        return SendClientMessage(playerid, -1, "{F81414}[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command." );
        {
            new
                otherID,
                message[128]
            ;
           
            if(sscanf(params, "u", otherID))
            {
                SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}Usage: \"playertokens <playerid>\"");
            }
            else
            {
                if(IsPlayerConnected(otherID))
                {
                    if(playerData[otherID][playerLoggedIn])
                    {                  
                        format(message, sizeof(message), "{B7B7B7}[INFO] {FFFFFF}%s(%i) has {FFDC2E}%i {FFFFFF}tokens.", playerData[otherID][playerNamee], otherID, playerData[otherID][rTokens]);
                        SendClientMessage(playerid, COLOR_WHITE, message);
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not logged in!");
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not online!");
                }
            }
        }
        else  // line 294
        {
            return 0;
        }
    }
   
    return 1;
}
371:

pawn Code:
COMMAND:playerjob(playerid, params[])
{
    if(playerData[playerid][playerLoggedIn])
    {
    if ( playerData[playerid][playerLevel] < 3 )
        return SendClientMessage(playerid, -1, "{F81414}[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command." );
        {
            new
                otherID
            ;
           
            if(sscanf(params, "u", otherID))
            {
                SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}Usage: \"playerjob <playerid>\"");
            }
            else
            {
                if(IsPlayerConnected(otherID))
                {
                    if(playerData[otherID][playerLoggedIn])
                    {                  
                        switch(playerData[otherID][playerJob])
                        {
                            case JOB_KIDNAPPER:
                            {
                                SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[PLAYER JOB] {FFFFFF}That player is a kidnapper.");
                            }
                            case JOB_MECHANIC:
                            {
                                SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[PLAYER JOB] {FFFFFF}That player is a mechanic.");
                            }
                            case JOB_WEAPONDEALER:
                            {
                                SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[PLAYER JOB] {FFFFFF}That player is a weapon dealer.");
                            }
                            case JOB_HITMAN:
                            {
                                SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[PLAYER JOB] {FFFFFF}That player is a hitman.");
                            }
                            case JOB_RAPIST:
                            {
                                SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[PLAYER JOB] {FFFFFF}That player is a rapist.");
                            }
                            case JOB_DRUGDEALER:
                            {
                                SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[PLAYER JOB] {FFFFFF}That player is a drug dealer.");
                            }
                            case JOB_TERRORIST:
                            {
                                SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[PLAYER JOB] {FFFFFF}That player is a terrorist.");
                            }
                            default:
                            {
                                SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[PLAYER JOB] {FFFFFF}That player has no job.");
                            }
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not logged in!");
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not online!");
                }
            }
        }
        else // error 371 line
        {
            return 0;
        }
    }
   
    return 1;
}
416:
pawn Code:
COMMAND:playerjailtime(playerid, params[])
{
    if(playerData[playerid][playerLoggedIn])
    {
        if ( playerData[playerid][playerLevel] < 1 )
        return SendClientMessage(playerid, -1, "{F81414}[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command." );
        {
            new
                otherID,
                message[128]
            ;
           
            if(sscanf(params, "u", otherID))
            {
                SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}Usage: \"playerjailtime <playerid>\"");
            }
            else
            {
                if(IsPlayerConnected(otherID))
                {
                    if(playerData[otherID][playerLoggedIn])
                    {                  
                        format (message, sizeof(message), "{B7B7B7}[JAIL TIME] {FFFFFF}That player has %i seconds remaining in jail.", playerData[otherID][playerJailTime]);
                        SendClientMessage(playerid, COLOR_WHITE, message);
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not logged in!");
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not online!");
                }
            }
        }
        else // error = line 416
        {
            return 0;
        }
    }
   
    return 1;
}
error 2936:

pawn Code:
COMMAND:alog(playerid, params[])
{
    if ( playerData[playerid][playerLevel] < 2 )
        return SendClientMessage(playerid, -1, "{F81414}[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command." );
    {
        if(playerData[playerid][showALog])
        {
            TextDrawHideForPlayer(playerid, alog1);
            TextDrawHideForPlayer(playerid, alog2);
            TextDrawHideForPlayer(playerid, alog3);
            TextDrawHideForPlayer(playerid, alog4);
            TextDrawHideForPlayer(playerid, alog5);
            playerData[playerid][showALog] = false;
            SendClientMessage(playerid, COLOR_WHITE, "{FF0770}[ADMIN] {FFFFFF}You have un-toggled the administration log.");
        }
        else
        {
            TextDrawShowForPlayer(playerid, alog1);
            TextDrawShowForPlayer(playerid, alog2);
            TextDrawShowForPlayer(playerid, alog3);
            TextDrawShowForPlayer(playerid, alog4);
            TextDrawShowForPlayer(playerid, alog5);
            SendClientMessage(playerid, COLOR_WHITE, "{FF0770}[ADMIN] {FFFFFF}You have toggled the administration log.");
            playerData[playerid][showALog] = true;
        }
        return 1;
    }
    return 0; // error = line 2936
}
Help please guys
Reply
#7

Code:
COMMAND:alog(playerid, params[])
{
    if ( playerData[playerid][playerLevel] < 2 )
        return 0;

    if(playerData[playerid][showALog])
    {
        TextDrawHideForPlayer(playerid, alog1);
        TextDrawHideForPlayer(playerid, alog2);
        TextDrawHideForPlayer(playerid, alog3);
        TextDrawHideForPlayer(playerid, alog4);
        TextDrawHideForPlayer(playerid, alog5);
        playerData[playerid][showALog] = false;
        return SendClientMessage(playerid, 0xFF0770FF, "[ADMIN] {FFFFFF}You have un-toggled the administration log.");
    }
    else
    {
        TextDrawShowForPlayer(playerid, alog1);
        TextDrawShowForPlayer(playerid, alog2);
        TextDrawShowForPlayer(playerid, alog3);
        TextDrawShowForPlayer(playerid, alog4);
        TextDrawShowForPlayer(playerid, alog5);
        SendClientMessage(playerid, 0xFF0770FF, "[ADMIN] {FFFFFF}You have toggled the administration log.");
        return playerData[playerid][showALog] = true;
    }
    return 1;
}
Reply
#8

Quote:
Originally Posted by TheToretto
View Post
Code:
COMMAND:alog(playerid, params[])
{
    if ( playerData[playerid][playerLevel] < 2 )
        return 0;

    if(playerData[playerid][showALog])
    {
        TextDrawHideForPlayer(playerid, alog1);
        TextDrawHideForPlayer(playerid, alog2);
        TextDrawHideForPlayer(playerid, alog3);
        TextDrawHideForPlayer(playerid, alog4);
        TextDrawHideForPlayer(playerid, alog5);
        playerData[playerid][showALog] = false;
        return SendClientMessage(playerid, 0xFF0770FF, "[ADMIN] {FFFFFF}You have un-toggled the administration log.");
    }
    else
    {
        TextDrawShowForPlayer(playerid, alog1);
        TextDrawShowForPlayer(playerid, alog2);
        TextDrawShowForPlayer(playerid, alog3);
        TextDrawShowForPlayer(playerid, alog4);
        TextDrawShowForPlayer(playerid, alog5);
        SendClientMessage(playerid, 0xFF0770FF, "[ADMIN] {FFFFFF}You have toggled the administration log.");
        return playerData[playerid][showALog] = true;
    }
    return 1;
}
thank you, whats with the other issues though? I can't seem to fix it
Reply
#9

Quote:
Originally Posted by Y_Less
View Post
You have code after "if" AND then braces. The braces should be attached directly to the if.
Do you mean
pawn Code:
if(playerData[playerid][playerLevel] < Level_Here )
instead of this:
pawn Code:
if ( playerData[playerid][playerLevel] < Level_Here )
?
Reply
#10

Code:
if(playerData[playerid][playerLevel] < 5) // 5 being an admin level
If level is < (BELOW) 5
Reply
#11

Quote:
Originally Posted by Swarn
View Post
Code:
if(playerData[playerid][playerLevel] < 5) // 5 being an admin level
If level is < (BELOW) 5
I want it to be like; If I type a command and don't have the level to use it, it sends client message with the text I have placed in the script
Reply
#12

Code:
if(playerData[playerid][playerLevel] < 5) return SendClientMessage(playerid, -1, "Your player level is not high enough");
Reply
#13

Quote:
Originally Posted by Swarn
View Post
Code:
if(playerData[playerid][playerLevel] < 5) return SendClientMessage(playerid, -1, "Your player level is not high enough");
ain't working
Reply
#14

Quote:
Originally Posted by Hammad123
View Post
Do you mean
pawn Code:
if(playerData[playerid][playerLevel] < Level_Here )
instead of this:
pawn Code:
if ( playerData[playerid][playerLevel] < Level_Here )
?
No, he's referring to
pawn Code:
if ( playerData[playerid][playerLevel] < 6 )
        return SendClientMessage(playerid, -1, "{F81414}[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command." );
        {
Which should be
pawn Code:
if ( playerData[playerid][playerLevel] < 6 )
{
        return SendClientMessage(playerid, -1, "{F81414}[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command." );
}
Or just the following, which I prefer.
pawn Code:
if ( playerData[playerid][playerLevel] < 6 ) return SendClientMessage(playerid, -1, "{F81414}[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command." );

Following, this is how I would simplify the command.

pawn Code:
COMMAND:playertokens(playerid, params[])
{
    if(!playerData[playerid][playerLoggedIn]) return 1; //assume this could be removed since player would not have playerLevel if not logged in?
    if(playerData[playerid][playerLevel] < 6) return SendClientMessage(playerid, -1, "{F81414}[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command." );
   
    new otherID;
    if(!sscanf(params, "u", otherID)) return SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}Usage: \"playertokens <playerid>\"");
    if(!IsPlayerConnected(otherID)) return SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not online!");
    if(!playerData[otherID][playerLoggedIn]) return SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not logged in!");  

    new message[128];          
    format(message, sizeof(message), "{B7B7B7}[INFO] {FFFFFF}%s(%i) has {FFDC2E}%i {FFFFFF}tokens.", playerData[otherID][playerNamee], otherID, playerData[otherID][rTokens]);
    SendClientMessage(playerid, COLOR_WHITE, message);
    return 1;
}
Reply
#15

Or to be more precise, if you wish to restrict a CMD just to who has a specific level, use:

!=

pawn Code:
if(playerData[playerid][playerLevel] != 5)
return SendClientMessage(playerid, -1, "{F81414}[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command." );
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)