سؤال

I'm getting the following error whenever I compile my code: "Error 029: Invalid expression, assumed zero"

The error is thrown on the following line:

if ((PlayerInfo[playerid][ADMINLevel])) || (IsPlayerAdmin(playerid))

I want the if-statement to check if "ADMINLevel" is above zero or if the player is logged in as an RCON admin.

هل كانت مفيدة؟

المحلول

You're constructing your if-statement wrong. The correct way to do it is

if(PlayerInfo[playerid][ADMINLevel] > 0 || IsPlayerAdmin(playerid))
{
    /* Put your desired script here */
}

Your code was nearly correct (although it did have some unnecessary brackets), you just need to actually add a comparison to the ADMINLevel check. An if-statement should be like a question ("is admin level more than 0", rather than just "is admin level"). You can find more information about if-statements in Pawn here, and I think it will be useful for you to read.

نصائح أخرى

PlayerInfo[..][..] does not return a boolean. Add > 0 to fix it

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top