Handle null players kind of
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-22 17:19:53 +00:00
parent 6daa5953ca
commit 4cd43629b3
2 changed files with 40 additions and 4 deletions

View File

@ -2326,7 +2326,15 @@ public void VScript_OnScriptVMInitialized()
MRESReturn Detour_Timer_SetCheckpointCustomData(DHookParam params)
{
int client = VScript_HScriptToEntity(params.Get(1));
HSCRIPT clienthandle = params.Get(1);
if (clienthandle == view_as<HSCRIPT>(0))
{
// null object passed in probably
return MRES_Supercede;
}
int client = VScript_HScriptToEntity(clienthandle);
if (client < 1 || client > MaxClients || !IsClientInGame(client))
{
@ -2352,7 +2360,15 @@ MRESReturn Detour_Timer_SetCheckpointCustomData(DHookParam params)
MRESReturn Detour_Timer_GetCheckpointCustomData(DHookReturn hret, DHookParam params)
{
int client = VScript_HScriptToEntity(params.Get(1));
HSCRIPT clienthandle = params.Get(1);
if (clienthandle == view_as<HSCRIPT>(0))
{
// null object passed in probably
return MRES_Supercede;
}
int client = VScript_HScriptToEntity(clienthandle);
if (client < 1 || client > MaxClients || !IsClientInGame(client))
{

View File

@ -3929,11 +3929,21 @@ public void VScript_OnScriptVMInitialized()
MRESReturn Detour_Timer_GetTime(DHookReturn hret, DHookParam params)
{
int client = VScript_HScriptToEntity(params.Get(1));
HSCRIPT clienthandle = params.Get(1);
if (clienthandle == view_as<HSCRIPT>(0))
{
// null object passed in probably
hret.Value = 0.0;
return MRES_Supercede;
}
int client = VScript_HScriptToEntity(clienthandle);
if (client < 1 || client > MaxClients || !IsClientInGame(client))
{
// Log error or something...
hret.Value = 0.0;
return MRES_Supercede;
}
@ -3944,11 +3954,21 @@ MRESReturn Detour_Timer_GetTime(DHookReturn hret, DHookParam params)
MRESReturn Detour_Timer_GetStatus(DHookReturn hret, DHookParam params)
{
int client = VScript_HScriptToEntity(params.Get(1));
HSCRIPT clienthandle = params.Get(1);
if (clienthandle == view_as<HSCRIPT>(0))
{
// null object passed in probably
hret.Value = 0;
return MRES_Supercede;
}
int client = VScript_HScriptToEntity(clienthandle);
if (client < 1 || client > MaxClients || !IsClientInGame(client))
{
// Log error or something...
hret.Value = 0;
return MRES_Supercede;
}