omp_gdk/scripting/core/
functions.rs

1use omp_codegen::native;
2
3use crate::types::network::NetworkStats;
4use crate::types::vector::Vector3;
5
6native!(Print,message: str);
7native!(GetTickCount, -> isize);
8native!(GetMaxPlayers, -> isize);
9native!(VectorSize, vector: Vector3, -> f32);
10native!(GetPlayerPoolSize, -> isize);
11native!(GetVehiclePoolSize, -> isize);
12native!(GetActorPoolSize, -> isize);
13native!(IsAdminTeleportAllowed, -> bool);
14native!(AllowAdminTeleport, allow: bool, -> bool);
15native!(AreAllAnimationsEnabled, -> bool);
16native!(EnableAllAnimations, allow: bool, -> bool);
17native!(IsValidAnimationLibrary, name: str, -> bool);
18native!(AreInteriorWeaponsAllowed, -> bool);
19native!(AllowInteriorWeapons, allow: bool, -> bool);
20native!(BlockIpAddress, ipAddress: str, timeMS: isize, -> bool);
21native!(UnBlockIpAddress, ipAddress: str, -> bool);
22native!(ConnectNPC, name: str, script: str, -> bool);
23native!(DisableInteriorEnterExits, -> bool);
24native!(DisableNameTagLOS, -> bool);
25native!(EnableTirePopping, enable: bool, -> bool);
26native!(EnableZoneNames, enable: bool, -> bool);
27native!(GameTextForAll, msg: str, time: isize, style: isize);
28native!(HideGameTextForAll, style: isize);
29native!(GetConsoleVarAsBool, cvar: str, -> bool);
30native!(GetConsoleVarAsInt, cvar: str, -> isize);
31native!(GetConsoleVarAsFloat, cvar: str, -> f32);
32native!(GetConsoleVarAsString, cvar: str, buffer: mut str, -> isize);
33native!(GetNetworkStats, -> NetworkStats);
34native!(GetServerTickRate, -> isize);
35native!(GetServerVarAsBool, cvar: str, -> bool);
36native!(GetServerVarAsInt, cvar: str, -> isize);
37native!(GetServerVarAsFloat, cvar: str, -> f32);
38native!(GetServerVarAsString, cvar: str, buffer: mut str, -> isize);
39native!(GetWeaponName, weaponid: isize, weapon: mut str);
40native!(LimitGlobalChatRadius, chatRadius: f32);
41native!(LimitPlayerMarkerRadius, markerRadius: f32);
42native!(SendRconCommand, command: str);
43native!(SetDeathDropAmount, amount: isize);
44native!(SetGameModeText, string: str);
45native!(SetGravity, gravity: f32);
46native!(GetGravity, -> f32);
47native!(SetNameTagDrawDistance, distance: f32);
48native!(SetWeather, weatherid: isize);
49native!(SetWorldTime, hour: isize);
50native!(ShowNameTags, show: bool);
51native!(ShowPlayerMarkers, mode: isize);
52native!(UsePlayerPedAnims);
53native!(GetWeather, -> isize);
54native!(GetWorldTime, -> isize);
55native!(ToggleChatTextReplacement, enable: bool);
56native!(ChatTextReplacementToggled, -> bool);
57native!(IsValidNickName, name: str, -> bool);
58native!(AllowNickNameCharacter, character: isize, allow: bool);
59native!(IsNickNameCharacterAllowed, char:char, -> bool);
60native!(ClearBanList);
61native!(IsBanned, ip: str, -> bool);
62native!(GetWeaponSlot, weapon: u8, -> isize);
63native!(AddServerRule, name: str, value: str);
64native!(SetServerRule, name: str, value: str);
65native!(IsValidServerRule, name: str, -> bool);
66native!(RemoveServerRule, name: str);
67native!(GetAnimationName, index: isize, lib: mut str, name: mut str);
68native!(EnableStuntBonusForAll, enable: bool);
69native!(CreateExplosion, pos: Vector3, explosion_type: isize, radius: f32);
70
71#[doc(hidden)]
72pub fn load_functions() {
73    load_function!(Print);
74    load_function!(GetTickCount);
75    load_function!(GetMaxPlayers);
76    load_function!(VectorSize);
77    load_function!(GetPlayerPoolSize);
78    load_function!(GetVehiclePoolSize);
79    load_function!(GetActorPoolSize);
80    load_function!(IsAdminTeleportAllowed);
81    load_function!(AllowAdminTeleport);
82    load_function!(AreAllAnimationsEnabled);
83    load_function!(EnableAllAnimations);
84    load_function!(IsValidAnimationLibrary);
85    load_function!(AreInteriorWeaponsAllowed);
86    load_function!(AllowInteriorWeapons);
87    load_function!(BlockIpAddress);
88    load_function!(UnBlockIpAddress);
89    load_function!(ConnectNPC);
90    load_function!(DisableInteriorEnterExits);
91    load_function!(DisableNameTagLOS);
92    load_function!(EnableTirePopping);
93    load_function!(EnableZoneNames);
94    load_function!(GameTextForAll);
95    load_function!(HideGameTextForAll);
96    load_function!(GetConsoleVarAsBool);
97    load_function!(GetConsoleVarAsInt);
98    load_function!(GetConsoleVarAsFloat);
99    load_function!(GetConsoleVarAsString);
100    load_function!(GetNetworkStats);
101    load_function!(GetServerTickRate);
102    load_function!(GetServerVarAsBool);
103    load_function!(GetServerVarAsInt);
104    load_function!(GetServerVarAsFloat);
105    load_function!(GetServerVarAsString);
106    load_function!(GetWeaponName);
107    load_function!(LimitGlobalChatRadius);
108    load_function!(LimitPlayerMarkerRadius);
109    load_function!(SendRconCommand);
110    load_function!(SetDeathDropAmount);
111    load_function!(SetGameModeText);
112    load_function!(SetGravity);
113    load_function!(GetGravity);
114    load_function!(SetNameTagDrawDistance);
115    load_function!(SetWeather);
116    load_function!(SetWorldTime);
117    load_function!(ShowNameTags);
118    load_function!(ShowPlayerMarkers);
119    load_function!(UsePlayerPedAnims);
120    load_function!(GetWeather);
121    load_function!(GetWorldTime);
122    load_function!(ToggleChatTextReplacement);
123    load_function!(ChatTextReplacementToggled);
124    load_function!(IsValidNickName);
125    load_function!(AllowNickNameCharacter);
126    load_function!(IsNickNameCharacterAllowed);
127    load_function!(ClearBanList);
128    load_function!(IsBanned);
129    load_function!(GetWeaponSlot);
130    load_function!(AddServerRule);
131    load_function!(SetServerRule);
132    load_function!(IsValidServerRule);
133    load_function!(RemoveServerRule);
134    load_function!(GetAnimationName);
135    load_function!(EnableStuntBonusForAll);
136    load_function!(CreateExplosion);
137}