From 132d3d80e29db03fb479bb2ebd7fc24e67df6792 Mon Sep 17 00:00:00 2001 From: shavit Date: Thu, 25 Jan 2018 01:18:13 +0200 Subject: [PATCH] Hacky fix for autorespawn. L 01/24/2018 - 08:49:06: Info (map "bhop_forest") (file "errors_20180124.log") L 01/24/2018 - 08:49:06: [SM] Exception reported: Invalid data pack handle 11503 (error 4) L 01/24/2018 - 08:49:06: [SM] Blaming: shavit-misc.smx L 01/24/2018 - 08:49:06: [SM] Call stack trace: L 01/24/2018 - 08:49:06: [SM] [0] DataPack.Reset L 01/24/2018 - 08:49:06: [SM] [1] Line 2059, E:\git\bhoptimer\addons\sourcemod\scripting\shavit-misc.sp::Respawn --- addons/sourcemod/scripting/shavit-misc.sp | 28 +++++++++++++++---- addons/sourcemod/scripting/shavit-rankings.sp | 2 +- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/addons/sourcemod/scripting/shavit-misc.sp b/addons/sourcemod/scripting/shavit-misc.sp index c2f8c5b3..d601a0fd 100644 --- a/addons/sourcemod/scripting/shavit-misc.sp +++ b/addons/sourcemod/scripting/shavit-misc.sp @@ -2047,18 +2047,34 @@ public void Shavit_OnRestart(int client, int track) } } - DataPack pack = null; - CreateDataTimer(0.1, Respawn, pack, TIMER_FLAG_NO_MAPCHANGE); + DataPack pack = new DataPack(); pack.WriteCell(GetClientSerial(client)); pack.WriteCell(track); + view_as(pack) |= (1 << 24); + + CreateTimer(0.1, Respawn, pack, TIMER_FLAG_NO_MAPCHANGE); } } -public Action Respawn(Handle Timer, DataPack pack) +public Action Respawn(Handle Timer, any data) { - pack.Reset(); - int client = GetClientFromSerial(pack.ReadCell()); - int track = pack.ReadCell(); + int track = Track_Main; + int client = 0; + + if(data & (1 << 24) > 0) + { + data &= ~(1 << 24); + DataPack pack = data; + pack.Reset(); + client = GetClientFromSerial(pack.ReadCell()); + track = pack.ReadCell(); + delete pack; + } + + else + { + client = GetClientFromSerial(data); + } if(IsValidClient(client) && !IsPlayerAlive(client) && GetClientTeam(client) >= 2) { diff --git a/addons/sourcemod/scripting/shavit-rankings.sp b/addons/sourcemod/scripting/shavit-rankings.sp index 618d1134..d7fed7d3 100644 --- a/addons/sourcemod/scripting/shavit-rankings.sp +++ b/addons/sourcemod/scripting/shavit-rankings.sp @@ -20,7 +20,7 @@ // Design idea: // Rank 1 per map/style/track gets ((points per tier * tier) * 1.5) + (rank 1 time in seconds / 15.0) points. -// Records below rank 1 get points% relative to their time in comparison to rank 1 and a final multiplier of 85% to promote rank 1 hunting. +// Records below rank 1 get points% relative to their time in comparison to rank 1. // // Bonus track gets a 0.25* final mutliplier for points and is treated as tier 1. //