omp_gdk/scripting/players/
mod.rs

1pub mod events;
2pub mod functions;
3
4pub use functions::load_functions;
5
6use crate::{
7    actors::Actor,
8    classes::{self, PlayerClass},
9    dialogs::{self, DialogStyle},
10    objects::{self, Object, ObjectAttachmentSlotData, PlayerObject},
11    textdraws::{self, PlayerTextDraw},
12    types::{
13        animationdata::AnimationData,
14        colour::Colour,
15        network::{NetworkID, NetworkStats},
16        staticarray::StaticArray,
17        vector::{Vector2, Vector3, Vector4},
18    },
19    vehicles::{self, Vehicle},
20};
21use std::os::raw::c_void;
22
23use super::{
24    checkpoints::{self, PlayerCheckPointData, PlayerRaceCheckPointData, RaceCheckpointType},
25    menus::{self, Menu},
26    textlabels::{self, PlayerTextLabel},
27};
28
29pub struct Player {
30    handle: *const c_void,
31}
32
33impl Player {
34    pub fn new(handle: *const c_void) -> Self {
35        Self { handle }
36    }
37
38    pub fn get_handle(&self) -> *const c_void {
39        self.handle
40    }
41
42    /// This function sends a message to a specific player with a chosen color in the chat.
43    pub fn send_client_message(&self, colour: Colour, message: &str) {
44        functions::SendClientMessage(self, colour, message);
45    }
46
47    /// Get a player's name.
48    pub fn get_name(&self) -> String {
49        let mut name = String::new();
50        functions::GetPlayerName(self, &mut name);
51        name
52    }
53
54    /// Sets the camera to a specific position for a player.
55    pub fn set_camera_pos(&self, pos: Vector3) {
56        functions::SetPlayerCameraPos(self, pos);
57    }
58
59    /// Sets the drunk level of a player which makes the player's camera sway and vehicles hard to control.
60    pub fn set_drunk_level(&self, level: isize) {
61        functions::SetPlayerDrunkLevel(self, level);
62    }
63
64    /// Set a player's interior.
65    pub fn set_interior(&self, interiorid: isize) {
66        functions::SetPlayerInterior(self, interiorid);
67    }
68
69    /// Set a player's wanted level (6 brown stars under HUD).
70    pub fn set_wanted_level(&self, level: isize) {
71        functions::SetPlayerWantedLevel(self, level);
72    }
73
74    /// Set a player's weather.
75    pub fn set_weather(&self, weatherid: isize) {
76        functions::SetPlayerWeather(self, weatherid);
77    }
78
79    /// Get a player's weather.
80    pub fn get_weather(&self) -> isize {
81        functions::GetPlayerWeather(self)
82    }
83
84    /// Set the skin of a player.
85    pub fn set_skin(&self, skinid: isize) {
86        functions::SetPlayerSkin(self, skinid);
87    }
88
89    /// Loads or unloads an interior script for a player (for example the ammunation menu).
90    pub fn set_shop_name(&self, shopname: &str) {
91        functions::SetPlayerShopName(self, shopname)
92    }
93
94    /// Give money to or take money from a player.
95    pub fn give_money(&self, amount: isize) {
96        functions::GivePlayerMoney(self, amount)
97    }
98
99    /// Set the direction a player's camera looks at.
100    pub fn set_camera_look_at(&self, pos: Vector3, cut: PlayerCameraCutType) {
101        functions::SetPlayerCameraLookAt(self, pos, cut)
102    }
103
104    /// Restore the camera to a place behind the player, after using a function like SetPlayerCameraPos.
105    pub fn set_camera_behind_player(&self) {
106        functions::SetCameraBehindPlayer(self)
107    }
108
109    /// Creates an explosion that is only visible to a single player.
110    pub fn create_explosion(&self, pos: Vector3, explosion_type: isize, radius: f32) {
111        functions::CreateExplosionForPlayer(self, pos, explosion_type, radius);
112    }
113
114    /// Play an 'audio stream' for a player.
115    pub fn play_audio_stream(&self, url: &str, pos: Vector3, distance: f32, use_pos: bool) {
116        functions::PlayAudioStreamForPlayer(self, url, pos, distance, use_pos);
117    }
118
119    /// Stops the current audio stream for a player.
120    pub fn stop_audio_stream(&self) {
121        functions::StopAudioStreamForPlayer(self)
122    }
123
124    /// Adds a death to the 'killfeed' on the right-hand side of the screen for all players.
125    pub fn send_death_message(&self, killee: &Player, weapon: PlayerWeapon) {
126        functions::SendDeathMessage(self, killee, weapon);
127    }
128
129    /// Toggle player's widescreen.
130    pub fn toggle_widescreen(&self, enable: bool) {
131        functions::TogglePlayerWidescreen(self, enable)
132    }
133
134    /// Checks if a player widescreen is on or off.
135    pub fn is_widescreen_toggled(&self) -> bool {
136        functions::IsPlayerWidescreenToggled(self)
137    }
138
139    /// Set the health of a player.
140    pub fn set_health(&self, health: f32) {
141        functions::SetPlayerHealth(self, health);
142    }
143
144    /// The function GetPlayerHealth allows you to retrieve the health of a player.
145    pub fn get_health(&self) -> f32 {
146        functions::GetPlayerHealth(self)
147    }
148
149    /// Set a player's armor level.
150    pub fn set_armour(&self, armour: f32) {
151        functions::SetPlayerArmour(self, armour)
152    }
153
154    /// This function stores the armour of a player into a variable.
155    pub fn get_armour(&self) -> f32 {
156        functions::GetPlayerArmour(self)
157    }
158
159    /// Set the team of a player.
160    pub fn set_team(&self, teamid: isize) {
161        functions::SetPlayerTeam(self, teamid)
162    }
163
164    /// Get the ID of the team the player is on.
165    pub fn get_team(&self) -> isize {
166        functions::GetPlayerTeam(self)
167    }
168
169    /// Set a player's score.
170    pub fn set_score(&self, score: isize) {
171        functions::SetPlayerScore(self, score)
172    }
173
174    /// This function returns a player's score as it was set using SetPlayerScore.
175    pub fn get_score(&self) -> isize {
176        functions::GetPlayerScore(self)
177    }
178
179    /// Returns the class of the players skin.
180    pub fn get_skin(&self) -> isize {
181        functions::GetPlayerSkin(self)
182    }
183
184    /// Set the colour of a player's nametag and marker (radar blip).
185    pub fn set_color(&self, colour: Colour) {
186        functions::SetPlayerColor(self, colour)
187    }
188
189    /// Gets the color of the player's name and radar marker.
190    pub fn get_color(&self) -> isize {
191        functions::GetPlayerColor(self)
192    }
193
194    /// Gets the default colour for the player ID.
195    pub fn get_default_colour(&self) -> isize {
196        functions::GetDefaultPlayerColour(self)
197    }
198
199    /// Checks the player's level of drunkenness.
200    pub fn get_drunk_level(&self) -> isize {
201        functions::GetPlayerDrunkLevel(self)
202    }
203
204    /// Give a player a weapon with a specified amount of ammo.
205    pub fn give_weapon(&self, data: WeaponSlotData) {
206        functions::GivePlayerWeapon(self, data)
207    }
208
209    /// Remove a specified weapon from a player.
210    pub fn remove_weapon(&self, weaponid: u8) {
211        functions::RemovePlayerWeapon(self, weaponid)
212    }
213
214    /// Retrieves the amount of money a player has.
215    pub fn get_money(&self) -> isize {
216        functions::GetPlayerMoney(self)
217    }
218
219    /// Reset a player's money to $0.
220    pub fn reset_money(&self) {
221        functions::ResetPlayerMoney(self)
222    }
223
224    /// Sets the name of a player.
225    pub fn set_name(&self, name: &str) -> PlayerNameStatus {
226        functions::SetPlayerName(self, name)
227    }
228
229    /// Get a player's current state.
230    pub fn get_state(&self) -> PlayerState {
231        functions::GetPlayerState(self)
232    }
233
234    /// Get the ping of a player.
235    pub fn get_ping(&self) -> isize {
236        functions::GetPlayerPing(self)
237    }
238
239    /// Returns the ID of the weapon a player is currently holding.
240    pub fn get_weapon(&self) -> PlayerWeapon {
241        functions::GetPlayerWeapon(self)
242    }
243
244    /// Sets the game time for a player.
245    pub fn set_time(&self, hour: isize, minute: isize) {
246        functions::SetPlayerTime(self, hour, minute)
247    }
248
249    /// Get the player's current game time.
250    pub fn get_time(&self) -> (isize, isize) {
251        let mut hour = 0;
252        let mut minute = 0;
253        functions::GetPlayerTime(self, &mut hour, &mut minute);
254        (hour, minute)
255    }
256
257    /// Toggle the in-game clock (top-right corner) for a specific player.
258    pub fn toggle_clock(&self, enable: bool) {
259        functions::TogglePlayerClock(self, enable)
260    }
261
262    /// Checks whether the player has their in-game clock enabled.
263    pub fn has_clock_enabled(&self) -> bool {
264        functions::PlayerHasClockEnabled(self)
265    }
266
267    /// Forces a player to go back to class selection.
268    pub fn force_class_selection(&self) {
269        functions::ForceClassSelection(self)
270    }
271
272    /// Gets the wanted level of a player.
273    pub fn get_wanted_level(&self) -> isize {
274        functions::GetPlayerWantedLevel(self)
275    }
276
277    /// Set a player's special fighting style.
278    pub fn set_fighting_style(&self, style: PlayerFightingStyle) {
279        functions::SetPlayerFightingStyle(self, style)
280    }
281
282    /// Get the fighting style the player currently using.
283    pub fn get_fighting_style(&self) -> PlayerFightingStyle {
284        functions::GetPlayerFightingStyle(self)
285    }
286
287    /// Set a player's velocity on the X, Y and Z axes.
288    pub fn set_velocity(&self, pos: Vector3) {
289        functions::SetPlayerVelocity(self, pos)
290    }
291
292    /// Get the velocity (speed) of a player on the X, Y and Z axes.
293    pub fn get_velocity(&self) -> Vector3 {
294        let mut pos = Vector3 {
295            x: 0.0,
296            y: 0.0,
297            z: 0.0,
298        };
299        functions::GetPlayerVelocity(self, &mut pos);
300        pos
301    }
302
303    /// Get the position of the player's camera.
304    pub fn get_camera_pos(&self) -> Vector3 {
305        let mut pos = Vector3 {
306            x: 0.0,
307            y: 0.0,
308            z: 0.0,
309        };
310        functions::GetPlayerCameraPos(self, &mut pos);
311        pos
312    }
313
314    /// Calculate the distance between a player and a map coordinate.
315    pub fn get_distance_from_point(&self, pos: Vector3) -> f32 {
316        functions::GetPlayerDistanceFromPoint(self, pos)
317    }
318
319    /// Retrieves the player's current interior.
320    pub fn get_interior(&self) -> isize {
321        functions::GetPlayerInterior(self)
322    }
323
324    /// Set a player's position.
325    pub fn set_pos(&self, pos: Vector3) {
326        functions::SetPlayerPos(self, pos)
327    }
328
329    /// Get the position of a player, represented by X, Y and Z coordinates.
330    pub fn get_pos(&self) -> Vector3 {
331        let mut pos = Vector3 {
332            x: 0.0,
333            y: 0.0,
334            z: 0.0,
335        };
336        functions::GetPlayerPos(self, &mut pos);
337        pos
338    }
339
340    /// Retrieves the current virtual world the player is in.
341    pub fn get_virtual_world(&self) -> isize {
342        functions::GetPlayerVirtualWorld(self)
343    }
344
345    /// Check if a player is an actual player or an NPC.
346    pub fn is_npc(&self) -> bool {
347        functions::IsPlayerNPC(self)
348    }
349
350    /// Checks if a player is streamed in another player's client.
351    pub fn is_streamed_in(&self, other: &Player) -> bool {
352        functions::IsPlayerStreamedIn(self, other)
353    }
354
355    /// Plays the specified sound for a player.
356    pub fn play_sound(&self, sound: usize, pos: Vector3) {
357        functions::PlayerPlaySound(self, sound, pos)
358    }
359
360    /// Makes a player spectate (watch) another player.
361    pub fn spectate_player(&self, target: &Player, mode: PlayerSpectateMode) {
362        functions::PlayerSpectatePlayer(self, target, mode)
363    }
364
365    /// Sets a player to spectate another vehicle.
366    pub fn spectate_vehicle(&self, vehicle: &Vehicle, mode: PlayerSpectateMode) {
367        functions::PlayerSpectateVehicle(self, vehicle, mode)
368    }
369
370    /// Set the virtual world of a player.
371    pub fn set_virtual_world(&self, vw: isize) {
372        functions::SetPlayerVirtualWorld(self, vw)
373    }
374
375    /// Set the world boundaries for a player.
376    pub fn set_world_bounds(&self, coords: Vector4) {
377        functions::SetPlayerWorldBounds(self, coords)
378    }
379
380    /// Reset the player's world boundaries to default world boundaries.
381    pub fn clear_world_bounds(&self) {
382        functions::ClearPlayerWorldBounds(self)
383    }
384
385    /// Get a player's world boundaries.
386    pub fn get_world_bounds(&self) -> Vector4 {
387        let mut pos = Vector4 {
388            x: 0.0,
389            y: 0.0,
390            z: 0.0,
391            w: 0.0,
392        };
393        functions::GetPlayerWorldBounds(self, &mut pos);
394        pos
395    }
396
397    /// Clears all animations for the given player (it also cancels all current tasks such as jetpacking, parachuting, entering vehicles, driving (removes player out of vehicle), swimming, etc).
398    pub fn clear_animations(&self, sync_type: PlayerAnimationSyncType) {
399        functions::ClearAnimations(self, sync_type)
400    }
401
402    /// Retrieves the start and end (hit) position of the last bullet a player fired.
403    pub fn get_last_shot_vectors(&self) -> PlayerBulletData {
404        functions::GetPlayerLastShotVectors(self)
405    }
406
407    /// Allows you to retrieve the ID of the player the playerid is looking at.
408    pub fn get_camera_target_player(&self) -> Option<Player> {
409        functions::GetPlayerCameraTargetPlayer(self)
410    }
411
412    /// Allows you to retrieve the ID of the actor the player is looking at (in any).
413    pub fn get_camera_target_actor(&self) -> Option<Actor> {
414        functions::GetPlayerCameraTargetActor(self)
415    }
416
417    /// Allows you to retrieve the ID of the object the player is looking at.
418    pub fn get_camera_target_object(&self) -> Option<Object> {
419        functions::GetPlayerCameraTargetObject(self)
420    }
421
422    /// Get the ID of the vehicle the player is looking at.
423    pub fn get_camera_target_vehicle(&self) -> Option<Vehicle> {
424        functions::GetPlayerCameraTargetVehicle(self)
425    }
426
427    /// Puts a player in a vehicle.
428    pub fn put_in_vehicle(&self, vehicle: &Vehicle, seat_id: isize) {
429        functions::PutPlayerInVehicle(self, vehicle, seat_id)
430    }
431
432    /// Removes a standard San Andreas model for a single player within a specified range.
433    pub fn remove_building(&self, model: isize, pos: Vector3, radius: f32) {
434        functions::RemoveBuildingForPlayer(self, model, pos, radius)
435    }
436
437    /// Gets the number of removed buildings for a player.
438    pub fn get_buildings_removed(&self) -> isize {
439        functions::GetPlayerBuildingsRemoved(self)
440    }
441
442    /// Removes/ejects a player from their vehicle.
443    pub fn remove_from_vehicle(&self, force: bool) {
444        functions::RemovePlayerFromVehicle(self, force)
445    }
446
447    /// Removes a map icon that was set earlier for a player using SetPlayerMapIcon.
448    pub fn remove_map_icon(&self, icon_id: isize) {
449        functions::RemovePlayerMapIcon(self, icon_id)
450    }
451
452    /// Place an icon/marker on a player's map.
453    pub fn set_map_icon(
454        &self,
455        icon_id: isize,
456        pos: Vector3,
457        icon_type: isize,
458        colour: Colour,
459        style: MapIconStyle,
460    ) {
461        functions::SetPlayerMapIcon(self, icon_id, pos, icon_type, colour, style)
462    }
463
464    /// Removes all weapons from a player.
465    pub fn reset_weapons(&self) {
466        functions::ResetPlayerWeapons(self)
467    }
468
469    /// Set the ammo of a player's weapon.
470    pub fn set_ammo(&self, data: WeaponSlotData) {
471        functions::SetPlayerAmmo(self, data)
472    }
473
474    /// Sets which weapon (that a player already has) the player is holding.
475    pub fn set_armed_weapon(&self, weapon: PlayerWeapon) {
476        functions::SetPlayerArmedWeapon(self, weapon)
477    }
478
479    /// Creates a chat bubble above a player's name tag.
480    pub fn set_chat_bubble(
481        &self,
482        text: &str,
483        colour: Colour,
484        drawdistance: f32,
485        expiretime: isize,
486    ) {
487        functions::SetPlayerChatBubble(self, text, colour, drawdistance, expiretime)
488    }
489
490    /// This sets the players position then adjusts the players z-coordinate to the nearest solid ground under the position.
491    pub fn set_pos_find_z(&self, pos: Vector3) {
492        functions::SetPlayerPosFindZ(self, pos)
493    }
494
495    /// Set the skill level of a certain weapon type for a player.
496    pub fn set_skill_level(&self, weapon: PlayerWeaponSkill, level: isize) {
497        functions::SetPlayerSkillLevel(self, weapon, level)
498    }
499
500    /// This function allows to set players special action.
501    pub fn set_special_action(&self, action: PlayerSpecialAction) {
502        functions::SetPlayerSpecialAction(self, action)
503    }
504
505    /// This functions allows you to toggle the drawing of player nametags, healthbars and armor bars which display above their head.
506    pub fn show_name_tag(&self, other: &Player, enable: bool) {
507        functions::ShowPlayerNameTagForPlayer(self, other, enable)
508    }
509
510    /// Toggles whether a player can control their character or not.
511    pub fn toggle_controllable(&self, enable: bool) {
512        functions::TogglePlayerControllable(self, enable)
513    }
514
515    /// Toggle whether a player is in spectator mode or not.
516    pub fn toggle_spectating(&self, enable: bool) {
517        functions::TogglePlayerSpectating(self, enable)
518    }
519
520    /// Apply an animation to a player.
521    pub fn apply_animation(&self, animation_data: AnimationData, sync: PlayerAnimationSyncType) {
522        functions::ApplyAnimation(
523            self,
524            &animation_data.get_animation_library(),
525            &animation_data.get_name(),
526            animation_data.delta,
527            animation_data.looping,
528            animation_data.lockX,
529            animation_data.lockY,
530            animation_data.freeze,
531            animation_data.time,
532            sync,
533        )
534    }
535
536    /// Enter edition mode for an attached object.
537    pub fn edit_attached_object(&self, index: isize) {
538        functions::EditAttachedObject(self, index)
539    }
540
541    /// Toggle camera targeting functions for a player.
542    pub fn enable_camera_target(&self, enable: bool) {
543        functions::EnablePlayerCameraTarget(self, enable)
544    }
545
546    /// Toggle stunt bonuses for a player.
547    pub fn enable_stunt_bonus(&self, enable: bool) {
548        functions::EnableStuntBonusForPlayer(self, enable)
549    }
550
551    /// Gets the amount of ammo in a player's current weapon.
552    pub fn get_ammo(&self) -> isize {
553        functions::GetPlayerAmmo(self)
554    }
555
556    /// Returns the index of any running applied animations.
557    pub fn get_animation_index(&self) -> isize {
558        functions::GetPlayerAnimationIndex(self)
559    }
560
561    /// Gets the angle a player is facing.
562    pub fn get_facing_angle(&self) -> f32 {
563        functions::GetPlayerFacingAngle(self)
564    }
565
566    /// Get the specified player's IP address and store it in a string.
567    pub fn get_ip(&self) -> String {
568        let mut ip = String::new();
569        functions::GetPlayerIp(self, &mut ip);
570        ip
571    }
572
573    /// Retrieves a player's current special action.
574    pub fn get_special_action(&self) -> PlayerSpecialAction {
575        functions::GetPlayerSpecialAction(self)
576    }
577
578    /// This function gets the ID of the vehicle the player is currently in.
579    pub fn get_vehicle_id(&self) -> isize {
580        functions::GetPlayerVehicleID(self)
581    }
582
583    /// Find out which seat a player is in.
584    pub fn get_vehicle_seat(&self) -> isize {
585        functions::GetPlayerVehicleSeat(self)
586    }
587
588    /// Get the weapon and ammo in a specific player's weapon slot (e.
589    pub fn get_weapon_data(&self, slot: isize) -> WeaponSlotData {
590        let mut weapon: WeaponSlotData = WeaponSlotData {
591            ammo: 0,
592            id: PlayerWeapon::Fist,
593        };
594        functions::GetPlayerWeaponData(self, slot, &mut weapon);
595        weapon
596    }
597
598    /// Check the state of a player's weapon.
599    pub fn get_weapon_state(&self) -> isize {
600        functions::GetPlayerWeaponState(self)
601    }
602
603    /// Move a player's camera from one position to another, within the set time.
604    pub fn interpolate_camera_pos(
605        &self,
606        from: Vector3,
607        to: Vector3,
608        time: isize,
609        cut: PlayerCameraCutType,
610    ) {
611        functions::InterpolateCameraPos(self, from, to, time, cut)
612    }
613
614    /// Interpolate a player's camera's 'look at' point between two coordinates with a set speed.
615    pub fn interpolate_camera_look_at(
616        &self,
617        from: Vector3,
618        to: Vector3,
619        time: isize,
620        cut: PlayerCameraCutType,
621    ) -> bool {
622        functions::InterpolateCameraLookAt(self, from, to, time, cut)
623    }
624
625    /// Check if a player has an object attached in the specified index (slot).
626    pub fn is_attached_object_slot_used(&self, index: isize) -> bool {
627        functions::IsPlayerAttachedObjectSlotUsed(self, index)
628    }
629
630    /// You can use this function to attach the player camera to objects.
631    pub fn attach_camera_to_object(&self, object: &Object) {
632        functions::AttachCameraToObject(self, object)
633    }
634
635    /// Attaches a player's camera to a player-object.
636    pub fn attach_camera_to_player_object(&self, object: &PlayerObject) {
637        functions::AttachCameraToPlayerObject(self, object)
638    }
639
640    pub fn get_aim_data(&self) -> PlayerAimData {
641        functions::GetPlayerAimData(self)
642    }
643
644    /// Check which keys a player is pressing.
645    pub fn get_keys(&self) -> PlayerKeyData {
646        let mut keys = 0;
647        let mut updown = 0;
648        let mut leftright = 0;
649        functions::GetPlayerKeys(self, &mut keys, &mut updown, &mut leftright)
650    }
651
652    pub fn get_surfing_data(&self) -> PlayerSurfingData {
653        functions::GetPlayerSurfingData(self)
654    }
655
656    /// Check who a player is aiming at.
657    pub fn get_target_player(&self) -> Option<Player> {
658        functions::GetPlayerTargetPlayer(self)
659    }
660
661    /// Gets id of an actor which is aimed by certain player.
662    pub fn get_target_actor(&self) -> Option<Actor> {
663        functions::GetPlayerTargetActor(self)
664    }
665
666    /// Checks if a player is in a specific vehicle.
667    pub fn is_in_vehicle(&self, target_vehicle: &Vehicle) -> bool {
668        functions::IsPlayerInVehicle(self, target_vehicle)
669    }
670
671    /// Check if a player is inside any vehicle (as a driver or passenger).
672    pub fn is_in_any_vehicle(&self) -> bool {
673        functions::IsPlayerInAnyVehicle(self)
674    }
675
676    /// Checks if a player is in range of a point.
677    pub fn is_in_range_of_point(&self, range: f32, coord: Vector3) -> bool {
678        functions::IsPlayerInRangeOfPoint(self, range, coord)
679    }
680
681    /// This function plays a crime report for a player - just like in single-player when CJ commits a crime.
682    pub fn play_crime_report(&self, suspect: &Player, crime: isize) -> bool {
683        functions::PlayCrimeReportForPlayer(self, suspect, crime)
684    }
685
686    /// Remove an attached object from a player.
687    pub fn remove_attached_object(&self, index: isize) {
688        functions::RemovePlayerAttachedObject(self, index)
689    }
690
691    /// Set a player's facing angle (Z rotation).
692    pub fn set_facing_angle(&self, angle: f32) {
693        functions::SetPlayerFacingAngle(self, angle)
694    }
695
696    /// Change the colour of a player's nametag and radar blip for another player.
697    pub fn set_marker_for_player(&self, other: &Player, colour: Colour) {
698        functions::SetPlayerMarkerForPlayer(self, other, colour)
699    }
700
701    /// Get the colour of a player's nametag and radar blip for another player.
702    pub fn get_marker_for_player(&self, other: &Player) -> isize {
703        functions::GetPlayerMarkerForPlayer(self, other)
704    }
705
706    /// Enable/Disable the teleporting ability for a player by right-clicking on the map.
707    pub fn allow_teleport(&self, allow: bool) {
708        functions::AllowPlayerTeleport(self, allow)
709    }
710
711    /// Can this player teleport by right-clicking on the map?
712    pub fn is_teleport_allowed(&self) -> bool {
713        functions::IsPlayerTeleportAllowed(self)
714    }
715
716    pub fn set_remote_vehicle_collisions(&self, collide: bool) {
717        functions::SetRemoteVehicleCollisions(self, collide)
718    }
719
720    /// Display the cursor and allow the player to select a textdraw.
721    pub fn select_text_draw(&self, hover_colour: Colour) {
722        functions::SelectTextDraw(self, hover_colour)
723    }
724
725    /// Cancel textdraw selection with the mouse.
726    pub fn cancel_select_text_draw(&self) {
727        functions::CancelSelectTextDraw(self)
728    }
729
730    /// Perform a memory check on the client.
731    pub fn send_client_check(
732        &self,
733        action_type: isize,
734        address: isize,
735        offset: isize,
736        count: isize,
737    ) {
738        functions::SendClientCheck(self, action_type, address, offset, count)
739    }
740
741    /// (Re)Spawns a player.
742    pub fn spawn(&self) {
743        functions::SpawnPlayer(self)
744    }
745
746    /// Fetch the CI (computer/client identification) of a user, this is linked to their SAMP/GTA on their computer.
747    pub fn gpci(&self) -> String {
748        let mut output = String::new();
749        functions::gpci(self, &mut output);
750        output
751    }
752
753    /// Check if a player is logged in as an RCON admin.
754    pub fn is_admin(&self) -> bool {
755        functions::IsPlayerAdmin(self)
756    }
757    /// Kicks a player from the server. They will have to quit the game and re-connect if they wish to continue playing.
758    pub fn kick(&self) {
759        functions::Kick(self)
760    }
761
762    /// Shows 'game text' (on-screen text) for a certain length of time for a specific player.
763    pub fn game_text(&self, msg: &str, time: isize, style: isize) {
764        functions::GameTextForPlayer(self, msg, time, style)
765    }
766
767    /// Stop showing a gametext style to a player.
768    pub fn hide_game_text(&self, style: isize) {
769        functions::HideGameTextForPlayer(self, style)
770    }
771
772    /// Does the player currently have text in the given gametext style displayed?
773    pub fn has_game_text(&self, style: isize) -> bool {
774        functions::HasGameText(self, style)
775    }
776
777    /// Returns all the information on the given game text style.
778    pub fn get_game_text(
779        &self,
780        style: isize,
781        message: &mut String,
782        time: &mut isize,
783        remaining: &mut isize,
784    ) -> bool {
785        functions::GetGameText(self, style, message, time, remaining)
786    }
787
788    /// Ban a player who is currently in the server.
789    pub fn ban(&self) {
790        functions::Ban(self)
791    }
792
793    /// Ban a player with a reason.
794    pub fn ban_ex(&self, msg: &str) {
795        functions::BanEx(self, msg)
796    }
797
798    /// Adds a death to the 'killfeed' on the right-hand side of the screen for a single player.
799    pub fn send_death_message_to_player(
800        &self,
801        killer: &Player,
802        killee: &Player,
803        weapon: PlayerWeapon,
804    ) {
805        functions::SendDeathMessageToPlayer(self, killer, killee, weapon)
806    }
807
808    /// Sends a message in the name of a player to another player on the server.
809    pub fn send_message_to_player(&self, sender: &Player, message: &str) {
810        functions::SendPlayerMessageToPlayer(self, sender, message)
811    }
812
813    /// Returns the SA-MP client version, as reported by the player.
814    pub fn get_version(&self, output: &mut String) {
815        functions::GetPlayerVersion(self, output)
816    }
817
818    /// Get the player skill level of a certain weapon type.
819    pub fn get_skill_level(&self, skill: isize) -> isize {
820        functions::GetPlayerSkillLevel(self, skill)
821    }
822
823    /// Gets the ID of the player or vehicle the player is spectating (watching).
824    pub fn get_spectate_id(&self) -> isize {
825        functions::GetPlayerSpectateID(self)
826    }
827
828    pub fn get_spectate_data(&self) -> PlayerSpectateData {
829        functions::GetPlayerSpectateData(self)
830    }
831
832    /// Get the specified player's Raw IP address (v4).
833    pub fn get_raw_ip(&self) -> isize {
834        functions::GetPlayerRawIp(self)
835    }
836
837    /// Set a player's gravity.
838    pub fn set_gravity(&self, gravity: f32) {
839        functions::SetPlayerGravity(self, gravity)
840    }
841
842    /// Get a player's gravity.
843    pub fn get_gravity(&self) -> f32 {
844        functions::GetPlayerGravity(self)
845    }
846
847    /// Sets the player as an RCON admin.
848    pub fn set_admin(&self, set: bool) {
849        functions::SetPlayerAdmin(self, set)
850    }
851
852    /// Checks if a player is spawned.
853    pub fn is_spawned(&self) -> bool {
854        functions::IsPlayerSpawned(self)
855    }
856
857    /// Check if the player is controllable.
858    pub fn is_controllable(&self) -> bool {
859        functions::IsPlayerControllable(self)
860    }
861
862    /// Check if the player camera target is enabled.
863    pub fn is_camera_target_enabled(&self) -> bool {
864        functions::IsPlayerCameraTargetEnabled(self)
865    }
866
867    /// Toggle player's ghost mode.
868    pub fn toggle_ghost_mode(&self, toggle: bool) {
869        functions::TogglePlayerGhostMode(self, toggle)
870    }
871
872    /// Get player's ghost mode.
873    pub fn get_ghost_mode(&self) -> bool {
874        functions::GetPlayerGhostMode(self)
875    }
876
877    /// Enable/Disable weapons for a player.
878    pub fn allow_weapons(&self, allow: bool) {
879        functions::AllowPlayerWeapons(self, allow)
880    }
881
882    /// Can the player use weapons?
883    pub fn are_weapons_allowed(&self) -> bool {
884        functions::ArePlayerWeaponsAllowed(self)
885    }
886
887    /// Check if the player is using the official SA-MP client.
888    pub fn is_using_official_client(&self) -> bool {
889        functions::IsPlayerUsingOfficialClient(self)
890    }
891
892    pub fn get_animation_data(&self) -> PlayerAnimationData {
893        functions::GetPlayerAnimationData(self)
894    }
895
896    /// Check if the player is in driveby mode.
897    pub fn is_in_drive_by_mode(&self) -> bool {
898        functions::IsPlayerInDriveByMode(self)
899    }
900
901    /// Checks if the player special action is cuffed.
902    pub fn is_cuffed(&self) -> bool {
903        functions::IsPlayerCuffed(self)
904    }
905
906    /// Returns the class of the players custom skin downloaded from the server.
907    pub fn get_custom_skin(&self) -> isize {
908        functions::GetPlayerCustomSkin(self)
909    }
910
911    /// Redirect a player custom AddCharModel or AddSimpleModel download to a specific HTTP webpage.
912    pub fn redirect_download(&self, url: &str) -> bool {
913        functions::RedirectDownload(self, url)
914    }
915
916    // Player Checkpoints methods
917    /// Sets a checkpoint (red cylinder) for a player.
918    pub fn set_player_checkpoint(&self, centre_position: Vector3, radius: f32) {
919        checkpoints::functions::SetPlayerCheckpoint(self, centre_position, radius);
920    }
921
922    /// Disables (hides/destroys) a player's set checkpoint.
923    pub fn disable_player_checkpoint(&self) {
924        checkpoints::functions::DisablePlayerCheckpoint(self);
925    }
926
927    /// Check if the player is currently inside a checkpoint, this could be used for properties or teleport points for example.
928    pub fn is_player_in_checkpoint(&self) -> bool {
929        checkpoints::functions::IsPlayerInCheckpoint(self)
930    }
931
932    /// Creates a race checkpoint.
933    pub fn set_player_race_checkpoint(
934        &self,
935        race_check_point_type: RaceCheckpointType,
936        centre_position: Vector3,
937        next_position: Vector3,
938        radius: f32,
939    ) {
940        checkpoints::functions::SetPlayerRaceCheckpoint(
941            self,
942            race_check_point_type,
943            centre_position,
944            next_position,
945            radius,
946        )
947    }
948
949    /// Disable any initialized race checkpoints for a specific player, since you can only have one at any given time.
950    pub fn disable_player_race_checkpoint(&self) {
951        checkpoints::functions::DisablePlayerRaceCheckpoint(self)
952    }
953
954    /// Check if the player is inside their current set race checkpoint (SetPlayerRaceCheckpoint).
955    pub fn is_player_in_race_checkpoint(&self) -> bool {
956        checkpoints::functions::IsPlayerInRaceCheckpoint(self)
957    }
958
959    /// Check if the player currently has a checkpoint visible.
960    pub fn is_player_checkpoint_active(&self) -> bool {
961        checkpoints::functions::IsPlayerCheckpointActive(self)
962    }
963
964    /// Get the location of the current checkpoint.
965    pub fn get_player_checkpoint(&self) -> PlayerCheckPointData {
966        let mut center_pos = Vector3::default();
967        let mut radius = 0.0;
968        checkpoints::functions::GetPlayerCheckpoint(self, &mut center_pos, &mut radius);
969        PlayerCheckPointData::new(center_pos, radius)
970    }
971
972    /// Check if the player currently has a race checkpoint visible.
973    pub fn is_player_race_checkpoint_active(&self) -> bool {
974        checkpoints::functions::IsPlayerRaceCheckpointActive(self)
975    }
976
977    /// Get the location of the current race checkpoint.
978    pub fn get_player_race_checkpoint(&self) -> PlayerRaceCheckPointData {
979        let mut center_pos = Vector3::default();
980        let mut next_pos = Vector3::default();
981        let mut radius = 0.0;
982        checkpoints::functions::GetPlayerRaceCheckpoint(
983            self,
984            &mut center_pos,
985            &mut next_pos,
986            &mut radius,
987        );
988        PlayerRaceCheckPointData::new(center_pos, next_pos, radius)
989    }
990
991    /// This function can be used to change the spawn information of a specific player.
992    pub fn set_spawn_info(&self, player_class: PlayerClass) {
993        classes::functions::SetSpawnInfo(self, player_class)
994    }
995
996    /// Return the current spawn data for a player, where they will spawn next.
997    pub fn get_spawn_info(&self) -> PlayerClass {
998        let mut data = PlayerClass::default();
999        classes::functions::GetSpawnInfo(self, &mut data);
1000        data
1001    }
1002
1003    /// Shows the player a synchronous (only one at a time) dialog box.
1004    pub fn show_dialog(
1005        &self,
1006        dialog: i16,
1007        style: DialogStyle,
1008        title: &str,
1009        body: &str,
1010        button1: &str,
1011        button2: &str,
1012    ) {
1013        dialogs::functions::ShowPlayerDialog(self, dialog, style, title, body, button1, button2)
1014    }
1015
1016    /// Get the ID of the dialog currently show to the player.
1017    pub fn get_dialog_id(&self) -> i16 {
1018        dialogs::functions::GetPlayerDialogID(self)
1019    }
1020
1021    /// Hides any dialog the player may currently be able to see.
1022    pub fn hide_dialog(&self) -> bool {
1023        dialogs::functions::HidePlayerDialog(self)
1024    }
1025
1026    pub fn get_id(&self) -> usize {
1027        functions::GetPlayerID(self)
1028    }
1029    pub fn from_id(playerid: isize) -> Option<Player> {
1030        functions::GetPlayerFromID(playerid)
1031    }
1032    /// Gets the ID of the menu the player is currently viewing (shown by ShowMenuForPlayer).
1033    pub fn get_menu(&self) -> Option<Menu> {
1034        menus::functions::GetPlayerMenu(self)
1035    }
1036
1037    /// Allows a player to edit an object (position and rotation) using their mouse on a GUI (Graphical User Interface).
1038    pub fn edit_object(&self, object: &Object) {
1039        objects::functions::EditObject(self, object)
1040    }
1041    /// Display the cursor and allow the player to select an object.
1042    pub fn select_object(&self) {
1043        objects::functions::SelectObject(self)
1044    }
1045    /// Cancel object edition mode for a player.
1046    pub fn end_object_editing(&self) {
1047        objects::functions::EndObjectEditing(self)
1048    }
1049    /// Creates an object which will be visible to only one player.
1050    pub fn create_player_object(
1051        &self,
1052        modelid: isize,
1053        position: Vector3,
1054        rotation: Vector3,
1055        drawDistance: f32,
1056    ) -> Option<PlayerObject> {
1057        objects::functions::CreatePlayerObject(self, modelid, position, rotation, drawDistance)
1058    }
1059    /// Destroy a player-object created using CreatePlayerObject.
1060    pub fn destroy_player_object(&self, object: PlayerObject) {
1061        objects::functions::DestroyPlayerObject(self, &object);
1062    }
1063    /// Allows players to edit a player-object (position and rotation) with a GUI and their mouse.
1064    pub fn edit_player_object(&self, object: &PlayerObject) {
1065        objects::functions::EditPlayerObject(self, object)
1066    }
1067
1068    /// Get PlayerObject from an id
1069    pub fn get_player_object_from_id(&self, id: isize) -> Option<PlayerObject> {
1070        objects::functions::GetPlayerObjectFromID(self, id)
1071    }
1072
1073    /// Creates a textdraw for a single player.
1074    pub fn create_player_text_draw(&self, position: Vector2, text: &str) -> Option<PlayerTextDraw> {
1075        textdraws::functions::CreatePlayerTextDraw(self, position, text)
1076    }
1077    /// Destroy a player-textdraw.
1078    pub fn player_text_draw_destroy(&self, textdraw: &PlayerTextDraw) {
1079        textdraws::functions::PlayerTextDrawDestroy(self, textdraw)
1080    }
1081
1082    pub fn create_player_text_label_on_player(
1083        &self,
1084        attachedPlayer: &Player,
1085        text: &str,
1086        colour: Colour,
1087        position: Vector3,
1088        drawDistance: f32,
1089        los: bool,
1090    ) -> Option<PlayerTextLabel> {
1091        textlabels::functions::CreatePlayer3DTextLabelOnPlayer(
1092            self,
1093            attachedPlayer,
1094            text,
1095            colour,
1096            position,
1097            drawDistance,
1098            los,
1099        )
1100    }
1101    pub fn create_player_text_label_on_vehicle(
1102        &self,
1103        attachedVehicle: &Vehicle,
1104        text: &str,
1105        colour: Colour,
1106        position: Vector3,
1107        drawDistance: f32,
1108        los: bool,
1109    ) -> Option<PlayerTextLabel> {
1110        textlabels::functions::CreatePlayer3DTextLabelOnVehicle(
1111            self,
1112            attachedVehicle,
1113            text,
1114            colour,
1115            position,
1116            drawDistance,
1117            los,
1118        )
1119    }
1120    /// Creates a 3D Text Label only for a specific player.
1121    pub fn create_player_text_label(
1122        &self,
1123        text: &str,
1124        colour: Colour,
1125        position: Vector3,
1126        drawDistance: f32,
1127        los: bool,
1128    ) -> Option<PlayerTextLabel> {
1129        textlabels::functions::CreatePlayer3DTextLabel(
1130            self,
1131            text,
1132            colour,
1133            position,
1134            drawDistance,
1135            los,
1136        )
1137    }
1138    /// Destroy a 3D text label that was created using CreatePlayer3DTextLabel.
1139    pub fn delete_player_text_label(&self, textlabel: PlayerTextLabel) {
1140        textlabels::functions::DeletePlayer3DTextLabel(self, &textlabel)
1141    }
1142
1143    /// Check if the player is in the mod shop.
1144    pub fn is_player_in_mod_shop(&self) -> bool {
1145        vehicles::functions::IsPlayerInModShop(self)
1146    }
1147    /// Gets the siren state of the player's vehicle.
1148    pub fn get_player_siren_state(&self) -> isize {
1149        vehicles::functions::GetPlayerSirenState(self)
1150    }
1151    /// Gets the landing gear state of the current player's vehicle.
1152    pub fn get_player_landing_gear_state(&self) -> isize {
1153        vehicles::functions::GetPlayerLandingGearState(self)
1154    }
1155    /// Gets the hydra reactor angle of the player's vehicle.
1156    pub fn get_player_hydra_reactor_angle(&self) -> isize {
1157        vehicles::functions::GetPlayerHydraReactorAngle(self)
1158    }
1159    /// Gets the speed of the player's train.
1160    pub fn get_player_train_speed(&self) -> f32 {
1161        vehicles::functions::GetPlayerTrainSpeed(self)
1162    }
1163
1164    /// Get a player's network stats.
1165    pub fn get_net_stats(&self) -> NetworkStats {
1166        functions::GetPlayerNetworkStats(self)
1167    }
1168
1169    /// Get a player's IP and port.
1170    pub fn net_stats_get_ip_port(&self) -> NetworkID {
1171        functions::NetStats_GetIpPort(self)
1172    }
1173
1174    /// Sends a message in the name of a player to all other players on the server.
1175    pub fn send_message_to_all(&self, message: &str) {
1176        functions::SendPlayerMessageToAll(self, message)
1177    }
1178
1179    /// Attach an object to a specific bone on a player.
1180    pub fn set_attached_object(&self, index: isize, attachment: ObjectAttachmentSlotData) {
1181        functions::SetPlayerAttachedObject(self, index, attachment)
1182    }
1183    /// Gets the player attachment object data by index.
1184    pub fn get_attached_object(&self, index: isize) -> ObjectAttachmentSlotData {
1185        functions::GetPlayerAttachedObject(self, index)
1186    }
1187}
1188
1189/// Map Icon Styles
1190#[repr(C)]
1191#[derive(PartialEq, Clone, Copy, Debug)]
1192pub enum MapIconStyle {
1193    Local,
1194    Global,
1195    LocalCheckpoint,
1196    GlobalCheckpoint,
1197}
1198
1199/// Client Versions
1200#[repr(u8)]
1201#[derive(PartialEq, Clone, Copy, Debug)]
1202pub enum ClientVersion {
1203    Samp037,
1204    Samp03dl,
1205    Openmp,
1206}
1207
1208/// Camera Cut Types
1209#[repr(C)]
1210#[derive(PartialEq, Clone, Copy, Debug)]
1211pub enum PlayerCameraCutType {
1212    Cut,
1213    Move,
1214}
1215
1216/// The player's name status returned when updating their name
1217#[repr(C)]
1218#[derive(PartialEq, Clone, Copy, Debug)]
1219pub enum PlayerNameStatus {
1220    /// The name has successfully been updated
1221    Updated,
1222    /// The name is already taken by another player
1223    Taken,
1224    /// The name is invalid
1225    Invalid,
1226}
1227
1228/// Animation sync type
1229#[repr(C)]
1230#[derive(PartialEq, Clone, Copy, Debug)]
1231pub enum PlayerAnimationSyncType {
1232    /// No sync
1233    NoSync,
1234    // Make server sync the animation with all other players in streaming radius
1235    Sync,
1236    /// works same as Sync, but will ONLY apply the animation to streamed-in players, but NOT the actual player being animated (useful for npc animations and persistent animations when players are being streamed)
1237    SyncOthers,
1238}
1239
1240/// Weapon Information
1241#[repr(C)]
1242#[derive(Default, Clone, Copy, Debug)]
1243pub struct WeaponSlotData {
1244    /// weapon id
1245    pub id: PlayerWeapon,
1246    /// amount of ammunition
1247    pub ammo: u32,
1248}
1249
1250impl WeaponSlotData {
1251    pub fn new(id: PlayerWeapon, ammo: u32) -> Self {
1252        Self { id, ammo }
1253    }
1254}
1255
1256/// Animation Data Of Player
1257#[repr(C)]
1258#[derive(PartialEq, Clone, Copy, Debug)]
1259pub struct PlayerAnimationData {
1260    pub id: u16,
1261    /// Animation flags
1262    /// FREEZE_FLAG -> 0b0000000000000100
1263    /// LOCK_X_FLAG -> 0b0010000000000
1264    /// LOCK_Y_FLAG -> 0b0001000000000
1265    /// LOOP_FLAG -> 0b0000100000000
1266    pub flags: u16,
1267}
1268
1269/// Player's Fighting Style
1270#[repr(C)]
1271#[derive(PartialEq, Clone, Copy, Debug)]
1272pub enum PlayerFightingStyle {
1273    Normal = 4,
1274    Boxing = 5,
1275    KungFu = 6,
1276    KneeHead = 7,
1277    GrabKick = 15,
1278    Elbow = 16,
1279}
1280
1281/// State of the player
1282#[repr(C)]
1283#[derive(PartialEq, Clone, Copy, Debug)]
1284pub enum PlayerState {
1285    None = 0,
1286    OnFoot = 1,
1287    Driver = 2,
1288    Passenger = 3,
1289    ExitVehicle = 4,
1290    EnterVehicleDriver = 5,
1291    EnterVehiclePassenger = 6,
1292    Wasted = 7,
1293    Spawned = 8,
1294    Spectating = 9,
1295}
1296
1297/// a list of valid weapon skill types used by set_skill_level and get_skill_level methods
1298#[repr(C)]
1299#[derive(PartialEq, Clone, Copy, Debug)]
1300pub enum PlayerWeaponSkill {
1301    Pistol,
1302    SilencedPistol,
1303    DesertEagle,
1304    Shotgun,
1305    SawnOff,
1306    Spas12,
1307    Uzi,
1308    Mp5,
1309    Ak47,
1310    M4,
1311    Sniper,
1312}
1313
1314/// list of all the player special actions
1315#[repr(C)]
1316#[derive(PartialEq, Clone, Copy, Debug)]
1317pub enum PlayerSpecialAction {
1318    /// Clears player of special actions
1319    None,
1320    /// Detect if the player is crouching.
1321    Duck,
1322    /// Will make the player using jetpack
1323    Jetpack,
1324    /// Detect if the player is entering a vehicle via an animation.
1325    EnterVehicle,
1326    /// Detect if the player is exiting a vehicle via an animation.
1327    ExitVehicle,
1328    /// Applies dancing animation for player
1329    Dance1,
1330    /// Applies dancing animation for player
1331    Dance2,
1332    /// Applies dancing animation for player
1333    Dance3,
1334    /// Applies dancing animation for player
1335    Dance4,
1336    /// Will make the player put hands up
1337    HandsUp = 10,
1338    /// Will make the player speaking on cellphone
1339    Cellphone,
1340    /// Detects if the player is sitting
1341    Sitting,
1342    /// Makes players stop using cellphone
1343    StopCellphone,
1344    /// Will increase the player's drunk level when used
1345    Beer = 20,
1346    /// Will give the player a cigar.
1347    Smoke,
1348    /// Will give the player a wine bottle to get drunk from
1349    Wine,
1350    /// Will give the player a sprunk bottle to drink from
1351    Sprunk,
1352    /// Will force the player in to cuffs (hands are behind their back) (does not work on CJ skin).
1353    Cuffed,
1354    /// Will apply a 'carrying' animation to the player and make them unable to sprint, jump or punch (does not work on CJ skin).
1355    Carry,
1356    /// Will make the player perform the pissing animation with visible pee
1357    Pissing = 68,
1358}
1359
1360/// Player surfing information
1361#[repr(C)]
1362#[derive(PartialEq, Clone, Copy, Debug)]
1363pub struct PlayerSurfingData {
1364    pub surftype: isize,
1365    pub id: isize,
1366    pub offset: Vector3,
1367}
1368
1369#[repr(C)]
1370#[derive(PartialEq, Clone, Copy, Debug)]
1371pub struct PlayerKeyData {
1372    pub keys: u32,
1373    pub upDown: i16,
1374    pub leftRight: i16,
1375}
1376
1377#[repr(C)]
1378#[derive(PartialEq, Clone, Copy, Debug)]
1379pub struct PlayerBulletData {
1380    pub origin: Vector3,
1381    pub hitPos: Vector3,
1382    pub offset: Vector3,
1383    pub weapon: PlayerWeapon,
1384    pub hitType: PlayerBulletHitType,
1385    pub hitID: u16,
1386}
1387#[repr(C)]
1388#[derive(PartialEq, Clone, Copy, Debug)]
1389pub enum PlayerBulletHitType {
1390    None,
1391    Player = 1,
1392    Vehicle = 2,
1393    Object = 3,
1394    PlayerObject = 4,
1395}
1396
1397#[repr(C)]
1398#[derive(PartialEq, Clone, Copy, Debug)]
1399pub enum SpectateType {
1400    None,
1401    Vehicle,
1402    Player,
1403}
1404
1405#[repr(C)]
1406#[derive(PartialEq, Clone, Copy, Debug)]
1407pub struct PlayerSpectateData {
1408    pub spectating: bool,
1409    pub spectateID: isize,
1410    pub spectate_type: SpectateType,
1411}
1412
1413#[repr(C)]
1414#[derive(PartialEq, Clone, Copy, Debug)]
1415pub enum PlayerSpectateMode {
1416    Normal = 1,
1417    Fixed,
1418    Side,
1419}
1420
1421#[repr(C)]
1422#[derive(PartialEq, Clone, Copy, Debug)]
1423pub struct PlayerAimData {
1424    pub camFrontVector: Vector3,
1425    pub camPos: Vector3,
1426    pub aimZ: f32,
1427    pub camZoom: f32,
1428    pub aspectRatio: f32,
1429    pub weaponState: PlayerWeaponState,
1430    pub camMode: u8,
1431}
1432
1433#[repr(C)]
1434#[derive(PartialEq, Clone, Copy, Debug)]
1435pub enum PlayerWeaponState {
1436    Unknown = -1,
1437    NoBullets,
1438    LastBullet,
1439    MoreBullets,
1440    Reloading,
1441}
1442
1443#[repr(C)]
1444#[derive(PartialEq, Clone, Copy, Debug)]
1445pub enum BodyPart {
1446    Torso = 3,
1447    Groin,
1448    LeftArm,
1449    RightArm,
1450    LeftLeg,
1451    RightLeg,
1452    Head,
1453}
1454
1455#[repr(C)]
1456#[derive(PartialEq, Clone, Copy, Debug)]
1457pub enum PlayerClickSource {
1458    Scoreboard,
1459}
1460
1461pub type WeaponSlots = StaticArray<WeaponSlotData, 13>;
1462
1463#[repr(u8)]
1464#[derive(PartialEq, Copy, Clone, Default, Debug)]
1465pub enum PlayerWeapon {
1466    #[default]
1467    Fist,
1468    BrassKnuckle,
1469    GolfClub,
1470    NiteStick,
1471    Knife,
1472    Bat,
1473    Shovel,
1474    PoolStick,
1475    Katana,
1476    Chainsaw,
1477    Dildo,
1478    Dildo2,
1479    Vibrator,
1480    Vibrator2,
1481    Flower,
1482    Cane,
1483    Grenade,
1484    Teargas,
1485    Moltov,
1486    Colt45 = 22,
1487    Silenced,
1488    Deagle,
1489    Shotgun,
1490    Sawedoff,
1491    Shotgspa,
1492    UZI,
1493    MP5,
1494    AK47,
1495    M4,
1496    TEC9,
1497    Rifle,
1498    Sniper,
1499    RocketLauncher,
1500    HeatSeeker,
1501    FlameThrower,
1502    Minigun,
1503    Satchel,
1504    Bomb,
1505    SprayCan,
1506    FireExtinguisher,
1507    Camera,
1508    NightVisGoggles,
1509    ThermalGoggles,
1510    Parachute,
1511    Vehicle = 49,
1512    Heliblades,
1513    Explosion,
1514    Drown = 53,
1515    Collision,
1516    End,
1517    Connect = 200,
1518    Disconnect,
1519    Suicide = 255,
1520}
1521
1522/// Player Keys
1523pub mod PlayerKeys {
1524    pub const ACTION: u32 = 1;
1525    pub const CROUCH: u32 = 2;
1526    pub const FIRE: u32 = 4;
1527    pub const SPRINT: u32 = 8;
1528    pub const SECONDARY_ATTACK: u32 = 16;
1529    pub const JUMP: u32 = 32;
1530    pub const LOOK_RIGHT: u32 = 64;
1531    pub const HANDBRAKE: u32 = 128;
1532    pub const LOOK_LEFT: u32 = 256;
1533    pub const SUBMISSION: u32 = 512;
1534    pub const LOOK_BEHIND: u32 = 512;
1535    pub const WALK: u32 = 1024;
1536    pub const ANALOG_UP: u32 = 2048;
1537    pub const ANALOG_DOWN: u32 = 4096;
1538    pub const ANALOG_LEFT: u32 = 8192;
1539    pub const ANALOG_RIGHT: u32 = 16384;
1540    pub const YES: u32 = 65536;
1541    pub const NO: u32 = 131072;
1542    pub const CTRL_BACK: u32 = 262144;
1543    pub const UP: isize = -128;
1544    pub const DOWN: isize = 128;
1545    pub const LEFT: isize = -128;
1546    pub const RIGHT: isize = 128;
1547}