Custom Vehicles
Build a custom-looking vehicle from the base vehicle and an attached object.
0.3.DL has no custom vehicle model. Knight ships a helper that combines a drivable base vehicle with a hidden chassis and an attached custom object.
knight
system::start() {
AddSimpleModel(-1, 19379, -2000, "vehicles/super.dff", "vehicles/super.txd");
// base model 411, custom object -2000, hidden chassis for DL clients
let vid = CreateCustomVehicle(411, -2000, 1958.4, 1348.0, 15.4, 90.0, 3, 3, true);
Log("custom vehicle: {vid}");
};
player::command("/cv") {
if (IsCustomVehicle(GetPlayerVehicleID(playerid))) {
SendClientMessage(playerid, "You are in a custom vehicle.");
}
};
API
| Function | Description |
|---|---|
CreateCustomVehicle(base, obj, x,y,z, angle, c1,c2, invisible) | Create the vehicle and attach the object. |
DestroyCustomVehicle(id) | Destroy the vehicle and its object. |
GetCustomVehicleObject(id) | Object id attached to the vehicle, or -1. |
IsCustomVehicle(id) | Whether the id came from CreateCustomVehicle. |
How it works
- DL clients receive the vehicle with a near-invisible chassis model (default
570, configurable). - The custom object is attached client-side, so it follows the vehicle with no per-tick updates.
- 0.3.7 clients keep the normal base vehicle and a safe object fallback.
Warning
The hidden chassis is a client-side trick. If it does not look right on a build, set
invisible to false or change custom_invisible_vehicle_model.