must be lvalue (non-constant)
#1

Hey there!

If anyone has expressed this kind of error before and knows how get their way around of it, please share the knowledge. Have never tangled with checkpoints before so I'm not quite sure what I am doing.

What i am trying to do though - easily explained is adding a name to the checkpoint so i could use it later in the OnPlayerEnterDynamicCP callback - case, for example.

Код:
        for(new h = 0; h < sizeof(HouseInfo); h++)
	{
            CHECKPOINT_HOUSE = CreateDynamicCP(HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 2, -1, -1, -1, 2);
	}
The line in bold is returning 'error 022: must be lvalue (non-constant)'

Thanks in advance!
Reply
#2

I'm presuming that CHECKPOINT_HOUSE is a definition.

It's best to remove that definition and place this above the script:

pawn Код:
static CHECKPOINT_HOUSE;
You can't change definitions upon run-time since they're all handled by the pre-processor.
Reply
#3

Thanks for that, got me one step forward.

Though, now I'm getting 'error 008: must be a constant expression; assumed zero' under the

OnPlayerEnterDynamicCP callback, under 'case: CHECKPOINT_HOUSE'. It is in switch though.

Edit: Seems like a vicious circle to me :P
Reply
#4

Case values must be known at compile time to prevent runtime errors. This is one of those cases (no pun intended) where you must resort to an old-fashioned if-if-if structure, however illogical that may seem.
Reply
#5

Gotcha, thanks both, appreciated !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)