Switch & case question
#1

As I am developing a gamemode I want to make it faster and create as much as case's except if and else statements. Although there is a problem occuring, and I'm not sure how to fix it, I'm also not sure if I can use this in a case.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
        if (newkeys & KEY_NO)
         {
                   switch(LootObjects[MAX_LOOTS])
                  {
                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]);
                    }
                }
                }
        return 0;
    }
This error seems to show up:
Код:
E:\SAMP\RPG all\RPG\gamemodes\rc-apo.pwn(511) : error 032: array index out of bounds (variable "LootObjects")
If somebody could help that would be great, as this is a great way to speed up my slow script.
The script looks a bit messed up although it looks good in pawno itself.
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)