From 6b690b06c981a1c4b5cc6f41361916025512a288 Mon Sep 17 00:00:00 2001 From: zaCade Date: Sun, 24 Feb 2019 14:49:04 +0100 Subject: [PATCH] RevEmuAPI: Rework PlayerType native return string. Whoopdiedo --- extension.cpp | 51 ++++++++++++++++++++++++++++++++++++++++++- include/RevEmuAPI.inc | 21 ++++-------------- 2 files changed, 54 insertions(+), 18 deletions(-) diff --git a/extension.cpp b/extension.cpp index 3681668..5eb28e2 100644 --- a/extension.cpp +++ b/extension.cpp @@ -103,7 +103,56 @@ static cell_t GetPlayerType(IPluginContext *pContext, const cell_t *params) } } - return PlayerInfo.m_ePlayerType; + char sPlayerType[64]; + switch(PlayerInfo.m_ePlayerType) + { + case(k_eSteamLegitUser): + snprintf(sPlayerType, sizeof(sPlayerType), "SteamLegit"); + break; + + case(k_eSteamCrackedUser): + snprintf(sPlayerType, sizeof(sPlayerType), "SteamCracked"); + break; + + case(k_eRevEmuUser): + snprintf(sPlayerType, sizeof(sPlayerType), "RevEmu"); + break; + + case(k_eRevEmuUserOld): + snprintf(sPlayerType, sizeof(sPlayerType), "RevEmuOld"); + break; + + case(k_eSettiSRCScanBot): + snprintf(sPlayerType, sizeof(sPlayerType), "SRCScanBot"); + break; + + case(k_eRevEmuUserV74): + snprintf(sPlayerType, sizeof(sPlayerType), "RevEmuV74"); + break; + + case(k_eRevEmuUserVeryOld): + snprintf(sPlayerType, sizeof(sPlayerType), "RevEmuVeryOld"); + break; + + case(k_eUnknownUser): + snprintf(sPlayerType, sizeof(sPlayerType), "Unknown"); + break; + + case(k_eSteam2Legit): + snprintf(sPlayerType, sizeof(sPlayerType), "Steam2Legit"); + break; + + case(k_eSteam2Cracked): + snprintf(sPlayerType, sizeof(sPlayerType), "Steam2Cracked"); + break; + + default: + snprintf(sPlayerType, sizeof(sPlayerType), "Unknown Type"); + break; + } + + pContext->StringToLocal(params[2], params[3], sPlayerType); + return true; } /** diff --git a/include/RevEmuAPI.inc b/include/RevEmuAPI.inc index a453152..0259510 100644 --- a/include/RevEmuAPI.inc +++ b/include/RevEmuAPI.inc @@ -3,21 +3,6 @@ #endif #define _RevEmuAPI_included -enum RevEmu_UserType -{ - Invalid = -1, - SteamLegitUser = 0, - SteamCrackedUser, - RevEmuUser, - RevEmuUserOld, - SettiSRCScanBot, - RevEmuUserV74, - RevEmuUserVeryOld, - UnknownUser, - Steam2Legit, - Steam2Cracked -}; - /** * Check if clients usertype is legit. * @@ -32,11 +17,13 @@ native bool RevEmu_IsPlayerSteam(int client); * Retrieve clients usertype. * * @param clients The client index. + * @param type The buffer to write to. + * @param maxlength The maximum buffer length. * - * @return The clients usertype. + * @return True on success, false otherwise. * @error Invalid client index, not connected or fake client. */ -native RevEmu_UserType RevEmu_GetPlayerType(int client); +native bool RevEmu_GetPlayerType(int client, char[] type, int maxlength); public Extension __ext_RevEmuAPI =