Switch & case question
#5

Quote:
Originally Posted by [WA]iRonan
Посмотреть сообщение
I used yours and modified it a lot

Код:
switch(LootObjects[500])
Changed it to this, and added a bracket although the error still appears.
Код:
		if (newkeys & KEY_NO)
		{
			switch(LootObjects[500])
			{
				case 0:
				{
					if(IsPlayerInRangeOfPoint(playerid,2.0,254.02530, 4084.52393, 0.42032))
					{
						AddItem(playerid,"Dead Deer", 1);
						SendClientMessage(playerid, COLOR_GREEN, TEXT_INV_DEAD);
						DestroyObject(LootObjects[0]);
					}
				}
				case 1:
				{
					if(IsPlayerInRangeOfPoint(playerid,2.0,242.75516,4239.82813,8.84726))
					{
						AddItem(playerid,"Dead Deer", 1);
						SendClientMessage(playerid, COLOR_GREEN, TEXT_INV_DEAD);
						DestroyObject(LootObjects[1]);
					}
				}
				case 2:
				{
					if(IsPlayerInRangeOfPoint(playerid,2.0,225.52122, 4161.61670, 8.79168))
					{
						AddItem(playerid,"Bandage", 1);
						SendClientMessage(playerid, COLOR_GREEN, TEXT_INV_SMALLMEDKIT);
						DestroyObject(LootObjects[2]);
					}
				}
				case 3:
				{
					if(IsPlayerInRangeOfPoint(playerid,2.0,644.18268, 4754.36621, 8.81872))
					{
						AddItem(playerid,"Large Water Bottle - Full", 1);
						SendClientMessage(playerid, COLOR_GREEN, TEXT_INV_WATERBOTTLE);
						DestroyObject(LootObjects[3]);
					}
				}
			}
		}
In that case, try switch(LootObjects[499]) :P If MAX_LOOT is 500, you can't use [500]. It's range would be 0 - 499.
Reply


Messages In This Thread
Switch & case question - by [WA]iRonan - 22.01.2014, 14:19
Re: Switch & case question - by Voxel - 22.01.2014, 14:49
Re: Switch & case question - by Jstylezzz - 22.01.2014, 14:51
Re: Switch & case question - by [WA]iRonan - 22.01.2014, 15:00
Re: Switch & case question - by Jstylezzz - 22.01.2014, 15:01
Re: Switch & case question - by [WA]iRonan - 22.01.2014, 15:04
Re: Switch & case question - by Riddick94 - 22.01.2014, 15:05
Re: Switch & case question - by [WA]iRonan - 22.01.2014, 15:08
Re: Switch & case question - by Jstylezzz - 22.01.2014, 15:12
Re: Switch & case question - by [WA]iRonan - 22.01.2014, 16:07

Forum Jump:


Users browsing this thread: 1 Guest(s)