How to search for the first open carslot from 2 houses
#1

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?
Reply
#2

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
Reply
#3

Hmm i will try that. I cant test right now. Got to get my system up and running
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)