use eventqueuefix's event pausing when possible

This commit is contained in:
rtldg 2021-05-09 01:14:52 +00:00
parent 3be13005e6
commit 8f8b29b377
2 changed files with 38 additions and 1 deletions

View File

@ -76,6 +76,25 @@ native bool ClearClientEvents(int client);
*/
native bool SetEventsTimescale(int client, float timescale);
/*
* Pauses or unpauses events for a given client.
*
* @param client Client index.
* @param paused Pause state.
*
* @return True if action was successful, false otherwise.
*/
native bool SetClientEventsPaused(int client, bool paused);
/*
* Check if events is paused
*
* @param client Client index.
*
* @return True if events are paused for client, false otherwise. Will throw native error if client is invalid.
*/
native bool IsClientEventsPaused(int client);
#if !defined REQUIRE_PLUGIN
public void __pl_eventqueuefix_SetNTVOptional()
{
@ -83,5 +102,7 @@ public void __pl_eventqueuefix_SetNTVOptional()
MarkNativeAsOptional("SetClientEvents");
MarkNativeAsOptional("ClearClientEvents");
MarkNativeAsOptional("SetEventsTimescale");
MarkNativeAsOptional("SetClientEventsPaused");
MarkNativeAsOptional("IsClientEventsPaused");
}
#endif
#endif

View File

@ -1126,6 +1126,22 @@ void RemoveRagdoll(int client)
}
}
public void Shavit_OnPause(int client, int track)
{
if (gB_Eventqueuefix)
{
SetClientEventsPaused(client, true);
}
}
public void Shavit_OnResume(int client, int track)
{
if (gB_Eventqueuefix)
{
SetClientEventsPaused(client, false);
}
}
public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float vel[3], float angles[3], TimerStatus status, int track, int style)
{
bool bNoclip = (GetEntityMoveType(client) == MOVETYPE_NOCLIP);