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
This commit is contained in:
shavit 2018-01-25 01:18:13 +02:00
parent 3a0f133da2
commit 132d3d80e2
2 changed files with 23 additions and 7 deletions

View File

@ -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<int>(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)
{

View File

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