must be a constant expression; assumed zero
#1

Hi, I've bumped into this error:
Code:
must be a constant expression; assumed zero
On the marked lines:
Code:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
	switch (pickupid)
	{
		case PlayerInfo[playerid][pPickup][0]:
		{
			if (PlayerInfo[playerid][pInAirport])
			{
				DestroyDynamicPickup(PlayerInfo[playerid][pPickup][0]);
				DestroyDynamicObject(PlayerInfo[playerid][pBaggageObject]);
				
				SetPlayerAttachedObject(playerid, 0, 11745, 6, 0.216000, 0.035000, 0.017999, -83.600013, -94.400039, -6.899996, 0.632999, 1.093000, 1.214999);
				PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have collected your baggage, please proceed to the exit (white arrows).");

				PlayerInfo[playerid][pPickup][1] = CreateDynamicPickup(1318, 23, 1727.2003, -2368.4248, -73.3924, AIRPORT_WORLD, 0, playerid);
				PlayerInfo[playerid][pPickup][2] = CreateDynamicPickup(1318, 23, 1719.7932,-2368.6470,-73.3924, AIRPORT_WORLD, 0, playerid);
			}
		}
		case PlayerInfo[playerid][pPickup][1], PlayerInfo[playerid][pPickup][2]:
		{
			if (PlayerInfo[playerid][pInAirport])
			{
				DestroyDynamicPickup(PlayerInfo[playerid][pPickup][1]);
				DestroyDynamicPickup(PlayerInfo[playerid][pPickup][2]);
				RemovePlayerAttachedObject(playerid, 0);
				
				PlayerInfo[playerid][pInAirport] = 0;
				
				SetPlayerVirtualWorld(playerid, 0);
				SetPlayerPos(playerid, 1642.3411, -2238.3843, 13.4976);
				SetPlayerFacingAngle(playerid, 180.0);
				SetCameraBehindPlayer(playerid);
				
				ClearChat(playerid);
				
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "Welcome to Los Santos Life Roleplay!");
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "If you need help getting around in the server, then please type /guide.");
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have been given $2500 to get started.");

				GiveMoney(playerid, 2500);
			}
		}
	}
	return 1;
}
I know I can't do it like that and I can do that with an if statement, but is it the only way? I would like to use a switch for that because I'm pretty sure I will make more pickups this way.
Reply


Messages In This Thread
must be a constant expression; assumed zero - by GoldenLion - 17.12.2016, 19:17
Re: must be a constant expression; assumed zero - by CutX - 17.12.2016, 20:14
Re: must be a constant expression; assumed zero - by Konstantinos - 17.12.2016, 21:00

Forum Jump:


Users browsing this thread: 1 Guest(s)