mirror of
https://github.com/rehlds/reapi.git
synced 2024-12-29 08:05:36 +03:00
Add ClientConnected hook (#223)
Add `ClientConnected()` hook. Called after processing a client connection request.
This commit is contained in:
parent
37e7b12ba0
commit
36d6311eaf
@ -53,6 +53,12 @@ enum EngineFunc
|
||||
* Params: (const client, buffer, const receiver)
|
||||
*/
|
||||
RH_SV_WriteFullClientUpdate,
|
||||
|
||||
/*
|
||||
* Description: Called after processing a client connection request.
|
||||
* Params: (const client)
|
||||
*/
|
||||
RH_ClientConnected,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -63,6 +63,16 @@ void SV_WriteFullClientUpdate(IRehldsHook_SV_WriteFullClientUpdate *chain, IGame
|
||||
SV_WriteFullClientUpdate_AMXX(&data, client, (size_t)buffer, receiver);
|
||||
}
|
||||
|
||||
void ClientConnected(IRehldsHook_ClientConnected* chain, IGameClient* cl)
|
||||
{
|
||||
auto original = [chain](int client)
|
||||
{
|
||||
chain->callNext(g_RehldsSvs->GetClient(client - 1));
|
||||
};
|
||||
|
||||
callVoidForward(RH_ClientConnected, original, cl->GetId() + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* ReGameDLL functions
|
||||
*/
|
||||
|
@ -331,6 +331,7 @@ void SV_StartSound(IRehldsHook_SV_StartSound *chain, int recipients, edict_t *en
|
||||
void SV_DropClient(IRehldsHook_SV_DropClient *chain, IGameClient *cl, bool crash, const char *fmt);
|
||||
void SV_ActivateServer(IRehldsHook_SV_ActivateServer *chain, int runPhysics);
|
||||
void Cvar_DirectSet(IRehldsHook_Cvar_DirectSet *chain, cvar_t *var, const char *value);
|
||||
void ClientConnected(IRehldsHook_ClientConnected* chain, IGameClient* cl);
|
||||
|
||||
struct SV_WriteFullClientUpdate_args_t
|
||||
{
|
||||
|
@ -86,7 +86,8 @@ hook_t hooklist_engine[] = {
|
||||
ENG(SV_DropClient),
|
||||
ENG(SV_ActivateServer),
|
||||
ENG(Cvar_DirectSet),
|
||||
ENG(SV_WriteFullClientUpdate, _AMXX)
|
||||
ENG(SV_WriteFullClientUpdate, _AMXX),
|
||||
ENG(ClientConnected)
|
||||
};
|
||||
|
||||
#define DLL(h,...) { {}, {}, #h, "ReGameDLL", [](){ return api_cfg.hasReGameDLL(); }, ((!(RG_##h & (MAX_REGION_RANGE - 1)) ? regfunc::current_cell = 1, true : false) || (RG_##h & (MAX_REGION_RANGE - 1)) == regfunc::current_cell++) ? regfunc(h##__VA_ARGS__) : regfunc(#h#__VA_ARGS__), [](){ g_ReGameHookchains->h()->registerHook(&h); }, [](){ g_ReGameHookchains->h()->unregisterHook(&h); }, false}
|
||||
|
@ -97,7 +97,8 @@ enum EngineFunc
|
||||
RH_SV_DropClient,
|
||||
RH_SV_ActivateServer,
|
||||
RH_Cvar_DirectSet,
|
||||
RH_SV_WriteFullClientUpdate
|
||||
RH_SV_WriteFullClientUpdate,
|
||||
RH_ClientConnected
|
||||
|
||||
// [...]
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user