Page tree
Skip to end of metadata
Go to start of metadata



Introduced in

Version:1.19

Description

Description:Specifies the code to run, once a vehicle or object is created.

Syntax

Syntax:onVehicleCreated command
Parameters:
  • command: String - Code to run. Receives _this, which is [vehicle, slow_vehicle_flag].
Return Value:Nothing

Examples

Examples:
onVehicleCreated "player sidechat format['Object created: %1', _this select 0];";

Additional Information

See also: fn vbs onPlayerVehicleChange
Multiplayer:
Problems:

Notes





Posted on February 17, 2012 - 10:12
Mbentley
This function is not persistent when the map editor is opened or closed.


You can make it persistent using a script containing:

#include "\vbs2\headers\function_library.hpp"
_script = "onVehicleCreated ""player sidechat format['Object created: %1', _this select 0];"";";
// Run the script
call compile _script;
// Re-add the event handler whenever the map is opened or closed
_id = [
    "editorLoad",
    _script,
    nil
] call fn_vbs_addSysEventHandler;

_id = [
    "editorUnload",
    _script,
    nil
] call fn_vbs_addSysEventHandler;