From 35b1a69fcfc4ee91e7834ebc470265ae656b9870 Mon Sep 17 00:00:00 2001 From: BotoX Date: Fri, 4 Oct 2019 11:23:05 +0200 Subject: [PATCH] LagCompensation: block player from touching hooked trigger --- LagCompensation/scripting/LagCompensation.sp | 13 +++++++++---- includes/CSSFixes.inc | 9 +++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/LagCompensation/scripting/LagCompensation.sp b/LagCompensation/scripting/LagCompensation.sp index ae598b63..51f5d20f 100644 --- a/LagCompensation/scripting/LagCompensation.sp +++ b/LagCompensation/scripting/LagCompensation.sp @@ -149,6 +149,10 @@ public void OnPluginStart() public void OnPluginEnd() { + FilterSolidMoved(g_bNoPhysics, 0); + + DHookDisableDetour(g_hUTIL_Remove, false, Detour_OnUTIL_Remove); + for(int i = 0; i < g_iNumEntities; i++) { if(!IsValidEntity(g_aEntityLagData[i].iEntity)) @@ -291,6 +295,8 @@ public void OnRunThinkFunctions(bool simulating) ); #endif } + + FilterSolidMoved(g_bNoPhysics, sizeof(g_bNoPhysics)); } public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2]) @@ -314,10 +320,7 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3 { int simtick = GetGameTickCount() - delta; if(simtick > g_aEntityLagData[i].iDeleted) - { - // TODO: completly block player from touching trigger continue; - } } int iRecordIndex = g_aEntityLagData[i].iRecordIndex - delta; @@ -325,7 +328,7 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3 iRecordIndex += MAX_RECORDS; RestoreEntityFromRecord(g_aEntityLagData[i].iEntity, client, g_aaLagRecords[i][iRecordIndex]); - g_aEntityLagData[i].bRestore = true;//!g_aEntityLagData[i].iDeleted; + g_aEntityLagData[i].bRestore = !g_aEntityLagData[i].iDeleted; #if defined DEBUG LogMessage("2 [%d] index %d, Entity %d -> delta = %d | Record = %d", GetGameTickCount(), i, g_aEntityLagData[i].iEntity, delta, iRecordIndex); @@ -342,6 +345,8 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3 public void OnPostPlayerThinkFunctions() { + FilterSolidMoved(g_bNoPhysics, 0); + for(int i = 0; i < g_iNumEntities; i++) { if(!g_aEntityLagData[i].bRestore) diff --git a/includes/CSSFixes.inc b/includes/CSSFixes.inc index 6d16640f..6e320929 100644 --- a/includes/CSSFixes.inc +++ b/includes/CSSFixes.inc @@ -14,8 +14,17 @@ forward void OnRunThinkFunctionsPost(bool simulating); // REMEMBER TO CALL THIS AGAIN WITH -1 AFTER USING IT !!! native void FilterTriggerMoved(int entity); +// -1 = Ignore, normal operation. +// 0 = Block ALL SV_TriggerMoved. +// >0 = Entity index for which to allow SV_TriggerMoved to be called. +// REMEMBER TO CALL THIS AGAIN WITH -1 AFTER USING IT !!! native void BlockSolidMoved(int entity); +// entities is an array which maps from entindex to a truth value +// if the value is true then SolidMoved will not see this entity +// REMEMBER TO CALL THIS WITH SIZE 0 0N PLUGIN END !!! +native void FilterSolidMoved(int[] entities, int size); + public Extension __ext_CSSFixes = { name = "CSSFixes",