25.06.2012, 00:23
Hey there.
First I'd like to say that making a single dialog page with every vehicle in the game will not work well.
You're going to have 211 (around that) lines to show every vehicle, which will make it hard to find a single vehicle.
Vehicles will also be sorted by the vehicle ID, rather than categorized by the vehicle type (e.g. aircraft) and then sorted by the name.
Rather than make one yourself, I highly recommend you use the SEARCH feature to find a script that someone else has made which does this.
But otherwise:
#edit you will also have to process the row that the player selected to spawn the vehicle
First I'd like to say that making a single dialog page with every vehicle in the game will not work well.
You're going to have 211 (around that) lines to show every vehicle, which will make it hard to find a single vehicle.
Vehicles will also be sorted by the vehicle ID, rather than categorized by the vehicle type (e.g. aircraft) and then sorted by the name.
Rather than make one yourself, I highly recommend you use the SEARCH feature to find a script that someone else has made which does this.
But otherwise:
pawn Code:
command(callcar, playerid, params[])
{
new string[3100];//The string will be around 3090 characters long!
for(new i; i < sizeof(VehicleNames); i++)//This loops through all the vehicle names
{
//If this is the first vehicle in the list
if(!strlen(string))format(string,sizeof(string),"%s",VehicleNames[i]);
//else put the name on a new line
else format(string,sizeof(string),"\n%s",VehicleNames[i]);
}
ShowPlayerDialog(playerid, 4601, DIALOG_STYLE_LIST, "Call Car", string, "Ok", "Close");
}