05.04.2016, 19:09
@Vanter, his CreateVehicleEx function deals with most of that. The command itself can be a lot simpler:
The code is not hard to understand, so I believe an explanation is not required.
PHP код:
command(veh, playerid, params[]) {
new
vehicleid[30];
if(sscanf(params, "s[30]", vehicleid)) {
return SendClientMessage(playerid, -1, "usage: /veh <name/modelid>");
}
new
carid;
if(IsNumeric(vehicleid)) {
carid = strval(vehicleid);
}
else {
carid = GetVehicleModelID(vehicleid);
}
if(carid < 400 || carid > 611) {
return SendClientMessage(playerid, -1, "error: The vehicle ID/Name you specified is invalid.");
}
CreateVehicleEx(playerid, carid);
return true;
}