samp_sdk/omp/generated/handlers.rs
1//! Event handlers of the groups the SDK does not write by hand — generated
2//! by `cargo xtask gen-omp` from the open.mp headers. Do not edit.
3//!
4//! Each handler's vtable follows its C++ declaration order, which is the
5//! slot order on both ABIs: none of these declares a destructor or an
6//! overload. `DEFAULT` does what each C++ body does. Narrow integer
7//! arguments arrive as a whole word; the value is its low bits.
8
9#![allow(unused_imports)]
10
11use crate::omp::containers::{FlatSet, HybridString, Pair, Span};
12use crate::omp::dispatch::event_handler;
13use crate::omp::types::{
14 Colour, GTAQuat, Hours, Microseconds, Milliseconds, Minutes, Seconds, StringView, TimePoint,
15 Vector2, Vector3, Vector4,
16};
17use crate::omp::*;
18
19event_handler! {
20 /// `ActorEventHandler` in `Server/Components/Actors/actors.hpp`.
21 ActorHandlerVTable for ActorHandler {
22 /// `void onPlayerGiveDamageActor(IPlayer &, IActor &, float, unsigned int, BodyPart)`.
23 on_player_give_damage_actor: fn(*mut IPlayer, *mut IActor, f32, u32, i32) = (),
24 /// `void onActorStreamOut(IActor &, IPlayer &)`.
25 on_actor_stream_out: fn(*mut IActor, *mut IPlayer) = (),
26 /// `void onActorStreamIn(IActor &, IPlayer &)`.
27 on_actor_stream_in: fn(*mut IActor, *mut IPlayer) = (),
28 }
29}
30
31event_handler! {
32 /// `ClassEventHandler` in `Server/Components/Classes/classes.hpp`.
33 ClassHandlerVTable for ClassHandler {
34 /// `bool onPlayerRequestClass(IPlayer &, unsigned int)`.
35 on_player_request_class: fn(*mut IPlayer, u32) -> bool = true,
36 }
37}
38
39event_handler! {
40 /// `ConsoleEventHandler` in `Server/Components/Console/console.hpp`.
41 ConsoleHandlerVTable for ConsoleHandler {
42 /// `bool onConsoleText(StringView, StringView, const ConsoleCommandSenderData &)`.
43 on_console_text: fn(StringView, StringView, *const ConsoleCommandSenderData) -> bool = false,
44 /// `void onRconLoginAttempt(IPlayer &, StringView, bool)`.
45 on_rcon_login_attempt: fn(*mut IPlayer, StringView, u32) = (),
46 /// `void onConsoleCommandListRequest(FlatHashSet<StringView> &)`.
47 on_console_command_list_request: fn(*mut std::ffi::c_void) = (),
48 }
49}
50
51event_handler! {
52 /// `CoreEventHandler` in `core.hpp`.
53 CoreHandlerVTable for CoreHandler {
54 /// `void onTick(Microseconds, TimePoint)`.
55 on_tick: fn(Microseconds, TimePoint),
56 }
57}
58
59event_handler! {
60 /// `GangZoneEventHandler` in `Server/Components/GangZones/gangzones.hpp`.
61 GangZoneHandlerVTable for GangZoneHandler {
62 /// `void onPlayerEnterGangZone(IPlayer &, IGangZone &)`.
63 on_player_enter_gang_zone: fn(*mut IPlayer, *mut IGangZone) = (),
64 /// `void onPlayerLeaveGangZone(IPlayer &, IGangZone &)`.
65 on_player_leave_gang_zone: fn(*mut IPlayer, *mut IGangZone) = (),
66 /// `void onPlayerClickGangZone(IPlayer &, IGangZone &)`.
67 on_player_click_gang_zone: fn(*mut IPlayer, *mut IGangZone) = (),
68 }
69}
70
71event_handler! {
72 /// `HTTPResponseHandler` in `core.hpp`.
73 HTTPResponseHandlerVTable for HTTPResponseHandler {
74 /// `void onHTTPResponse(int, StringView)`.
75 on_http_response: fn(i32, StringView),
76 }
77}
78
79event_handler! {
80 /// `MenuEventHandler` in `Server/Components/Menus/menus.hpp`.
81 MenuHandlerVTable for MenuHandler {
82 /// `void onPlayerSelectedMenuRow(IPlayer &, MenuRow)`.
83 on_player_selected_menu_row: fn(*mut IPlayer, u32) = (),
84 /// `void onPlayerExitedMenu(IPlayer &)`.
85 on_player_exited_menu: fn(*mut IPlayer) = (),
86 }
87}
88
89event_handler! {
90 /// `NPCEventHandler` in `Server/Components/NPCs/npcs.hpp`.
91 NPCHandlerVTable for NPCHandler {
92 /// `void onNPCFinishMove(INPC &)`.
93 on_npc_finish_move: fn(*mut INPC) = (),
94 /// `void onNPCCreate(INPC &)`.
95 on_npc_create: fn(*mut INPC) = (),
96 /// `void onNPCDestroy(INPC &)`.
97 on_npc_destroy: fn(*mut INPC) = (),
98 /// `void onNPCSpawn(INPC &)`.
99 on_npc_spawn: fn(*mut INPC) = (),
100 /// `void onNPCRespawn(INPC &)`.
101 on_npc_respawn: fn(*mut INPC) = (),
102 /// `void onNPCWeaponStateChange(INPC &, PlayerWeaponState, PlayerWeaponState)`.
103 on_npc_weapon_state_change: fn(*mut INPC, i32, i32) = (),
104 /// `bool onNPCTakeDamage(INPC &, IPlayer &, float, uint8_t, BodyPart)`.
105 on_npc_take_damage: fn(*mut INPC, *mut IPlayer, f32, u32, i32) -> bool = true,
106 /// `bool onNPCGiveDamage(INPC &, IPlayer &, float, uint8_t, BodyPart)`.
107 on_npc_give_damage: fn(*mut INPC, *mut IPlayer, f32, u32, i32) -> bool = true,
108 /// `void onNPCDeath(INPC &, IPlayer *, int)`.
109 on_npc_death: fn(*mut INPC, *mut IPlayer, i32) = (),
110 /// `bool onNPCShotMissed(INPC &, const PlayerBulletData &)`.
111 on_npc_shot_missed: fn(*mut INPC, *const PlayerBulletData) -> bool = true,
112 /// `bool onNPCShotPlayer(INPC &, IPlayer &, const PlayerBulletData &)`.
113 on_npc_shot_player: fn(*mut INPC, *mut IPlayer, *const PlayerBulletData) -> bool = true,
114 /// `bool onNPCShotNPC(INPC &, INPC &, const PlayerBulletData &)`.
115 on_npc_shot_npc: fn(*mut INPC, *mut INPC, *const PlayerBulletData) -> bool = true,
116 /// `bool onNPCShotVehicle(INPC &, IVehicle &, const PlayerBulletData &)`.
117 on_npc_shot_vehicle: fn(*mut INPC, *mut IVehicle, *const PlayerBulletData) -> bool = true,
118 /// `bool onNPCShotObject(INPC &, IObject &, const PlayerBulletData &)`.
119 on_npc_shot_object: fn(*mut INPC, *mut IObject, *const PlayerBulletData) -> bool = true,
120 /// `bool onNPCShotPlayerObject(INPC &, IPlayerObject &, const PlayerBulletData &)`.
121 on_npc_shot_player_object: fn(*mut INPC, *mut IPlayerObject, *const PlayerBulletData) -> bool = true,
122 /// `void onNPCPlaybackStart(INPC &, int)`.
123 on_npc_playback_start: fn(*mut INPC, i32) = (),
124 /// `void onNPCPlaybackEnd(INPC &, int)`.
125 on_npc_playback_end: fn(*mut INPC, i32) = (),
126 /// `void onNPCFinishNodePoint(INPC &, int, uint16_t)`.
127 on_npc_finish_node_point: fn(*mut INPC, i32, u32) = (),
128 /// `void onNPCFinishNode(INPC &, int)`.
129 on_npc_finish_node: fn(*mut INPC, i32) = (),
130 /// `bool onNPCChangeNode(INPC &, int, int)`.
131 on_npc_change_node: fn(*mut INPC, i32, i32) -> bool = true,
132 /// `void onNPCFinishMovePathPoint(INPC &, int, int)`.
133 on_npc_finish_move_path_point: fn(*mut INPC, i32, i32) = (),
134 /// `void onNPCFinishMovePath(INPC &, int)`.
135 on_npc_finish_move_path: fn(*mut INPC, i32) = (),
136 }
137}
138
139event_handler! {
140 /// `ObjectEventHandler` in `Server/Components/Objects/objects.hpp`.
141 ObjectHandlerVTable for ObjectHandler {
142 /// `void onMoved(IObject &)`.
143 on_moved: fn(*mut IObject) = (),
144 /// `void onPlayerObjectMoved(IPlayer &, IPlayerObject &)`.
145 on_player_object_moved: fn(*mut IPlayer, *mut IPlayerObject) = (),
146 /// `void onObjectSelected(IPlayer &, IObject &, int, Vector3)`.
147 on_object_selected: fn(*mut IPlayer, *mut IObject, i32, Vector3) = (),
148 /// `void onPlayerObjectSelected(IPlayer &, IPlayerObject &, int, Vector3)`.
149 on_player_object_selected: fn(*mut IPlayer, *mut IPlayerObject, i32, Vector3) = (),
150 /// `void onObjectEdited(IPlayer &, IObject &, ObjectEditResponse, Vector3, Vector3)`.
151 on_object_edited: fn(*mut IPlayer, *mut IObject, i32, Vector3, Vector3) = (),
152 /// `void onPlayerObjectEdited(IPlayer &, IPlayerObject &, ObjectEditResponse, Vector3, Vector3)`.
153 on_player_object_edited: fn(*mut IPlayer, *mut IPlayerObject, i32, Vector3, Vector3) = (),
154 /// `void onPlayerAttachedObjectEdited(IPlayer &, int, bool, const ObjectAttachmentSlotData &)`.
155 on_player_attached_object_edited: fn(*mut IPlayer, i32, u32, *const ObjectAttachmentSlotData) = (),
156 }
157}
158
159event_handler! {
160 /// `OptionEnumeratorCallback` in `core.hpp`.
161 OptionEnumeratorCallbackVTable for OptionEnumeratorCallback {
162 /// `bool proc(StringView, ConfigOptionType)`.
163 proc: fn(StringView, i32) -> bool,
164 }
165}
166
167event_handler! {
168 /// `PickupEventHandler` in `Server/Components/Pickups/pickups.hpp`.
169 PickupHandlerVTable for PickupHandler {
170 /// `void onPlayerPickUpPickup(IPlayer &, IPickup &)`.
171 on_player_pick_up_pickup: fn(*mut IPlayer, *mut IPickup) = (),
172 }
173}
174
175event_handler! {
176 /// `PlayerCheckpointEventHandler` in `Server/Components/Checkpoints/checkpoints.hpp`.
177 PlayerCheckpointHandlerVTable for PlayerCheckpointHandler {
178 /// `void onPlayerEnterCheckpoint(IPlayer &)`.
179 on_player_enter_checkpoint: fn(*mut IPlayer) = (),
180 /// `void onPlayerLeaveCheckpoint(IPlayer &)`.
181 on_player_leave_checkpoint: fn(*mut IPlayer) = (),
182 /// `void onPlayerEnterRaceCheckpoint(IPlayer &)`.
183 on_player_enter_race_checkpoint: fn(*mut IPlayer) = (),
184 /// `void onPlayerLeaveRaceCheckpoint(IPlayer &)`.
185 on_player_leave_race_checkpoint: fn(*mut IPlayer) = (),
186 }
187}
188
189event_handler! {
190 /// `PlayerDialogEventHandler` in `Server/Components/Dialogs/dialogs.hpp`.
191 PlayerDialogHandlerVTable for PlayerDialogHandler {
192 /// `void onDialogResponse(IPlayer &, int, DialogResponse, int, StringView)`.
193 on_dialog_response: fn(*mut IPlayer, i32, i32, i32, StringView) = (),
194 }
195}
196
197event_handler! {
198 /// `PlayerModelsEventHandler` in `Server/Components/CustomModels/custommodels.hpp`.
199 PlayerModelsHandlerVTable for PlayerModelsHandler {
200 /// `void onPlayerFinishedDownloading(IPlayer &)`.
201 on_player_finished_downloading: fn(*mut IPlayer) = (),
202 /// `bool onPlayerRequestDownload(IPlayer &, ModelDownloadType, uint32_t)`.
203 on_player_request_download: fn(*mut IPlayer, u32, u32) -> bool = true,
204 }
205}
206
207event_handler! {
208 /// `PoolEventHandler<IPlayer>` in `pool.hpp`.
209 PlayerPoolHandlerVTable for PlayerPoolHandler {
210 /// `void onPoolEntryCreated(IPlayer &)`.
211 on_pool_entry_created: fn(*mut IPlayer) = (),
212 /// `void onPoolEntryDestroyed(IPlayer &)`.
213 on_pool_entry_destroyed: fn(*mut IPlayer) = (),
214 }
215}
216
217event_handler! {
218 /// `TextDrawEventHandler` in `Server/Components/TextDraws/textdraws.hpp`.
219 TextDrawHandlerVTable for TextDrawHandler {
220 /// `void onPlayerClickTextDraw(IPlayer &, ITextDraw &)`.
221 on_player_click_text_draw: fn(*mut IPlayer, *mut ITextDraw) = (),
222 /// `void onPlayerClickPlayerTextDraw(IPlayer &, IPlayerTextDraw &)`.
223 on_player_click_player_text_draw: fn(*mut IPlayer, *mut IPlayerTextDraw) = (),
224 /// `bool onPlayerCancelTextDrawSelection(IPlayer &)`.
225 on_player_cancel_text_draw_selection: fn(*mut IPlayer) -> bool = false,
226 /// `bool onPlayerCancelPlayerTextDrawSelection(IPlayer &)`.
227 on_player_cancel_player_text_draw_selection: fn(*mut IPlayer) -> bool = false,
228 }
229}