0

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.

James Monger
  • 10,181
  • 7
  • 62
  • 98
Clove
  • 29
  • 2
  • 6

2 Answers2

1

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

Rob van der Veer
  • 1,148
  • 1
  • 7
  • 20
  • There is no boolean type in Pawn. `bool:` is a soft tag, and any non-zero value is considered true. – IS4 Nov 13 '15 at 15:58
1

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.

James Monger
  • 10,181
  • 7
  • 62
  • 98