SA-MP Forums Archive
How else could I check this? - 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)
+--- Thread: How else could I check this? (/showthread.php?tid=316595)



How else could I check this? - Dokins - 07.02.2012

pawn Код:
if(VehicleSlot1[playerid] == 0)
            {
                VehicleSlot1[playerid] = VehicleSQLID[vehicleid];

            }
            else if(VehicleSlot2[playerid] == 0)
            {
                VehicleSlot2[playerid] = VehicleSQLID[vehicleid];

            }
            else if(VehicleSlot3[playerid] == 0)
            {
                VehicleSlot3[playerid] = VehicleSQLID[vehicleid];
            }
Title says all.


Re: How else could I check this? - [LoF]Zak - 07.02.2012

What is wrong with it? It looks fine to me, but you could make it shorter, e.g:

pawn Код:
if(VehicleSlot1[playerid] == 0) { VehicleSlot1[playerid] = VehicleSQLID[vehicleid]; }
else if(VehicleSlot2[playerid] == 0) { VehicleSlot2[playerid] = VehicleSQLID[vehicleid]; }
else if(VehicleSlot3[playerid] == 0) { VehicleSlot3[playerid] = VehicleSQLID[vehicleid]; }