mirror of
https://github.com/rehlds/reapi.git
synced 2025-01-14 15:48:03 +03:00
API
: Implement RH_ExecuteServerStringCmd
hook (#263)
* `API`: Implement `RH_ExecuteServerStringCmd` hook
This commit is contained in:
parent
867368f56d
commit
d2347e8678
@ -161,6 +161,12 @@ enum EngineFunc
|
||||
* Params: (const string[])
|
||||
*/
|
||||
RH_SV_ClientPrintf,
|
||||
|
||||
/*
|
||||
* Description: Called when a command is being sent to server.
|
||||
* Params: (const cmd[], source, id)
|
||||
*/
|
||||
RH_ExecuteServerStringCmd,
|
||||
|
||||
/*
|
||||
* Description: Called before adding an entity to the physents of a player.
|
||||
|
@ -227,6 +227,16 @@ void SV_ClientPrintf(IRehldsHook_SV_ClientPrintf *chain, const char *string)
|
||||
callVoidForward(RH_SV_ClientPrintf, original, string);
|
||||
}
|
||||
|
||||
void ExecuteServerStringCmd(IRehldsHook_ExecuteServerStringCmd* chain, const char* cmdName, cmd_source_t cmdSrc, IGameClient* cl)
|
||||
{
|
||||
auto original = [chain](const char* _cmdName, cmd_source_t _cmdSrc, int client)
|
||||
{
|
||||
chain->callNext(_cmdName, _cmdSrc, _cmdSrc == src_client ? g_RehldsSvs->GetClient(client) - 1 : 0);
|
||||
};
|
||||
|
||||
callVoidForward(RH_ExecuteServerStringCmd, original, cmdName, cmdSrc, cmdSrc == src_client ? cl->GetId() + 1 : 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* ReGameDLL functions
|
||||
*/
|
||||
|
@ -348,6 +348,7 @@ using SV_WriteFullClientUpdate_t = hookdata_t<IRehldsHook_SV_WriteFullClientUpda
|
||||
void SV_WriteFullClientUpdate_AMXX(SV_WriteFullClientUpdate_t *data, IGameClient *client, size_t buffer, IGameClient *receiver);
|
||||
void SV_WriteFullClientUpdate(IRehldsHook_SV_WriteFullClientUpdate *chain, IGameClient *client, char *buffer, size_t maxlen, sizebuf_t *sb, IGameClient *receiver);
|
||||
ENTITYINIT GetEntityInit(IRehldsHook_GetEntityInit *chain, char *classname);
|
||||
void ExecuteServerStringCmd(IRehldsHook_ExecuteServerStringCmd* chain, const char* cmdName, cmd_source_t src, IGameClient* client);
|
||||
|
||||
struct SV_EmitPings_args_t
|
||||
{
|
||||
|
@ -22,6 +22,7 @@ inline size_t getFwdParamType(void(*)(char *)) { return FP_STRI
|
||||
inline size_t getFwdParamType(void(*)(IResourceBuffer*)) { return FP_CELL; }
|
||||
inline size_t getFwdParamType(void(*)(unsigned char)) { return FP_CELL; }
|
||||
inline size_t getFwdParamType(void(*)(resourcetype_t)) { return FP_CELL; }
|
||||
inline size_t getFwdParamType(void(*)(cmd_source_t)) { return FP_CELL; }
|
||||
|
||||
template <typename T>
|
||||
inline size_t getFwdParamType(void(*)(T *)) { return FP_CELL; }
|
||||
@ -104,6 +105,7 @@ hook_t hooklist_engine[] = {
|
||||
ENG(SV_AddResource),
|
||||
ENG(SV_ClientPrintf),
|
||||
ENG(SV_AllowPhysent),
|
||||
ENG(ExecuteServerStringCmd),
|
||||
|
||||
};
|
||||
|
||||
|
@ -113,7 +113,8 @@ enum EngineFunc
|
||||
RH_SV_AddResource,
|
||||
RH_SV_ClientPrintf,
|
||||
RH_SV_AllowPhysent,
|
||||
|
||||
RH_ExecuteServerStringCmd,
|
||||
|
||||
// [...]
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user