diff --git a/reapi/extra/amxmodx/scripting/include/reapi_addons.inc b/reapi/extra/amxmodx/scripting/include/reapi_addons.inc index 5aecd97..b10e9a8 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_addons.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_addons.inc @@ -75,3 +75,12 @@ native REU_GetProtocol(const index); * @return client auth type */ native client_auth_type:REU_GetAuthtype(const index); + +/* +* Check if client running RevEmu with limited user rights +* +* @param index Client index +* @return 1/0 +* +*/ +native bool:REU_IsRevemuWithoutAdminRights(const index); diff --git a/reapi/src/natives/natives_addons.cpp b/reapi/src/natives/natives_addons.cpp index 815f53b..7e19258 100644 --- a/reapi/src/natives/natives_addons.cpp +++ b/reapi/src/natives/natives_addons.cpp @@ -96,10 +96,40 @@ cell AMX_NATIVE_CALL REU_GetAuthtype(AMX *amx, cell *params) return g_ReunionApi->GetClientAuthtype(params[arg_index] - 1); } +/* +* Check if client running RevEmu with limited user rights +* +* @param index Client index +* @return 1/0 +* +* native REU_IsRevemuWithoutAdminRights(const index); +*/ +cell AMX_NATIVE_CALL REU_IsRevemuWithoutAdminRights(AMX *amx, cell *params) +{ + enum args_e { arg_count, arg_index }; + + CHECK_ISPLAYER(arg_index); + + int clientId = params[arg_index] - 1; + if (g_ReunionApi->GetClientAuthtype(clientId) != DP_AUTH_REVEMU) + return FALSE; + + char buffer[256]; + size_t size = g_ReunionApi->GetClientAuthdata(clientId, buffer, sizeof buffer); + + for (size_t i = 0; i < size; i++) { + if (!isdigit(buffer[i])) + return FALSE; + } + + return TRUE; +} + AMX_NATIVE_INFO Reunion_Natives[] = { { "REU_GetProtocol", REU_GetProtocol }, { "REU_GetAuthtype", REU_GetAuthtype }, + { "REU_IsRevemuWithoutAdminRights", REU_IsRevemuWithoutAdminRights }, { nullptr, nullptr } }; diff --git a/reapi/src/reapi_version.inc b/reapi/src/reapi_version.inc index 09d7b0e..26e74ec 100644 --- a/reapi/src/reapi_version.inc +++ b/reapi/src/reapi_version.inc @@ -5,4 +5,4 @@ // reapi version #define REAPI_VERSION_MAJOR 4 -#define REAPI_VERSION_MINOR 3 +#define REAPI_VERSION_MINOR 4