Skip to main content
This page is for mod makers who write server mods such as air patrols, rescue missions or military events. Server owners don’t need to do anything: on its own the API does nothing for players, and if no other mod uses it, nothing changes on your server.
Other server mods can read a helicopter’s state, start and stop it, and fly it, with our own autopilot or with their own controls. Everything runs on the server. Calls made on a player’s game do nothing and return false.

Checking the mod is there

Add CZAutozHelicopter_Scripts to your mod’s requiredAddons, then check the version:
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 heli is one of our helicopters, is not destroyed, and can be used on this server right now. Every other call returns false (and does nothing) when this is false.

Reading state

Each getter returns true and fills the value, or false (value 0) when the helicopter is not usable.

Controlling it

Each call does what a player can do, with the same rules: fuel, battery, parts, damage and the server’s own settings. It returns true if it was done. No player has to be on board. A script call has no player, so checks made on a player (for example a vehicle key or lock mod) do not apply to it: your mod decides who may use the helicopter. Autopilot. It needs the server’s autopilot switched on. From the ground it only takes off if the server allows automatic take-off; otherwise start the engine and get it into the air first (for example with SetAiInput). At the last point it lands or holds a hover, as the server’s autopilot settings say. On a route it turns for the next point about 1.2 km before each point, so keep points at least about 1.5 km apart. Points are map coordinates in metres, kept inside the map (0 to 32768). A point that is not a finite number refuses the whole call. The autopilot plans its flight each time it is given a point, so FlyTo / FlyRoute on the same helicopter are accepted at most once every 0.5 s (a call sooner returns false and changes nothing). Call them once, not every frame. A player who takes the pilot seat or uses the Pilot Panel ends your route. Your own controls. SetAiInput only works while no player is flying the helicopter. It switches the autopilot and Autohover off. Pitch, roll and yaw from -1 to 1 are a player’s full stick and pedals. Collective from -1 to 1 is the gentle range a pilot uses to hold and adjust height (about a third of a player’s full collective), enough to climb and descend. Send it at least every 0.5 s: if you stop, the controls go back to neutral, and the server then treats the helicopter like any other one nobody is flying (its abandoned-aircraft settings apply). A player who sits in the pilot seat always takes over. The helicopter still flies by its normal physics. One flown with nobody in the pilot seat is worked out by the server, so watching players may see small corrections in its movement that they would not see with a player flying it.

Events

Server only. Subscribe in your mission start and remove your handlers in your teardown. Events fire while the server can use the helicopters. Each one arrives on the next server tick after it happens, when the helicopter’s state is settled, so you can call any API function from your handler (for example FlyTo from OnAutopilotArrived).

Example: start a helicopter, climb, and fly to a point