diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index d9ae5c46..7d6620b9 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -5255,6 +5255,11 @@ function network_global_index_from_local(localIndex) -- ... end +--- @return boolean +function network_is_moderator() + -- ... +end + --- @return boolean function network_is_server() -- ... diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md index 8c1d1861..754b81eb 100644 --- a/docs/lua/functions-3.md +++ b/docs/lua/functions-3.md @@ -7228,6 +7228,24 @@
+## [network_is_moderator](#network_is_moderator) + +### Lua Example +`local booleanValue = network_is_moderator()` + +### Parameters +- None + +### Returns +- `boolean` + +### C Prototype +`bool network_is_moderator(void);` + +[:arrow_up_small:](#) + +
+ ## [network_is_server](#network_is_server) ### Lua Example diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 6774e03c..1a019598 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -1019,6 +1019,7 @@ - network_utils.h - [network_get_player_text_color_string](functions-3.md#network_get_player_text_color_string) - [network_global_index_from_local](functions-3.md#network_global_index_from_local) + - [network_is_moderator](functions-3.md#network_is_moderator) - [network_is_server](functions-3.md#network_is_server) - [network_local_index_from_global](functions-3.md#network_local_index_from_global) diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 805699db..73b5a1a9 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -11802,6 +11802,15 @@ int smlua_func_network_global_index_from_local(lua_State* L) { return 1; } +int smlua_func_network_is_moderator(UNUSED lua_State* L) { + if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + + + lua_pushboolean(L, network_is_moderator()); + + return 1; +} + int smlua_func_network_is_server(UNUSED lua_State* L) { if(!smlua_functions_valid_param_count(L, 0)) { return 0; } @@ -19093,6 +19102,7 @@ void smlua_bind_functions_autogen(void) { // network_utils.h smlua_bind_function(L, "network_get_player_text_color_string", smlua_func_network_get_player_text_color_string); smlua_bind_function(L, "network_global_index_from_local", smlua_func_network_global_index_from_local); + smlua_bind_function(L, "network_is_moderator", smlua_func_network_is_moderator); smlua_bind_function(L, "network_is_server", smlua_func_network_is_server); smlua_bind_function(L, "network_local_index_from_global", smlua_func_network_local_index_from_global); diff --git a/src/pc/network/network_utils.c b/src/pc/network/network_utils.c index 8e05fce7..90562dcb 100644 --- a/src/pc/network/network_utils.c +++ b/src/pc/network/network_utils.c @@ -26,6 +26,11 @@ bool network_is_server(void) { return gNetworkType == NT_SERVER; } +bool network_is_moderator(void) { + extern u8 gIsModerator; + return gIsModerator; +} + u8* network_get_player_text_color(u8 localIndex) { if (localIndex >= MAX_PLAYERS) { localIndex = 0; } diff --git a/src/pc/network/network_utils.h b/src/pc/network/network_utils.h index 5bb025a4..de7de04d 100644 --- a/src/pc/network/network_utils.h +++ b/src/pc/network/network_utils.h @@ -8,6 +8,7 @@ u8 network_global_index_from_local(u8 localIndex); u8 network_local_index_from_global(u8 globalIndex); bool network_is_server(void); +bool network_is_moderator(void); u8* network_get_player_text_color(u8 localIndex); char* network_get_player_text_color_string(u8 localIndex);