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

Implement SV_ConnectClient() hook (#220)

* Implement SV_ConnectClient hook

* Add description

Co-authored-by: Sergey Shorokhov <wopox1337@ya.ru>
This commit is contained in:
Franco Romaniello 2021-10-23 13:10:35 +02:00 committed by GitHub
parent efcc3952b5
commit 81ced333ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 0 deletions

View File

@ -66,6 +66,12 @@ enum EngineFunc
*/ */
RH_ClientConnected, RH_ClientConnected,
/*
* Description: Called when processing a 'connect' client connectionless packet.
* Params: ()
*/
RH_SV_ConnectClient,
/* /*
* Description: Called when client it's in the scoreboard * Description: Called when client it's in the scoreboard
* Params: (const this) * Params: (const this)

View File

@ -83,6 +83,16 @@ void ClientConnected(IRehldsHook_ClientConnected* chain, IGameClient* cl)
callVoidForward(RH_ClientConnected, original, cl->GetId() + 1); callVoidForward(RH_ClientConnected, original, cl->GetId() + 1);
} }
void SV_ConnectClient(IRehldsHook_SV_ConnectClient *chain)
{
auto original = [chain]()
{
chain->callNext();
};
callVoidForward(RH_SV_ConnectClient, original);
}
void SV_EmitPings_AMXX(SV_EmitPings_t* data, IGameClient* cl) void SV_EmitPings_AMXX(SV_EmitPings_t* data, IGameClient* cl)
{ {
auto original = [data](int _cl) auto original = [data](int _cl)

View File

@ -333,6 +333,7 @@ void SV_DropClient(IRehldsHook_SV_DropClient *chain, IGameClient *cl, bool crash
void SV_ActivateServer(IRehldsHook_SV_ActivateServer *chain, int runPhysics); void SV_ActivateServer(IRehldsHook_SV_ActivateServer *chain, int runPhysics);
void Cvar_DirectSet(IRehldsHook_Cvar_DirectSet *chain, cvar_t *var, const char *value); void Cvar_DirectSet(IRehldsHook_Cvar_DirectSet *chain, cvar_t *var, const char *value);
void ClientConnected(IRehldsHook_ClientConnected* chain, IGameClient* cl); void ClientConnected(IRehldsHook_ClientConnected* chain, IGameClient* cl);
void SV_ConnectClient(IRehldsHook_SV_ConnectClient* chain);
struct SV_WriteFullClientUpdate_args_t struct SV_WriteFullClientUpdate_args_t
{ {

View File

@ -89,6 +89,7 @@ hook_t hooklist_engine[] = {
ENG(SV_WriteFullClientUpdate, _AMXX), ENG(SV_WriteFullClientUpdate, _AMXX),
ENG(GetEntityInit), ENG(GetEntityInit),
ENG(ClientConnected), ENG(ClientConnected),
ENG(SV_ConnectClient),
ENG(SV_EmitPings, _AMXX) ENG(SV_EmitPings, _AMXX)
}; };

View File

@ -100,6 +100,7 @@ enum EngineFunc
RH_SV_WriteFullClientUpdate, RH_SV_WriteFullClientUpdate,
RH_GetEntityInit, RH_GetEntityInit,
RH_ClientConnected, RH_ClientConnected,
RH_SV_ConnectClient,
RH_SV_EmitPings RH_SV_EmitPings
// [...] // [...]