Squirrel/Server/Events/Vehicle/onVehicleUpdate
From Liberty Unleashed Wiki
(Difference between revisions)
(Created page with '{{Squirrel/Title|onVehicleUpdate}} {{Warning|This event can be called multiple times per second for any occupied or unoccupied vehicles. It is not recommended to run any heavy co…') |
m (Correct category for related events) |
||
(One intermediate revision by one user not shown) | |||
Line 1: | Line 1: | ||
{{Squirrel/Title|onVehicleUpdate}} | {{Squirrel/Title|onVehicleUpdate}} | ||
+ | {{ScriptingChangesIn0.1.0.9}} | ||
{{Warning|This event can be called multiple times per second for any occupied or unoccupied vehicles. It is not recommended to run any heavy code under this.}} | {{Warning|This event can be called multiple times per second for any occupied or unoccupied vehicles. It is not recommended to run any heavy code under this.}} | ||
This event is called every time a vehicle sync packet (player is driving a vehicle or unoccupied sync) is received. | This event is called every time a vehicle sync packet (player is driving a vehicle or unoccupied sync) is received. | ||
Line 38: | Line 39: | ||
== Related Events == | == Related Events == | ||
− | {{Squirrel/Server/Events/ | + | {{Squirrel/Server/Events/Vehicle}} |
Latest revision as of 01:38, 15 April 2011
Warning: This event can be called multiple times per second for any occupied or unoccupied vehicles. It is not recommended to run any heavy code under this.
This event is called every time a vehicle sync packet (player is driving a vehicle or unoccupied sync) is received.
[edit] Syntax
function onVehicleUpdate( Vehicle vehicle, Player trigger )
[edit] Arguments
- vehicle - Vehicle which was updated
- trigger - The player who triggered this event (either the vehicle driver or the player who moved an unoccupied vehicle)
[edit] Returns
- 1 - This sync packet will be transmitted to other clients normally
- 0 - Do not broadcast this sync packet to other clients
[edit] Example
This example will message the player if they move an unoccupied vehicle.
function onVehicleUpdate( vehicle, player ) { // Check that the vehicle has no driver if ( vehicle.Driver ) return 1; MessagePlayer( "Nice one you scratched the paint of that " + GetVehicleName( vehicle.Model ), player ); return 1; }
[edit] Notes
The functions MessagePlayer, GetVehicleName and Vehicle.Model were used in this example. More info about them can be found in the corresponding pages.