undefined symbol "playerid" -
AlfaSufaIndo - 01.07.2018
I have created an enum containing CMD permission. but why I get an error?
Whereas above enum that contains CMD permission there is enum pInfo. Can you guys help me?
Код:
undefined symbol "playerid"
PHP код:
enum (<<= 1)
{
CMD_OWNER = PlayerInfo[playerid][pAdmin] == 999999,
CMD_PATRIOT = PlayerInfo[playerid][pAdmin] == 69,
CMD_DEVELOPER = PlayerInfo[playerid][pAdmin] == 12,
CMD_HEADA = PlayerInfo[playerid][pAdmin] == 11,
CMD_ADMIN = PlayerInfo[playerid][pAdmin] == 4,
CMD_JADMIN = PlayerInfo[playerid][pAdmin] == 3,
CMD_MOD = PlayerInfo[playerid][pAdmin] == 2,
CMD_JMOD = PlayerInfo[playerid][pAdmin] == 1,
CMD_MAPPER = PlayerInfo[playerid][pMapper] == 1,
CMD_FMOD = PlayerInfo[playerid][pFMOD] == 1,
CMD_GMOD = PlayerInfo[playerid][pGMOD] == 1,
CMD_SEC = PlayerInfo[playerid][pSecurity] == 1
}
new cmdPerm[MAX_PLAYERS];
Re: undefined symbol "playerid" -
JasonRiggs - 01.07.2018
Try changing "playerid" to "MAX_PLAYERS" while I don't even support doing it like that..
Re: undefined symbol "playerid" -
AlfaSufaIndo - 01.07.2018
Quote:
Originally Posted by JasonRiggs
Try changing "playerid" to "MAX_PLAYERS" while I don't even support doing it like that..
|
I've try it, but i got another error.. like this
Код:
must be a constant expression; assumed zero
Re: undefined symbol "playerid" -
AlfaSufaIndo - 01.07.2018
Or, should I create a variable? like this?
PHP код:
new CMD_OWNER = PlayerInfo[MAX_PLAYERS][pAdmin] == 999999,
CMD_PATRIOT = PlayerInfo[MAX_PLAYERS][pAdmin] == 69,
CMD_DEVELOPER = PlayerInfo[MAX_PLAYERS][pAdmin] == 12,
CMD_HEADA = PlayerInfo[MAX_PLAYERS][pAdmin] == 11,
CMD_ADMIN = PlayerInfo[MAX_PLAYERS][pAdmin] == 4,
CMD_JADMIN = PlayerInfo[MAX_PLAYERS][pAdmin] == 3,
CMD_MOD = PlayerInfo[MAX_PLAYERS][pAdmin] == 2,
CMD_JMOD = PlayerInfo[MAX_PLAYERS][pAdmin] == 1,
CMD_MAPPER = PlayerInfo[MAX_PLAYERS][pMapper] == 1,
CMD_FMOD = PlayerInfo[MAX_PLAYERS][pFMOD] == 1,
CMD_GMOD = PlayerInfo[MAX_PLAYERS][pGMOD] == 1,
CMD_SEC = PlayerInfo[MAX_PLAYERS][pSecurity] == 1;
I'm really confused XD
Re: undefined symbol "playerid" -
JasonRiggs - 01.07.2018
You could create enums normally..
PHP код:
enum (<<=1)
{
CMD_OWNER,
CMD_PATRIOT, etc..
}
And save them after as you wish.. depends on what you're trying to do
Re: undefined symbol "playerid" -
AlfaSufaIndo - 01.07.2018
Quote:
Originally Posted by JasonRiggs
You could create enums normally..
PHP код:
enum (<<=1)
{
CMD_OWNER,
CMD_PATRIOT, etc..
}
And save them after as you wish.. depends on what you're trying to do
|
Ohh!! okay okayy i got it!
Re: undefined symbol "playerid" -
CaptainBoi - 01.07.2018
you cannot use playerid or max_players in a enum
enum goes simply
PHP код:
enum
{
pCash,
pVIP
}
Re: undefined symbol "playerid" -
TadePoleMG - 01.07.2018
You have to create enums normally...
PHP код:
enum blabla
{
CMD_OWNER,
CMD_PATRIOT//, etc..
}
Then use variable
like
PHP код:
new PlayerInfo[MAX_PLAYERS][blabla];
And error of undefined playerid is occurs when you doing this in OnGameModeInit or where they playerid is not defined in Callback then use for statement. Like
PHP код:
// OnGameModeInit()
for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
{
// Your statements here...
}
Re: undefined symbol "playerid" -
Zeth - 01.07.2018
You might be using it in Pawn.CMD.
use it like this
PHP код:
enum (<<= 1)
{
CMD_OWNER
};
flags:test(CMD_OWNER);
CMD:test(playerid, params[])
{
//do anything
return 1;
}
public OnPlayerCommandReceived(playerid, cmd[], params[], flags)
{
if((flags & CMD_OWNER) && PlayerInfo[playerid][pAdmin] < 999999)
{
return 0;
}
return 1;
}
Re: undefined symbol "playerid" -
xMoBi - 01.07.2018
Quote:
Originally Posted by Zeth
You might be using it in Pawn.CMD.
use it like this
|
At least explain him what he did wrong instead of just throwing up some code.
This means that you're not aware yourself of what the code is supposed to do.
Also, shouldn't it be
?
Just a suggestion! Deep apologies if offended.
Quote:
Originally Posted by AlfaSufaIndo
I have created an enum containing CMD permission. but why I get an error?
Whereas above enum that contains CMD permission there is enum pInfo. Can you guys help me?
Код:
undefined symbol "playerid"
PHP код:
enum (<<= 1)
{
CMD_OWNER = PlayerInfo[playerid][pAdmin] == 999999,
CMD_PATRIOT = PlayerInfo[playerid][pAdmin] == 69,
CMD_DEVELOPER = PlayerInfo[playerid][pAdmin] == 12,
CMD_HEADA = PlayerInfo[playerid][pAdmin] == 11,
CMD_ADMIN = PlayerInfo[playerid][pAdmin] == 4,
CMD_JADMIN = PlayerInfo[playerid][pAdmin] == 3,
CMD_MOD = PlayerInfo[playerid][pAdmin] == 2,
CMD_JMOD = PlayerInfo[playerid][pAdmin] == 1,
CMD_MAPPER = PlayerInfo[playerid][pMapper] == 1,
CMD_FMOD = PlayerInfo[playerid][pFMOD] == 1,
CMD_GMOD = PlayerInfo[playerid][pGMOD] == 1,
CMD_SEC = PlayerInfo[playerid][pSecurity] == 1
}
new cmdPerm[MAX_PLAYERS];
|
Zeth's code is correct, however, you can't do such operations in your code because "<<=" related operations are for bit flag/ masking, which makes your code incorrect.
You might be interested to read more here:
http://www.learncpp.com/cpp-tutorial...and-bit-masks/
Thanks.