samp_sdk/omp/generated/player_variables.rs
1//! `IPlayerVariableData` — generated by `cargo xtask gen-omp` from `Server/Components/Variables/variables.hpp`.
2//! Implemented by `PlayerVariableData` in the server's `Variables`.
3//!
4//! Do not edit: change `xtask/omp-wrappers.toml` or the generator and
5//! regenerate. Slots are clang's layout of the header for each ABI, checked
6//! against the official binaries by `cargo xtask check-abi --generated`.
7
8#![allow(unused_imports)]
9
10use crate::omp::containers::{FlatSet, HybridString, Pair, Span};
11use crate::omp::types::{
12 Colour, GTAQuat, Hours, Microseconds, Milliseconds, Minutes, Seconds, StringView, TimePoint,
13 UID, Vector2, Vector3, Vector4, WorldTimePoint,
14};
15use crate::omp::vtable::{call_vtable_small_struct, opaque, slots, virtual_fns};
16use crate::omp::*;
17
18opaque! {
19 /// Opaque handle for `IPlayerVariableData*`.
20 pub IPlayerVariableData;
21}
22
23/// `PlayerVariableData_UID` in `Server/Components/Variables/variables.hpp`.
24pub const PLAYER_VARIABLES_UID: UID = 0x12debbc8a3bd23ad;
25
26/// The player's `IPlayerVariableData`, or null when the component providing it is not loaded.
27///
28/// Found by walking the player's extension map for `PLAYER_VARIABLES_UID` — the
29/// virtual `getExtension` does not consult that map. `IExtension`
30/// is `IPlayerVariableData`'s first base, so the extension pointer is the interface pointer.
31///
32/// # Safety
33/// `player` must be a live `IPlayer`.
34#[must_use]
35pub unsafe fn player_variables(player: *mut IPlayer) -> *mut IPlayerVariableData {
36 unsafe { extension(player.cast::<u8>(), PLAYER_VARIABLES_UID) }.cast::<IPlayerVariableData>()
37}