diff --git a/RaceTimer/scripting/unloze_racetimer_redux.sp b/RaceTimer/scripting/unloze_racetimer_redux.sp index ac1276de..46cc3e24 100644 --- a/RaceTimer/scripting/unloze_racetimer_redux.sp +++ b/RaceTimer/scripting/unloze_racetimer_redux.sp @@ -12,6 +12,8 @@ #include #include #include +#include +#include #pragma newdecls required char g_cMapname[g_dLength]; char g_cSpecialMapStart[g_dLength]; @@ -55,6 +57,10 @@ public void OnPluginStart() RegAdminCmd("sm_cleantime", Cmd_timeReset, ADMFLAG_GENERIC); //hooks HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy); + HookEntityOutput("trigger_multiple", "OnTrigger", Trigger_Multiple); + HookEntityOutput("trigger_multiple", "OnStartTouch", Trigger_Multiple); + HookEntityOutput("trigger_teleport", "OnTrigger", trigger_teleport); + HookEntityOutput("trigger_teleport", "OnStartTouch", trigger_teleport); //HUD hText = CreateHudSynchronizer(); //cookies @@ -67,6 +73,54 @@ public void OnPluginStart() } } +public void trigger_teleport(const char[] output, int entity_index, int client, float delay) +{ + if (IsValidEdict(entity_index) && g_bHumansAllowedTime[client]) + { + if (StrContains(g_cMapname, "surf", false) == -1) + { + g_bHumansAllowedTime[client] = false; + resetClientVectors(client); + PrintToChat(client, "Disabled timer due to potential teleport abuse, if this is wrong annoy jenz on discord"); + } + } +} + +public void Trigger_Multiple(const char[] output, int entity_index, int client, float delay) +{ + if (IsValidEdict(entity_index) && origin_command_check(entity_index) && g_bHumansAllowedTime[client]) + { + if (StrContains(g_cMapname, "surf", false) == -1) + { + g_bHumansAllowedTime[client] = false; + resetClientVectors(client); + PrintToChat(client, "Disabled timer due to potential teleport abuse, if this is wrong annoy jenz on discord"); + } + } +} + + +public bool origin_command_check(int entity_index) +{ + int count_trigger = GetOutputCount(entity_index, "m_OnTrigger"); + int count_starttouch = GetOutputCount(entity_index, "m_OnStartTouch"); + for (int i = 0; i < count_trigger; i++) + { + char buffer[g_dLength]; + GetOutputParameter(entity_index, "m_OnTrigger", i, buffer, sizeof(buffer)); + if (StrContains(buffer, "origin", true) != -1) + return true; + } + for (int i = 0; i < count_starttouch; i++) + { + char buffer[g_dLength]; + GetOutputParameter(entity_index, "m_OnStartTouch", i, buffer, sizeof(buffer)); + if (StrContains(buffer, "origin", true) != -1) + return true; + } + return false; +} + //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- @@ -361,7 +415,7 @@ public bool checkClientOrigin(float oldVals[3], float newVals[3], int client) { return false; } - float teleport_range = 9000000.0; + float teleport_range = 1090450.0; int velocityCap = 625; float distance = GetVectorDistance(oldVals, newVals, true); //PrintToChatAll("distance: %f", distance);