@@ -36,6 +36,36 @@ cell AMX_NATIVE_CALL REU_GetAuthtype(AMX *amx, cell *params)
3636 return g_ReunionApi->GetClientAuthtype (params[arg_index] - 1 );
3737}
3838
39+ /*
40+ * Get client authkey
41+ *
42+ * @param index Client index
43+ * @param index Buffer to copy the authkey
44+ * @param index Maximum buffer size
45+ *
46+ * @return Number of cells copied to buffer
47+ *
48+ * native REU_GetAuthKey(const index, dest[], maxlen);
49+ */
50+ cell AMX_NATIVE_CALL REU_GetAuthKey (AMX *amx, cell *params)
51+ {
52+ enum args_e { arg_count, arg_index, arg_output, arg_maxlen };
53+
54+ CHECK_ISPLAYER (arg_index);
55+
56+ int clientId = params[arg_index] - 1 ;
57+
58+ char buffer[256 ];
59+ size_t size = g_ReunionApi->GetClientAuthdata (clientId, buffer, sizeof buffer);
60+ if (size <= 0 )
61+ return 0 ;
62+
63+ size_t numToCopy = min<size_t >(size, params[arg_maxlen]);
64+ cell *dest = getAmxAddr (amx, params[arg_output]);
65+ setAmxString (dest, buffer, numToCopy);
66+ return numToCopy;
67+ }
68+
3969/*
4070* Check if the client is running RevEmu with limited user rights.
4171*
@@ -70,6 +100,7 @@ AMX_NATIVE_INFO Reunion_Natives[] =
70100{
71101 { " REU_GetProtocol" , REU_GetProtocol },
72102 { " REU_GetAuthtype" , REU_GetAuthtype },
103+ { " REU_GetAuthKey" , REU_GetAuthKey },
73104 { " REU_IsRevemuWithoutAdminRights" , REU_IsRevemuWithoutAdminRights },
74105
75106 { nullptr , nullptr }
0 commit comments