17.04.2016, 12:44
That's the mistake, the function is supposed to get a vehicle ID and not a vehicle model ID.
Use the second parameter when you want to pass the model ID. Examples:
PHP код:
GetVehicleName(vehicleid, model = 0)
{
new String[32] = "N/A";
if(!model)
{
new modelid = GetVehicleModel(vehicleid);
if(modelid) strcpy(String, VehicleNames[modelid - 400], sizeof(String));
}
else
{
if(400 <= vehicleid <= 611) strcpy(String, VehicleNames[modelid - 400], sizeof(String));
}
return String;
}
pawn Код:
GetVehicleName(vehicleid)
GetVehicleName(modelid, 1)