VScript_GetGlobalFunction is worthless garbage
Some checks failed
Compile / Build SM ${{ matrix.sm-version }} (1.12) (push) Has been cancelled
Compile / Release (push) Has been cancelled

This commit is contained in:
rtldg 2025-03-31 11:17:50 +00:00
parent 1376f3b6ba
commit 52df730a4f
2 changed files with 7 additions and 5 deletions

View File

@ -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)

View File

@ -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