OnPlayerPickup and for loops? Good combination or not?
#1

Hello, I'm using 2 for loops in my car dealership, to either check the names and the pickup id's this is what I got on OnPlayerPickUpPickup

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    for(new i; i < sizeof(DealerShips); i++)
    {
        if(pickupid == DealerShips[i][PickupID]) break;
            new VehiclesString[250];
            for(new d; d < sizeof(DealerShipVehicles); d++)
            {
                if(DealerShipVehicles[d][DealershipNumber] == DealerShips[i][DealerShipID])
                {
                    new vModel = DealerShipVehicles[d][VModel];
                    format(VehiclesString, sizeof(VehiclesString), "%s(%d)\n",VehicleFriendlyNames[vModel-400],DealerShipVehicles[d][VPrice]);
                }
            }
            ShowPlayerDialog(playerid, dealership1, DIALOG_STYLE_LIST, DealerShips[i][DealershipName], VehiclesString, "Buy", "Cancel");
    }
    return 1;
}
And here is the loading part of the pickups:
pawn Код:
public LoadDealerships(playerid)
{
    for(new i; i < sizeof(DealerShips); i++)
    {
        new string[128];
        DealerShips[i][PickupID] = CreateDynamicPickup(1239,23,DealerShips[i][LocX],DealerShips[i][LocY],DealerShips[i][LocZ]);
        format(string, sizeof(string), "{FFFF00}%s", DealerShips[i][DealershipName]);
        DealerShips[i][labeltext] = Create3DTextLabel(string,0xFFFFFFFF,DealerShips[i][LocX],DealerShips[i][LocY],DealerShips[i][LocZ],15.0,0,0);
    }
    print("Dealerships has been loaded");
    return 1;
}
Now here is the problem when In-game and trying to pickup that pickup, it doesn't show me the dialog with the vehicle names that it should.

Anyone has a clue why this is happening and if it's smart to do 2 loops?

-Kevin
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)