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

Added rh_update_user_info

Updated ReHLDS API
Fixed platform toolset in msvc for WinXP
This commit is contained in:
WPMGPRoSToTeMa 2016-06-15 21:23:49 +03:00
parent d6c3a21dbb
commit 084fc056a7
6 changed files with 37 additions and 9 deletions

View File

@ -85,7 +85,7 @@ enum HookChain
* @return Returns a handle to the hook. Use EnableHookChain/DisableHookChain to toggle the forward on or off.
*
*/
native HookChain:RegisterHookChain(any:function_id, const callback[], post = 0);
native HookChain:RegisterHookChain({EngineFunc, GamedllFunc, GamedllFunc_CBaseAnimating, GamedllFunc_CBasePlayer, GamedllFunc_CSGameRules}:function_id, const callback[], post = 0);
/*
* Stops a hook from triggering.
@ -192,4 +192,4 @@ public __reapi_version_check(const majorVersion, const minorVersion)
set_fail_state(temp);
return;
}
}
}

View File

@ -73,8 +73,17 @@ native rh_reset_mapname();
* @param flags Emit flags
* @param pitch Sound pitch
* @param emitFlags Additional Emit2 flags, look at the defines like SND_EMIT2_*
*
* @return 1 if successfully sounds are emitted, 0 otherwise
*
*/
native rh_emit_sound2(const entity, const recipient, const channel, const sample[], Float:vol = VOL_NORM, Float:attn = ATTN_NORM, const flags = 0, const pitch = PITCH_NORM, emitFlags = 0, const Float:origin[3] = {0.0,0.0,0.0});
/*
* Forces an userinfo update
*
* @param playerEntIndex Player entity index (starts from 1)
*
* @noreturn
*/
native rh_update_user_info(playerEntIndex);

View File

@ -35,7 +35,7 @@
#include "model.h"
#define REHLDS_API_VERSION_MAJOR 2
#define REHLDS_API_VERSION_MINOR 12
#define REHLDS_API_VERSION_MINOR 13
//Steam_NotifyClientConnect hook
typedef IHookChain<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
@ -280,6 +280,7 @@ struct RehldsFuncs_t {
void(*Steam_NotifyClientDisconnect)(IGameClient* cl);
void(*SV_StartSound)(int recipients, edict_t *entity, int channel, const char *sample, int volume, float attenuation, int flags, int pitch);
bool(*SV_EmitSound2)(edict_t *entity, IGameClient *receiver, int channel, const char *sample, float volume, float attenuation, int flags, int pitch, int emitFlags, const float *pOrigin);
void (* SV_UpdateUserInfo)(IGameClient *pGameClient);
};
class IRehldsApi {
@ -295,4 +296,4 @@ public:
virtual IRehldsFlightRecorder* GetFlightRecorder() = 0;
};
#define VREHLDS_HLDS_API_VERSION "VREHLDS_HLDS_API_VERSION001"
#define VREHLDS_HLDS_API_VERSION "VREHLDS_HLDS_API_VERSION001"

View File

@ -283,13 +283,13 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v120_xp</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v120_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>

View File

@ -993,7 +993,7 @@ cell AMX_NATIVE_CALL rg_set_user_team(AMX *amx, cell *params)
pPlayer->m_bHasDefuser = false;
pPlayer->pev->body = 0;
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, NULL, pPlayer->pev);
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pPlayer->pev);
WRITE_BYTE(STATUSICON_HIDE);
WRITE_STRING("defuser");
MESSAGE_END();
@ -1552,12 +1552,30 @@ cell AMX_NATIVE_CALL rh_emit_sound2(AMX *amx, cell *params)
);
}
// TODO: should we duplicate documentation for native here and in include?
cell AMX_NATIVE_CALL rh_update_user_info(AMX *amx, cell *params)
{
enum args_e { arg_count, arg_playerEntIndex };
CBasePlayer *pPlayer = getPrivate<CBasePlayer>(params[arg_playerEntIndex]);
if (pPlayer != nullptr && pPlayer->has_disconnected) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: player %i is not connected", __FUNCTION__, params[arg_playerEntIndex]);
return FALSE;
}
CAmxArgs args(amx, params);
g_RehldsFuncs->SV_UpdateUserInfo(args[arg_playerEntIndex]);
return TRUE;
}
AMX_NATIVE_INFO Misc_Natives_RH[] =
{
{ "rh_set_mapname", rh_set_mapname },
{ "rh_get_mapname", rh_get_mapname },
{ "rh_reset_mapname", rh_reset_mapname },
{ "rh_emit_sound2", rh_emit_sound2 },
{ "rh_update_user_info", rh_update_user_info },
{ nullptr, nullptr }
};

View File

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