Actor

Struct Actor 

Source
pub struct Actor { /* private fields */ }
Expand description

Main handler pointing to open.mp’s Actor object

Implementations§

Source§

impl Actor

Source

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

Source

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

Source

pub fn create_actor(skin: i32, pos: Vector3, angle: f32) -> Option<Actor>

Create a static ‘actor’ in the world. These ‘actors’ are like NPCs, however they have limited functionality. They do not take up server player slots.

Source

pub fn destroy(&self)

Destroys an Actor

Source

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

Checks if an actor is streamed in for a player.

Source

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

Sets an actor’s virtual world

Source

pub fn get_virtual_world(&self) -> i32

Get the virtual world of an actor.

Source

pub fn apply_animation(&self, animation_data: AnimationData) -> bool

Apply an animation to an actor.

Source

pub fn clear_animations(&self) -> bool

Clear any animations that are applied to an actor.

Source

pub fn set_pos(&self, pos: Vector3)

Set the position of an actor.

Source

pub fn get_pos(&self) -> Vector3

Get the position of an actor.

Source

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

Set the facing angle of an actor.

Source

pub fn get_facing_angle(&self) -> f32

Get the facing angle of an actor.

Source

pub fn set_health(&self, health: f32)

Set the health of an actor.

Source

pub fn get_health(&self) -> f32

Get the health of an actor

Source

pub fn set_invulnerable(&self, invulnerable: bool) -> bool

Set actor invulnerability

Source

pub fn is_invulnerable(&self) -> bool

Check if actor is invulnerable.

Source

pub fn set_skin(&self, skin: i32) -> bool

Set the skin of the actor.

Source

pub fn get_skin(&self) -> i32

Get the skin of the actor.

Source

pub fn get_animation(&self) -> AnimationData

Get the animation the actor is currently performing.

Source

pub fn get_spawn_info(&self) -> ActorSpawnData

Get the initial spawn point of the actor.

Source

pub fn get_id(&self) -> i32

Get id of the Actor object

Source

pub fn from_id(actorid: i32) -> Option<Actor>

Get the Actor object from an id

Auto Trait Implementations§

§

impl Freeze for Actor

§

impl RefUnwindSafe for Actor

§

impl !Send for Actor

§

impl !Sync for Actor

§

impl Unpin for Actor

§

impl UnwindSafe for Actor

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.