Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions reapi/extra/amxmodx/scripting/include/reapi_engine_const.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

/**
Expand Down
10 changes: 10 additions & 0 deletions reapi/src/hook_callback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
1 change: 1 addition & 0 deletions reapi/src/hook_callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
3 changes: 2 additions & 1 deletion reapi/src/hook_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
3 changes: 2 additions & 1 deletion reapi/src/hook_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ enum EngineFunc
RH_SV_DropClient,
RH_SV_ActivateServer,
RH_Cvar_DirectSet,
RH_SV_WriteFullClientUpdate
RH_SV_WriteFullClientUpdate,
RH_ClientConnected

// [...]
};
Expand Down