mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2025-01-13 07:18:05 +03:00
Fun: Toggle PlayerPreThink forward on demand
This commit is contained in:
parent
5b74e3285a
commit
3fba7ca567
@ -395,11 +395,26 @@ static cell AMX_NATIVE_CALL set_user_footsteps(AMX *amx, cell *params)
|
||||
{
|
||||
pPlayer->v.flTimeStepSound = 999;
|
||||
Players[index].SetSilentFootsteps(true);
|
||||
|
||||
g_pFunctionTable->pfnPlayerPreThink = PlayerPreThink;
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer->v.flTimeStepSound = STANDARDTIMESTEPSOUND;
|
||||
Players[index].SetSilentFootsteps(false);
|
||||
|
||||
if (g_pFunctionTable->pfnPlayerPreThink)
|
||||
{
|
||||
for (auto i = 1; i <= gpGlobals->maxClients; ++i)
|
||||
{
|
||||
if (Players[i].HasSilentFootsteps())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
g_pFunctionTable->pfnPlayerPreThink = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -527,5 +542,13 @@ void OnPluginsLoaded()
|
||||
}
|
||||
|
||||
TypeConversion.init();
|
||||
|
||||
g_pFunctionTable->pfnPlayerPreThink = nullptr;
|
||||
}
|
||||
|
||||
void ServerDeactivate()
|
||||
{
|
||||
g_pFunctionTable->pfnPlayerPreThink = nullptr;
|
||||
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
#define HITGROUP_RIGHTLEG 7 // 128
|
||||
#define HITGROUP_MAX 8
|
||||
|
||||
extern DLL_FUNCTIONS *g_pFunctionTable;
|
||||
|
||||
static const auto kHitGroupsBits = (1 << HITGROUP_MAX) - 1;
|
||||
static const auto kMaxClients = 32u;
|
||||
|
@ -119,7 +119,7 @@
|
||||
// #define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */
|
||||
// #define FN_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */
|
||||
// #define FN_ServerActivate ServerActivate /* pfnServerActivate() (wd) Server is starting a new map */
|
||||
// #define FN_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */
|
||||
#define FN_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */
|
||||
#define FN_PlayerPreThink PlayerPreThink /* pfnPlayerPreThink() */
|
||||
// #define FN_PlayerPostThink PlayerPostThink /* pfnPlayerPostThink() */
|
||||
// #define FN_StartFrame StartFrame /* pfnStartFrame() */
|
||||
|
Loading…
x
Reference in New Issue
Block a user