How to search for the first open carslot from 2 houses - 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 to search for the first open carslot from 2 houses (
/showthread.php?tid=451602)
How to search for the first open carslot from 2 houses -
thimo - 17.07.2013
So i want to make a search for two houses(if player owns 1 house just search through the 1 house) till it finds a free carslot in one or the other house. This is what i got so far:
pawn Код:
for (new HouseSlot; HouseSlot < MAX_HOUSESPERPLAYER; HouseSlot++)
{
HouseID = APlayerData[playerid][Houses][HouseSlot];
printf("OnPlayerDisconnect::HouseID = %d", HouseID);
if (HouseID != 0)
{
if (AHouseData[HouseID][VehicleIDs][CarSlot] == 0)
{
}
}
}
Now this i think should work but wouldnt this search trough both houses and not STOP when it finds 1 in the first house. How to do that?
Re: How to search for the first open carslot from 2 houses -
serj009 - 17.07.2013
If I understand your problem correctly. Try putting a "break;" under [CarSlot] == 0. This should stop the loop right where it find's the first [CarSlot] == 0.
https://sampwiki.blast.hk/wiki/Control_Structures#break
Re: How to search for the first open carslot from 2 houses -
thimo - 17.07.2013
Hmm i will try that. I cant test right now. Got to get my system up and running