29.03.2014, 19:43
That's why I told you to check if the vehicle's model is valid because run time errors make the commands not to work well and display the unknown command message.
If the vehicle's model isn't correct, it will show the name else "N/A".
pawn Код:
CMD:myvehicles(playerid, params[])
{
new
id1 = GetVehicleModel(PlayerInfo[playerid][pVehicle1]),
id2 = GetVehicleModel(PlayerInfo[playerid][pVehicle2]),
id3 = GetVehicleModel(PlayerInfo[playerid][pVehicle3]),
string[100];
format(string, sizeof (string), "%s\n%s\n%s", (400 <= id1 <= 611) ? (VehicleNames[id1 - 400]) : ("N/A"), (400 <= id2 <= 611) ? (VehicleNames[id2 - 400]) : ("N/A"), (400 <= id3 <= 611) ? (VehicleNames[id3 - 400]) : ("N/A"));
ShowPlayerDialog(playerid, DIALOG_MYVEH, DIALOG_STYLE_LIST, "Your current vehicles:", string, "Info", "Cancel");
return 1;
}