2
0
mirror of https://github.com/rehlds/reapi.git synced 2025-01-16 00:28:17 +03:00

Added native REU_IsRevemuWithoutAdminRights

This commit is contained in:
asmodai 2016-10-12 00:25:21 +03:00
parent f6d0f02e6a
commit ca92f13aa9
3 changed files with 40 additions and 1 deletions

View File

@ -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);

View File

@ -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 }
};

View File

@ -5,4 +5,4 @@
// reapi version
#define REAPI_VERSION_MAJOR 4
#define REAPI_VERSION_MINOR 3
#define REAPI_VERSION_MINOR 4