2
0
mirror of https://github.com/s1lentq/reapi.git synced 2024-10-16 23:37:07 +03:00

Implemented native REU_GetAuthKey

This commit is contained in:
s1lentq 2022-01-31 04:25:31 +07:00
parent 15aca1d799
commit fe6150a5d3
2 changed files with 43 additions and 0 deletions

View File

@ -39,6 +39,18 @@ native REU_GetProtocol(const index);
*/
native client_auth_type:REU_GetAuthtype(const index);
/*
* Get client authkey
*
* @param index Client index
* @param index Buffer to copy the authkey
* @param index Maximum buffer size
*
* @return Number of cells copied to buffer
*
*/
native REU_GetAuthKey(const index, dest[], maxlen);
/*
* Check if the client is running RevEmu with limited user rights.
*

View File

@ -36,6 +36,36 @@ cell AMX_NATIVE_CALL REU_GetAuthtype(AMX *amx, cell *params)
return g_ReunionApi->GetClientAuthtype(params[arg_index] - 1);
}
/*
* Get client authkey
*
* @param index Client index
* @param index Buffer to copy the authkey
* @param index Maximum buffer size
*
* @return Number of cells copied to buffer
*
* native REU_GetAuthKey(const index, dest[], maxlen);
*/
cell AMX_NATIVE_CALL REU_GetAuthKey(AMX *amx, cell *params)
{
enum args_e { arg_count, arg_index, arg_output, arg_maxlen };
CHECK_ISPLAYER(arg_index);
int clientId = params[arg_index] - 1;
char buffer[256];
size_t size = g_ReunionApi->GetClientAuthdata(clientId, buffer, sizeof buffer);
if (size <= 0)
return 0;
size_t numToCopy = min<size_t>(size, params[arg_maxlen]);
cell *dest = getAmxAddr(amx, params[arg_output]);
setAmxString(dest, buffer, numToCopy);
return numToCopy;
}
/*
* Check if the client is running RevEmu with limited user rights.
*
@ -70,6 +100,7 @@ AMX_NATIVE_INFO Reunion_Natives[] =
{
{ "REU_GetProtocol", REU_GetProtocol },
{ "REU_GetAuthtype", REU_GetAuthtype },
{ "REU_GetAuthKey", REU_GetAuthKey },
{ "REU_IsRevemuWithoutAdminRights", REU_IsRevemuWithoutAdminRights },
{ nullptr, nullptr }