Vehicle

Struct Vehicle 

Source
pub struct Vehicle { /* private fields */ }

Implementations§

Source§

impl Vehicle

Source

pub fn get_handle(&self) -> *const c_void

Source

pub fn new(handle: *const c_void) -> Self

Source

pub fn create( modelid: i32, pos: Vector3, rotation: f32, colour1: i32, colour2: i32, respawnDelay: i32, addSiren: bool, ) -> Option<Vehicle>

Creates a vehicle in the world.

Source

pub fn get_seats(modelid: i32) -> i32

Gets the number of seats in the vehicle.

Source

pub fn destroy(&self)

Destroy a vehicle.

Source

pub fn is_streamed_in(&self, player: &Player) -> bool

Checks if a vehicle is streamed in for a player.

Source

pub fn get_pos(&self) -> Vector3

Gets the position of a vehicle.

Source

pub fn set_pos(&self, pos: Vector3)

Set a vehicle’s position.

Source

pub fn get_z_angle(&self) -> f32

Get the rotation of a vehicle on the Z axis (yaw).

Source

pub fn get_rotation_quat(&self) -> Vector4

Returns a vehicle’s rotation on all axes as a quaternion.

Source

pub fn get_distance_from_point(&self, pos: Vector3) -> f32

This function can be used to calculate the distance (as a float) between a vehicle and another map coordinate.

Source

pub fn set_z_angle(&self, angle: f32) -> bool

Set the Z rotation (yaw) of a vehicle.

Source

pub fn set_params_for_player( &self, player: &Player, params: VehicleParams, ) -> bool

Set the parameters of a vehicle for a player.

Source

pub fn use_manual_engine_and_lights() -> bool

Source

pub fn set_params(&self, params: VehicleParams) -> bool

Source

pub fn get_params(&self) -> VehicleParams

Source

pub fn set_to_respawn(&self)

Sets a vehicle back to the position at where it was created.

Links a vehicle to an interior.

Source

pub fn add_component(&self, componentid: i32) -> bool

Adds a ‘component’ (often referred to as a ‘mod’ (modification)) to a vehicle.

Source

pub fn remove_component(&self, componentid: i32) -> bool

Remove a component from a vehicle.

Source

pub fn change_color(&self, colour1: i32, colour2: i32) -> bool

Change a vehicle’s primary and secondary colors.

Source

pub fn change_paintjob(&self, paintjobid: i32) -> bool

Change a vehicle’s paintjob.

Source

pub fn set_health(&self, health: f32)

Set a vehicle’s health.

Source

pub fn get_health(&self) -> f32

Get the health of a vehicle.

Source

pub fn attach_trailer(&self, trailer: &Vehicle) -> bool

Attach a vehicle to another vehicle as a trailer.

Source

pub fn detach_trailer(&self) -> bool

Detach the connection between a vehicle and its trailer, if any.

Source

pub fn is_trailer_attached(&self) -> bool

Checks if a vehicle has a trailer attached to it.

Source

pub fn get_trailer(&self) -> Option<Vehicle>

Get the ID of the trailer attached to a vehicle.

Source

pub fn set_number_plate(&self, numberPlate: &str) -> bool

Set a vehicle numberplate.

Source

pub fn get_model(&self) -> i32

Gets the model ID of a vehicle.

Source

pub fn get_component_in_slot(&self, slot: i32) -> i32

Retrieves the installed component ID (modshop mod(ification)) on a vehicle in a specific slot.

Source

pub fn get_component_type(componentid: i32) -> i32

Find out what type of component a certain ID is.

Source

pub fn can_have_component(modelid: i32, componentid: i32) -> bool

Is the component legal on the vehicle?

Source

pub fn get_random_car_col_pair(modelid: i32) -> (i32, i32, i32, i32)

Source

pub fn colour_index_to_colour(colourIndex: i32, alpha: i32) -> i32

Source

pub fn repair(&self)

Fully repairs a vehicle, including visual damage (bumps, dents, scratches, popped tires etc.

Source

pub fn get_velocity(&self) -> Vector3

Get the velocity of a vehicle on the X, Y and Z axes.

Source

pub fn set_velocity(&self, velocity: Vector3)

Sets the X, Y and Z velocity of a vehicle.

Source

pub fn set_angular_velocity(&self, velocity: Vector3) -> bool

Sets the angular X, Y and Z velocity of a vehicle.

Source

pub fn get_damage_status(&self) -> VehicleDamageStatusData

Retrieve the damage statuses of a vehicle.

Source

pub fn update_damage_status( &self, panels: i32, doors: i32, lights: i32, tires: i32, )

Sets the various visual damage statuses of a vehicle, such as popped tires, broken lights and damaged panels.

Source

pub fn get_model_info(model: i32, infotype: i32) -> Vector3

Retrieve information about a specific vehicle model such as the size or position of seats.

Source

pub fn set_virtual_world(&self, virtualWorld: i32) -> bool

Sets the ‘virtual world’ of a vehicle.

Source

pub fn get_virtual_world(&self) -> i32

Get the virtual world of a vehicle.

Source

pub fn get_landing_gear_state(&self) -> i32

Gets the current vehicle landing gear state from the latest driver.

Source

pub fn create_static( modelid: i32, spawn: Vector3, angle: f32, colour1: i32, colour2: i32, respawnDelay: i32, addSiren: bool, ) -> Option<Vehicle>

Adds a ‘static’ vehicle (models are pre-loaded for players) to the gamemode.

Source

pub fn enable_friendly_fire() -> bool

Enable friendly fire for team vehicles.

Source

pub fn get_spawn_info(&self) -> VehicleSpawnData

Gets the vehicle spawn location and colours.

Source

pub fn set_spawn_info(&self, data: VehicleSpawnData) -> bool

Adjusts vehicle model, spawn location, colours, respawn delay and interior.

Source

pub fn get_model_count(modelid: i32) -> i32

Gets the model count of a vehicle model.

Source

pub fn get_models_used() -> i32

Get the number of used vehicle models on the server.

Source

pub fn get_paintjob(&self) -> i32

Gets the vehicle’s paintjob id.

Source

pub fn get_color(&self) -> (i32, i32)

Source

pub fn get_interior(&self) -> i32

Get the interior id of a vehicle.

Source

pub fn get_number_plate(&self) -> String

Get the number plate of a vehicle.

Source

pub fn set_respawn_delay(&self, respawn_delay: i32) -> bool

Set the respawn delay of a vehicle.

Source

pub fn get_respawn_delay(&self) -> i32

Get the respawn delay of a vehicle.

Source

pub fn get_cab(&self) -> Option<Vehicle>

Get the ID of the cab attached to a vehicle.

Source

pub fn get_occupied_tick(&self) -> i32

Get the occupied tick of a vehicle.

Source

pub fn get_respawn_tick(&self) -> i32

Get the respawn tick of a vehicle.

Source

pub fn has_been_occupied(&self) -> bool

Check if a vehicle is occupied.

Source

pub fn is_occupied(&self) -> bool

Check if a vehicle is occupied.

Source

pub fn is_dead(&self) -> bool

Check if a vehicle is dead.

Source

pub fn toggle_siren_enabled(&self, status: bool) -> bool

Turn the siren for a vehicle on or off.

Source

pub fn is_siren_enabled(&self) -> bool

Checks if a vehicle siren is on or off.

Source

pub fn get_last_driver(&self) -> Option<Player>

Get the last driver of a vehicle.

Source

pub fn get_driver(&self) -> Option<Player>

Get the playerid of the person driving the vehicle.

Source

pub fn get_siren_state(&self) -> i32

Gets the siren state of the vehicle.

Source

pub fn get_hydra_reactor_angle(&self) -> u32

Gets the hydra reactor angle of the vehicle.

Source

pub fn get_train_speed(&self) -> f32

Gets the speed of the train.

Source

pub fn get_matrix(&self) -> VehicleMatrix

Gets the actual rotation matrix of the vehicle.

Source

pub fn get_occupant(&self, seat: i32) -> Option<Player>

Source

pub fn get_max_passengers(model: i32) -> i32

Source

pub fn count_occupants(&self) -> i32

Source

pub fn get_from_id(id: i32) -> Option<Vehicle>

Source

pub fn get_id(&self) -> i32

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.