SA-MP Forums Archive
Case needs to be const - 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: Case needs to be const (/showthread.php?tid=82618)



Case needs to be const - potato - 19.06.2009

Hi!
I have this:
Код:
	switch(objectid) {
	case GateObject[0]: {
	if(GateOpened[0] == true) {
	MoveObject(GateObject[0], -48.768456, 27.114319, 1.604109, 3.5);
	GateOpened[0] = false;
	}
	}
       }
An error pop up saying that must be a constant expression; assumed zero
Is it possible to get here a constant value, if the objectid of GateObject[0] is gotten in OnGamemodeInit?


Re: Case needs to be const - dice7 - 19.06.2009

Try using the array value for cases


Re: Case needs to be const - jonesy - 19.06.2009

pawn Код:
switch(GateObject) {
      case 0: {
        if(GateOpened[0] == true) {
          MoveObject(GateObject[0], -48.768456, 27.114319, 1.604109, 3.5);
          GateOpened[0] = false;
        }
      }
    }



Re: Case needs to be const - potato - 19.06.2009

Код:
	switch(GateObject) {
	case 0: {
	if(GateOpened[0] == true) {
	MoveObject(GateObject[0], -48.768456, 27.114319, 1.604109, 3.5);
	GateOpened[0] = false;
	}
	}
       }
It gives still an error: error 033: array must be indexed (variable "-unknown-")
How can I index an array?