omp_gdk/scripting/core/
functions.rs

1use omp_codegen::native;
2
3use crate::players::Player;
4use std::ffi::c_void;
5
6native!(Core_TickCount, -> i32);
7native!(Core_MaxPlayers, -> i32);
8native!(Core_Log, text: str, -> bool);
9native!(Core_IsAdminTeleportAllowed, -> bool);
10native!(Core_AllowAdminTeleport, allow: bool, -> bool);
11native!(Core_AreAllAnimationsEnabled, -> bool);
12native!(Core_EnableAllAnimations, allow: bool, -> bool);
13native!(Core_IsAnimationLibraryValid, name: str, -> bool);
14native!(Core_AreInteriorWeaponsAllowed, -> bool);
15native!(Core_AllowInteriorWeapons, allow: bool, -> bool);
16native!(Core_BlockIpAddress, ipAddress: str, timeMS: i32, -> bool);
17native!(Core_UnBlockIpAddress, ipAddress: str, -> bool);
18native!(Core_DisableEntryExitMarkers, -> bool);
19native!(Core_DisableNameTagsLOS, -> bool);
20native!(Core_EnableZoneNames, enable: bool, -> bool);
21native!(Core_ShowGameTextForAll, msg: str, time: i32, style: i32, -> bool);
22native!(Core_HideGameTextForAll, style: i32, -> bool);
23native!(Core_NetworkStats, output: mut str,output_len: usize, -> i32);
24native!(Core_ServerTickRate, -> i32);
25native!(Core_GetWeaponName, weaponid: i32, output: mut str,output_len: usize, -> bool);
26native!(Core_SetChatRadius, globalChatRadius: f32, -> bool);
27native!(Core_SetMarkerRadius, playerMarkerRadius: f32, -> bool);
28native!(Core_SendRconCommand, command: str, -> bool);
29native!(Core_SetDeathDropAmount, amount: i32, -> bool);
30native!(Core_GameMode_SetText, string: str, -> bool);
31native!(Core_SetGravity, gravity: f32, -> bool);
32native!(Core_GetGravity, -> f32);
33native!(Core_SetNameTagsDrawDistance, distance: f32, -> bool);
34native!(Core_SetWeather, weatherid: i32, -> bool);
35native!(Core_SetWorldTime, hour: i32, -> bool);
36native!(Core_ShowNameTags, show: bool, -> bool);
37native!(Core_ShowPlayerMarkers, mode: i32, -> bool);
38native!(Core_UsePedAnims, -> bool);
39native!(Core_GetWeather, -> i32);
40native!(Core_GetWorldTime, -> i32);
41native!(Core_ToggleChatTextReplacement, enable: bool, -> bool);
42native!(Core_IsChatTextReplacementToggled, -> bool);
43native!(Core_IsNickNameValid, name: str, -> bool);
44native!(Core_AllowNickNameCharacter, character: i32, allow: bool, -> bool);
45native!(Core_IsNickNameCharacterAllowed, character: i32, -> bool);
46native!(Core_ClearBanList, -> bool);
47native!(Core_IsIpAddressBanned, ip: str, -> bool);
48native!(Core_GetWeaponSlot, weapon: u8, -> i32);
49native!(Core_AddRule, name: str, value: str, -> bool);
50native!(Core_IsValidRule, name: str, -> bool);
51native!(Core_RemoveRule, name: str, -> bool);
52native!(All_SendClientMessage, color: u32, text: str, -> bool);
53native!(All_CreateExplosion, x: f32, y: f32, z: f32, expolsion_type: i32, radius: f32, -> bool);
54native!(All_SendDeathMessage, killer: struct Player, killee: struct Player, weapon: i32, -> bool);
55native!(All_EnableStuntBonus, enable: bool, -> bool);
56
57#[doc(hidden)]
58pub fn load_functions() {
59    load_function!(Core_TickCount);
60    load_function!(Core_MaxPlayers);
61    load_function!(Core_Log);
62    load_function!(Core_IsAdminTeleportAllowed);
63    load_function!(Core_AllowAdminTeleport);
64    load_function!(Core_AreAllAnimationsEnabled);
65    load_function!(Core_EnableAllAnimations);
66    load_function!(Core_IsAnimationLibraryValid);
67    load_function!(Core_AreInteriorWeaponsAllowed);
68    load_function!(Core_AllowInteriorWeapons);
69    load_function!(Core_BlockIpAddress);
70    load_function!(Core_UnBlockIpAddress);
71    load_function!(Core_DisableEntryExitMarkers);
72    load_function!(Core_DisableNameTagsLOS);
73    load_function!(Core_EnableZoneNames);
74    load_function!(Core_ShowGameTextForAll);
75    load_function!(Core_HideGameTextForAll);
76    load_function!(Core_NetworkStats);
77    load_function!(Core_ServerTickRate);
78    load_function!(Core_GetWeaponName);
79    load_function!(Core_SetChatRadius);
80    load_function!(Core_SetMarkerRadius);
81    load_function!(Core_SendRconCommand);
82    load_function!(Core_SetDeathDropAmount);
83    load_function!(Core_GameMode_SetText);
84    load_function!(Core_SetGravity);
85    load_function!(Core_GetGravity);
86    load_function!(Core_SetNameTagsDrawDistance);
87    load_function!(Core_SetWeather);
88    load_function!(Core_SetWorldTime);
89    load_function!(Core_ShowNameTags);
90    load_function!(Core_ShowPlayerMarkers);
91    load_function!(Core_UsePedAnims);
92    load_function!(Core_GetWeather);
93    load_function!(Core_GetWorldTime);
94    load_function!(Core_ToggleChatTextReplacement);
95    load_function!(Core_IsChatTextReplacementToggled);
96    load_function!(Core_IsNickNameValid);
97    load_function!(Core_AllowNickNameCharacter);
98    load_function!(Core_IsNickNameCharacterAllowed);
99    load_function!(Core_ClearBanList);
100    load_function!(Core_IsIpAddressBanned);
101    load_function!(Core_GetWeaponSlot);
102    load_function!(Core_AddRule);
103    load_function!(Core_IsValidRule);
104    load_function!(Core_RemoveRule);
105    load_function!(All_SendClientMessage);
106    load_function!(All_CreateExplosion);
107    load_function!(All_SendDeathMessage);
108    load_function!(All_EnableStuntBonus);
109}