From 52df730a4f712eafb372dcf5791e88faa6e91a20 Mon Sep 17 00:00:00 2001 From: rtldg Date: Mon, 31 Mar 2025 11:17:50 +0000 Subject: [PATCH] VScript_GetGlobalFunction is worthless garbage --- addons/sourcemod/scripting/shavit-checkpoints.sp | 7 ++++--- addons/sourcemod/scripting/shavit-core.sp | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/sourcemod/scripting/shavit-checkpoints.sp b/addons/sourcemod/scripting/shavit-checkpoints.sp index 42fc0870..13fe3d0c 100644 --- a/addons/sourcemod/scripting/shavit-checkpoints.sp +++ b/addons/sourcemod/scripting/shavit-checkpoints.sp @@ -2287,6 +2287,7 @@ public any Native_SaveCheckpointCache(Handle plugin, int numParams) return SetNativeArray(3, cache, sizeof(cp_cache_t)); } +// This is called after mapspawn.nut for reference. (Which is before OnMapStart() too) public void VScript_OnScriptVMInitialized() { delete gH_VScript_Timer_OnCheckpointSave; @@ -2294,15 +2295,15 @@ public void VScript_OnScriptVMInitialized() delete gH_VScript_Timer_OnCheckpointLoadPost; // ::Timer_OnCheckpointSave <- function(player) - if (VScript_GetGlobalFunction("Timer_OnCheckpointSave")) + if (HSCRIPT_RootTable.ValueExists("Timer_OnCheckpointSave")) gH_VScript_Timer_OnCheckpointSave = new VScriptExecute(HSCRIPT_RootTable.GetValue("Timer_OnCheckpointSave")); // ::Timer_OnCheckpointLoadPre <- function(player) - if (VScript_GetGlobalFunction("Timer_OnCheckpointLoadPre")) + if (HSCRIPT_RootTable.ValueExists("Timer_OnCheckpointLoadPre")) gH_VScript_Timer_OnCheckpointLoadPre = new VScriptExecute(HSCRIPT_RootTable.GetValue("Timer_OnCheckpointLoadPre")); // ::Timer_OnCheckpointLoadPost <- function(player) - if (VScript_GetGlobalFunction("Timer_OnCheckpointLoadPost")) + if (HSCRIPT_RootTable.ValueExists("Timer_OnCheckpointLoadPost")) gH_VScript_Timer_OnCheckpointLoadPost = new VScriptExecute(HSCRIPT_RootTable.GetValue("Timer_OnCheckpointLoadPost")); // function Timer_SetCheckpointCustomData(player, key, value) diff --git a/addons/sourcemod/scripting/shavit-core.sp b/addons/sourcemod/scripting/shavit-core.sp index 70ee5d2e..68a26a36 100644 --- a/addons/sourcemod/scripting/shavit-core.sp +++ b/addons/sourcemod/scripting/shavit-core.sp @@ -3926,17 +3926,18 @@ void UpdateStyleSettings(int client) } } +// This is called after mapspawn.nut for reference. (Which is before OnMapStart() too) public void VScript_OnScriptVMInitialized() { delete gH_VScript_OnStart; delete gH_VScript_OnFinish; // ::Timer_OnStart <- function(player) - if (VScript_GetGlobalFunction("Timer_OnStart")) + if (HSCRIPT_RootTable.ValueExists("Timer_OnStart")) gH_VScript_OnStart = new VScriptExecute(HSCRIPT_RootTable.GetValue("Timer_OnStart")); // ::Timer_OnFinish <- function(player) - if (VScript_GetGlobalFunction("Timer_OnFinish")) + if (HSCRIPT_RootTable.ValueExists("Timer_OnFinish")) gH_VScript_OnFinish = new VScriptExecute(HSCRIPT_RootTable.GetValue("Timer_OnFinish")); // function Timer_GetTime(player) // returns a float