Making this code efficiant
#1

Hey! I'm in process of making a drop system for my server, I currently have this code;
pawn Код:
case 14: {
                WepPickup[CreateDynamicPickup(325, 1, Pos[0]+random(3), Pos[1]+random(3), Pos[2])] = GetPlayerWeapon(playerid);
                WepAmmo = Amount;
            }
            case 15: {
                WepPickup[CreateDynamicPickup(326, 1, Pos[0]+random(3), Pos[1]+random(3), Pos[2])] = GetPlayerWeapon(playerid);
                WepAmmo = Amount;
            }
            case 16: {
                WepPickup[CreateDynamicPickup(342, 1, Pos[0]+random(3), Pos[1]+random(3), Pos[2])] = GetPlayerWeapon(playerid);
                WepAmmo = Amount;
            }
            case 17: {
                WepPickup[CreateDynamicPickup(343, 1, Pos[0]+random(3), Pos[1]+random(3), Pos[2])] = GetPlayerWeapon(playerid);
                WepAmmo = Amount;
            }
Now that is only half of the code, seeing as there is a lot of weapons I need to add, I was wondering what I could to do to make it smaller and a lot more cleaner, I was thinking of using an array of some sort but, how would I do it?

Thanks!
Reply


Messages In This Thread
Making this code efficiant - by Luis- - 10.06.2013, 21:19
Re: Making this code efficiant - by IstuntmanI - 10.06.2013, 21:22
Re: Making this code efficiant - by Luis- - 10.06.2013, 21:40

Forum Jump:


Users browsing this thread: 1 Guest(s)