SA-MP Forums Archive
error 008: must be a constant expression; assumed zero - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: error 008: must be a constant expression; assumed zero (/showthread.php?tid=225930)



error 008: must be a constant expression; assumed zero - ajwar - 14.02.2011

pawn Код:
enum checkpointsdata
{
carcp,

}
new checkpoints[checkpointsdata];
pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{

    switch(checkpointid)
    {
        case checkpoints[carcp]: // this line makes the error!
        {
           
            return 1;
        }
    }
    return 1;

}
How to fix this error?


Re: error 008: must be a constant expression; assumed zero - HyperZ - 14.02.2011

Try this:
pawn Код:
switch(checkpointid)
{
    case 0:
    {
        random(sizeof(checkpoints[carcp]));
        return 1;
    }
}
Edit: not tested.


Re: error 008: must be a constant expression; assumed zero - ajwar - 14.02.2011

Not working. Any other idea's?