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:
parent
f6d0f02e6a
commit
ca92f13aa9
@ -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);
|
||||
|
@ -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 }
|
||||
};
|
||||
|
@ -5,4 +5,4 @@
|
||||
|
||||
// reapi version
|
||||
#define REAPI_VERSION_MAJOR 4
|
||||
#define REAPI_VERSION_MINOR 3
|
||||
#define REAPI_VERSION_MINOR 4
|
||||
|
Loading…
x
Reference in New Issue
Block a user