SA-MP Forums Archive
Getting the item (not model) a player selects in OnPlayerModelSelectionEx? - 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: Getting the item (not model) a player selects in OnPlayerModelSelectionEx? (/showthread.php?tid=582303)



Getting the item (not model) a player selects in OnPlayerModelSelectionEx? - Dokins - 19.07.2015

To explain this easily.

When I say item, I mean ID. Like if they select the first picture (model) how do I check that?

Imagine there is a garage and you put your car in there, and to get it back a Model selection menu displays with your car and you click it, how can I get all the variables relevant to that vehicle back? and say there was more than one vehicle in the garage?

Is this possible?


Re: Getting the item (not model) a player selects in OnPlayerModelSelectionEx? - dominik523 - 19.07.2015

I would create an array which would contain last saved vehicles. Something simillar to this:
pawn Код:
new GarageVehicles[MAX_PLAYERS][10];
// when player leaves the garage:
GarageVehicle[playerid][0] = model; // something like this, you'll probably have to loop through the array to get empty slot



Re: Getting the item (not model) a player selects in OnPlayerModelSelectionEx? - Dokins - 19.07.2015

Yeah, but what if there was more than one model of the same kind?

Edit:

Will this do it, do you think?

It's not actually a garage, it's for getting furniture from a vehicle.

pawn Код:
for(new x = 1; x < slots; x++)
            {
                if(modelid == FurniModel[playerid][x][fmod])
                {
                    new furni = FurniModel[playerid][x][fid];
                    VehFurniStored[furni] = 0;
                    HoldingFurni[playerid] = furni;
                    SetPlayerAttachedObject(playerid, 2, FurniModel[furni], 14);
                    printf("MODEL %d", FurniModel[furni]);
                    SetPlayerSpecialAction(playerid, 25);
                    VehOpened[playerid] = 0;
                    format(string, sizeof(string), "* %s has taken an item of furniture from the %s *", GetNameEx(playerid), VehicleNames[GetVehicleModel(vehid) - 400]);
                    ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
                }
            }