Skip to content

Commit 52df730

Browse files
committed
VScript_GetGlobalFunction is worthless garbage
1 parent 1376f3b commit 52df730

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

addons/sourcemod/scripting/shavit-checkpoints.sp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2287,22 +2287,23 @@ public any Native_SaveCheckpointCache(Handle plugin, int numParams)
22872287
return SetNativeArray(3, cache, sizeof(cp_cache_t));
22882288
}
22892289

2290+
// This is called after mapspawn.nut for reference. (Which is before OnMapStart() too)
22902291
public void VScript_OnScriptVMInitialized()
22912292
{
22922293
delete gH_VScript_Timer_OnCheckpointSave;
22932294
delete gH_VScript_Timer_OnCheckpointLoadPre;
22942295
delete gH_VScript_Timer_OnCheckpointLoadPost;
22952296

22962297
// ::Timer_OnCheckpointSave <- function(player)
2297-
if (VScript_GetGlobalFunction("Timer_OnCheckpointSave"))
2298+
if (HSCRIPT_RootTable.ValueExists("Timer_OnCheckpointSave"))
22982299
gH_VScript_Timer_OnCheckpointSave = new VScriptExecute(HSCRIPT_RootTable.GetValue("Timer_OnCheckpointSave"));
22992300

23002301
// ::Timer_OnCheckpointLoadPre <- function(player)
2301-
if (VScript_GetGlobalFunction("Timer_OnCheckpointLoadPre"))
2302+
if (HSCRIPT_RootTable.ValueExists("Timer_OnCheckpointLoadPre"))
23022303
gH_VScript_Timer_OnCheckpointLoadPre = new VScriptExecute(HSCRIPT_RootTable.GetValue("Timer_OnCheckpointLoadPre"));
23032304

23042305
// ::Timer_OnCheckpointLoadPost <- function(player)
2305-
if (VScript_GetGlobalFunction("Timer_OnCheckpointLoadPost"))
2306+
if (HSCRIPT_RootTable.ValueExists("Timer_OnCheckpointLoadPost"))
23062307
gH_VScript_Timer_OnCheckpointLoadPost = new VScriptExecute(HSCRIPT_RootTable.GetValue("Timer_OnCheckpointLoadPost"));
23072308

23082309
// function Timer_SetCheckpointCustomData(player, key, value)

addons/sourcemod/scripting/shavit-core.sp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3926,17 +3926,18 @@ void UpdateStyleSettings(int client)
39263926
}
39273927
}
39283928

3929+
// This is called after mapspawn.nut for reference. (Which is before OnMapStart() too)
39293930
public void VScript_OnScriptVMInitialized()
39303931
{
39313932
delete gH_VScript_OnStart;
39323933
delete gH_VScript_OnFinish;
39333934

39343935
// ::Timer_OnStart <- function(player)
3935-
if (VScript_GetGlobalFunction("Timer_OnStart"))
3936+
if (HSCRIPT_RootTable.ValueExists("Timer_OnStart"))
39363937
gH_VScript_OnStart = new VScriptExecute(HSCRIPT_RootTable.GetValue("Timer_OnStart"));
39373938

39383939
// ::Timer_OnFinish <- function(player)
3939-
if (VScript_GetGlobalFunction("Timer_OnFinish"))
3940+
if (HSCRIPT_RootTable.ValueExists("Timer_OnFinish"))
39403941
gH_VScript_OnFinish = new VScriptExecute(HSCRIPT_RootTable.GetValue("Timer_OnFinish"));
39413942

39423943
// function Timer_GetTime(player) // returns a float

0 commit comments

Comments
 (0)