Skip to main content
This page is for mod makers who write server mods such as convoys, traffic, missions or garages. Server owners don’t need to do anything: the API does nothing for players on its own.
Server mods can read a car’s state, start and stop it, switch its lights, lock and unlock it, and see its add-ons. It works on CZ Autoz cars and on vanilla and other mods’ cars. Motorbikes and DayZ’s boats are not covered. CZ Autoz helicopters have their own API (CZAutoz_HeliAPI); this one leaves them alone. Everything runs on the server. On a player’s game every call returns false or 0 and does nothing. It works only on a whitelisted server.

Checking the mod is there

Add Callatic_Vehicles_Core_Scripts to your requiredAddons, then:
The version only goes up when a call changes in a way that could break your mod. New calls are added without changing it.

IsUsable

true when car is a car, is not destroyed, and can be used on this server right now. Every other call returns false (and does nothing) when this is false. Check it first.

Reading state

Each call returns true and fills the value, or false (value 0) if the car is not usable.

Controlling it

Each call follows the same rules as a player’s action. It returns true if it was done. The calls are made for server mods, so they need no driver and no key. They work on a car nobody is in and on a key-locked car, and Unlock needs no key. Starting and stopping the engine are refused while someone is in the driver’s seat: that player’s game runs the engine.

Events

Server only. They fire only while the car is usable; OnDestroyed fires as the car is destroyed. OnDamaged gives the damage to the part of the car that was hit.
Remove your handlers in your own teardown. Vehicles Core also clears every handler when the mission ends. A handler must not lock, unlock or delete the car it is told about (the lock events run while the lock is changing); do that later, for example with CallLater.

Example: a convoy mission starts its lead truck