diff --git a/dlls/engine/engine.h b/dlls/engine/engine.h index 85b0fd8b..04ef8b4d 100755 --- a/dlls/engine/engine.h +++ b/dlls/engine/engine.h @@ -90,6 +90,7 @@ AmxCallList preThink; AmxCallList postThink; AmxCallList clientKill; AmxCallList Msgs; +AmxCallList clientImpulse; meta_globals_t *gpMetaGlobals; gamedll_funcs_t *gpGamedllFuncs; diff --git a/dlls/engine/meta_api.cpp b/dlls/engine/meta_api.cpp index d6af430e..b93099fe 100755 --- a/dlls/engine/meta_api.cpp +++ b/dlls/engine/meta_api.cpp @@ -33,6 +33,7 @@ */ #include +#include #include #include #include "sdk_util.h" @@ -3202,6 +3203,23 @@ void MessageEnd(void) { RETURN_META(result); } +void CmdStart(const edict_t *player, const struct usercmd_s *_cmd, unsigned int random_seed) +{ + edict_t *pEntity = (edict_t *)player; + struct usercmd_s *cmd = (struct usercmd_s *)_cmd; + META_RES result = MRES_IGNORED; + cell iResult; + + for (AmxCallList::AmxCall* i = clientImpulse.head; i; i = i->next) { + AMX_EXEC(i->amx, &iResult, i->iFunctionIdx, 2, ENTINDEX(pEntity), cmd->impulse); + if (iResult & 2) { + RETURN_META(MRES_SUPERCEDE); + } else if (iResult & 1) { + result = MRES_SUPERCEDE; + } + } +} + void WriteByte(int iValue) { if(GlInfo.bBlocking) { RETURN_META(MRES_SUPERCEDE); @@ -3327,6 +3345,9 @@ void ServerActivate( edict_t *pEdictList, int edictCount, int clientMax ){ if (AMX_FINDPUBLIC(amx, "client_kill", &iFunctionIndex) == AMX_ERR_NONE) { clientKill.put(amx, iFunctionIndex); } + if (AMX_FINDPUBLIC(amx, "client_impulse",&iFunctionIndex) == AMX_ERR_NONE) { + clientImpulse.put(amx, iFunctionIndex); + } } inHookProcess = 0; @@ -3463,7 +3484,7 @@ void ClientPutInServer_Post( edict_t *pEntity ) { DLL_FUNCTIONS gFunctionTable; C_DLLEXPORT int GetEntityAPI2( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion ){ - + gFunctionTable.pfnCmdStart = CmdStart; gFunctionTable.pfnGameInit = GameInit; gFunctionTable.pfnStartFrame = StartFrame; gFunctionTable.pfnTouch = Touch;