diff --git a/addons/sourcemod/scripting/include/shavit.inc b/addons/sourcemod/scripting/include/shavit.inc index 9d019bf6..5e815b48 100644 --- a/addons/sourcemod/scripting/include/shavit.inc +++ b/addons/sourcemod/scripting/include/shavit.inc @@ -23,7 +23,7 @@ #endif #define _shavit_included -#define SHAVIT_VERSION "2.0.0" +#define SHAVIT_VERSION "2.0.1" #define STYLE_LIMIT 256 #define MAX_ZONES 64 diff --git a/addons/sourcemod/scripting/shavit-core.sp b/addons/sourcemod/scripting/shavit-core.sp index 4abbbc88..b9577ce6 100644 --- a/addons/sourcemod/scripting/shavit-core.sp +++ b/addons/sourcemod/scripting/shavit-core.sp @@ -400,24 +400,11 @@ public void OnMapStart() SetFailState("Could not load the styles configuration file. Make sure it exists (addons/sourcemod/configs/shavit-styles.cfg) and follows the proper syntax!"); } - else - { - Call_StartForward(gH_Forwards_OnStyleConfigLoaded); - Call_PushCell(gI_Styles); - Call_Finish(); - } - // messages if(!LoadMessages()) { SetFailState("Could not load the chat messages configuration file. Make sure it exists (addons/sourcemod/configs/shavit-messages.cfg) and follows the proper syntax!"); } - - else - { - Call_StartForward(gH_Forwards_OnChatConfigLoaded); - Call_Finish(); - } } public void OnMapEnd() @@ -1511,6 +1498,10 @@ bool LoadStyles() gI_Styles = i; gB_Registered = true; + Call_StartForward(gH_Forwards_OnStyleConfigLoaded); + Call_PushCell(gI_Styles); + Call_Finish(); + return true; } @@ -1572,6 +1563,9 @@ bool LoadMessages() ReplaceString(gS_ChatStrings[i], 128, "{RGBA}", "\x08"); } + Call_StartForward(gH_Forwards_OnChatConfigLoaded); + Call_Finish(); + return true; } diff --git a/addons/sourcemod/scripting/shavit-hud.sp b/addons/sourcemod/scripting/shavit-hud.sp index 78fe518f..7229b7fc 100644 --- a/addons/sourcemod/scripting/shavit-hud.sp +++ b/addons/sourcemod/scripting/shavit-hud.sp @@ -677,6 +677,7 @@ void UpdateHUD(int client) { int track = Shavit_GetClientTrack(target); char[] sTrack = new char[32]; + GetTrackName(client, track, sTrack, 32); if(!IsFakeClient(target)) { @@ -728,7 +729,6 @@ void UpdateHUD(int client) if(track != Track_Main) { - GetTrackName(client, track, sTrack, 32); Format(sHintText, 512, "%s[%s] ", sHintText, sTrack); } diff --git a/addons/sourcemod/scripting/shavit-misc.sp b/addons/sourcemod/scripting/shavit-misc.sp index 0078b342..f3eba2bb 100644 --- a/addons/sourcemod/scripting/shavit-misc.sp +++ b/addons/sourcemod/scripting/shavit-misc.sp @@ -1498,19 +1498,6 @@ public Action Command_Tele(int client, int args) } } - CheckpointsCache cpcache[PCPCACHE_SIZE]; - GetCheckpoint(client, index, cpcache); - - float pos[3]; - CopyArray(cpcache[fCPPosition], pos, 3); - - if(IsNullVector(pos)) - { - Shavit_PrintToChat(client, "%T", "MiscCheckpointsEmpty", client, (index + 1), gS_ChatStrings[sMessageWarning], gS_ChatStrings[sMessageText]); - - return Plugin_Handled; - } - TeleportToCheckpoint(client, index, false); return Plugin_Handled; @@ -1705,6 +1692,13 @@ bool SaveCheckpoint(int client, int index) int style = Shavit_GetReplayBotStyle(target); int track = Shavit_GetReplayBotTrack(target); + if(style < 0 || track < 0) + { + Shavit_PrintToChat(client, "%T", "CommandAliveSpectate", client, gS_ChatStrings[sMessageVariable], gS_ChatStrings[sMessageText], gS_ChatStrings[sMessageVariable], gS_ChatStrings[sMessageText]); + + return false; + } + snapshot[bTimerEnabled] = true; snapshot[fCurrentTime] = Shavit_GetReplayTime(style, track); snapshot[bClientPaused] = false; @@ -1737,7 +1731,13 @@ void TeleportToCheckpoint(int client, int index, bool suppressMessage) } CheckpointsCache cpcache[PCPCACHE_SIZE]; - GetCheckpoint(client, index, cpcache); + + if(!GetCheckpoint(client, index, cpcache)) + { + Shavit_PrintToChat(client, "%T", "MiscCheckpointsEmpty", client, (index + 1), gS_ChatStrings[sMessageWarning], gS_ChatStrings[sMessageText]); + + return; + } float pos[3]; CopyArray(cpcache[fCPPosition], pos, 3); diff --git a/addons/sourcemod/scripting/shavit-replay.sp b/addons/sourcemod/scripting/shavit-replay.sp index ab653a21..fdc096e8 100644 --- a/addons/sourcemod/scripting/shavit-replay.sp +++ b/addons/sourcemod/scripting/shavit-replay.sp @@ -401,6 +401,11 @@ public int Native_GetReplayTime(Handle handler, int numParams) int style = GetNativeCell(1); int track = GetNativeCell(2); + if(style < 0 || track < 0) + { + return view_as(0.0); + } + if(gB_CentralBot) { if(gA_CentralCache[iCentralReplayStatus] == Replay_End) diff --git a/addons/sourcemod/scripting/shavit-wr.sp b/addons/sourcemod/scripting/shavit-wr.sp index 6dda74f0..466db154 100644 --- a/addons/sourcemod/scripting/shavit-wr.sp +++ b/addons/sourcemod/scripting/shavit-wr.sp @@ -173,15 +173,6 @@ public void OnPluginStart() // cache gA_ValidMaps = new ArrayList(192); - for(int i = 0; i < STYLE_LIMIT; i++) - { - for(int j = 0; j < TRACKS_SIZE; j++) - { - gA_Leaderboard[i][j] = new ArrayList(); - gI_RecordAmount[i][j] = 0; - } - } - SQL_SetPrefix(); } @@ -370,7 +361,13 @@ public void Shavit_OnStyleConfigLoaded(int styles) { if(i < styles) { + if(gA_Leaderboard[i][j] == null) + { + gA_Leaderboard[i][j] = new ArrayList(); + } + gA_Leaderboard[i][j].Clear(); + gI_RecordAmount[i][j] = 0; } else @@ -544,7 +541,7 @@ public int Native_GetRankForTime(Handle handler, int numParams) int style = GetNativeCell(1); int track = GetNativeCell(3); - if(gA_Leaderboard[style][track].Length == 0) + if(gA_Leaderboard[style][track] == null || gA_Leaderboard[style][track].Length == 0) { return 1; }