Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

Commit

Permalink
Bug Fixes:
Browse files Browse the repository at this point in the history
Fixed a issue with multiple records of the same player showing up in WRCP menu
Fixed total bonus count being incorrect
Fixed checkpoint enforcer not working on bonuses
Fixed a issue where custom titles wouldn't display on the scoreboard
Deleting a bonus no longer tries to move any bonuses above the one that was deleted by 1
Added new convar ck_slay_on_round_end - If enabled, all players will be slain on round end. If disabled all players timers will be stopped on round end
  • Loading branch information
tomtko committed Mar 17, 2018
1 parent 6f44c6a commit 83506d7
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 14 deletions.
Binary file modified addons/sourcemod/plugins/surftimer.smx
Binary file not shown.
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/SurfTimer.sp
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,7 @@ public void OnMapStart()
if (g_hTriggerMultiple != null)
CloseHandle(g_hTriggerMultiple);

g_hTriggerMultiple = CreateArray(128);
g_hTriggerMultiple = CreateArray(256);
while ((iEnt = FindEntityByClassname(iEnt, "trigger_multiple")) != -1)
{
PushArrayCell(g_hTriggerMultiple, iEnt);
Expand Down
3 changes: 3 additions & 0 deletions addons/sourcemod/scripting/surftimer/convars.sp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ ConVar g_hSoundPathWRCP = null;
char g_szSoundPathWRCP[PLATFORM_MAX_PATH];
char g_szRelativeSoundPathWRCP[PLATFORM_MAX_PATH];
ConVar g_hMustPassCheckpoints = null;
ConVar g_hSlayOnRoundEnd = null;

void CreateConVars()
{
Expand Down Expand Up @@ -400,6 +401,8 @@ void CreateConVars()

g_hMustPassCheckpoints = CreateConVar("ck_enforce_checkpoints", "1", "Sets whether a player must pass all checkpoints to finish their run. Enable/Disable");

g_hSlayOnRoundEnd = CreateConVar("ck_slay_on_round_end", "1", "If enabled, all players will be slain on round end. If disabled all players timers will be stopped on round end");

// Server Name
g_hHostName = FindConVar("hostname");
HookConVarChange(g_hHostName, OnSettingChanged);
Expand Down
22 changes: 18 additions & 4 deletions addons/sourcemod/scripting/surftimer/misc.sp
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,10 @@ public void SetClientDefaults(int client)
g_iWaitingForResponse[client] = -1;

g_iMenuPosition[client] = 0;

// Set default stage maybe
for (int i = 0; i < MAXZONEGROUPS; i++)
g_Stage[i][client] = 1;
}

// public void clearPlayerCheckPoints(int client)
Expand Down Expand Up @@ -3622,11 +3626,21 @@ public void SideHudAlive(int client)
else
Format(szWR, 128, "%s", g_szLastSRDifference[client]);
char szWRHolder[64];
if (g_iClientInZone[client][2] == 0)
Format(szWRHolder, 64, g_szRecordPlayer);
else
Format(szWRHolder, 64, g_szBonusFastest[g_iClientInZone[client][2]]);
if (style == 0)
{
if (g_iClientInZone[client][2] == 0)
Format(szWRHolder, 64, g_szRecordPlayer);
else
Format(szWRHolder, 64, g_szBonusFastest[g_iClientInZone[client][2]]);

}
else
{
if (g_iClientInZone[client][2] == 0)
Format(szWRHolder, 64, g_szRecordPlayer);
else
Format(szWRHolder, 64, g_szBonusFastest[g_iClientInZone[client][2]]);
}
Format(szModule[i], 256, "%s\nby %s", szWR, szWRHolder);

if ((i + 1) != moduleCount)
Expand Down
12 changes: 6 additions & 6 deletions addons/sourcemod/scripting/surftimer/sql.sp
Original file line number Diff line number Diff line change
Expand Up @@ -4088,14 +4088,14 @@ public int db_deleteZonesInGroup(int client)
Format(szQuery, 258, sql_deleteZonesInGroup, g_szMapName, g_CurrentSelectedZoneGroup[client]);
SQL_AddQuery(h_DeleteZoneGroup, szQuery);

Format(szQuery, 258, "UPDATE ck_zones SET zonegroup = zonegroup-1 WHERE zonegroup > %i AND mapname = '%s';", g_CurrentSelectedZoneGroup[client], g_szMapName);
SQL_AddQuery(h_DeleteZoneGroup, szQuery);
// Format(szQuery, 258, "UPDATE ck_zones SET zonegroup = zonegroup-1 WHERE zonegroup > %i AND mapname = '%s';", g_CurrentSelectedZoneGroup[client], g_szMapName);
// SQL_AddQuery(h_DeleteZoneGroup, szQuery);

Format(szQuery, 258, "DELETE FROM ck_bonus WHERE zonegroup = %i AND mapname = '%s';", g_CurrentSelectedZoneGroup[client], g_szMapName);
SQL_AddQuery(h_DeleteZoneGroup, szQuery);

Format(szQuery, 258, "UPDATE ck_bonus SET zonegroup = zonegroup-1 WHERE zonegroup > %i AND mapname = '%s';", g_CurrentSelectedZoneGroup[client], g_szMapName);
SQL_AddQuery(h_DeleteZoneGroup, szQuery);
// Format(szQuery, 258, "UPDATE ck_bonus SET zonegroup = zonegroup-1 WHERE zonegroup > %i AND mapname = '%s';", g_CurrentSelectedZoneGroup[client], g_szMapName);
// SQL_AddQuery(h_DeleteZoneGroup, szQuery);

SQL_ExecuteTransaction(g_hDb, h_DeleteZoneGroup, SQLTxn_ZoneGroupRemovalSuccess, SQLTxn_ZoneGroupRemovalFailed, client);

Expand Down Expand Up @@ -5672,7 +5672,7 @@ public int FinishedMapsMenuHandler(Handle menu, MenuAction action, int client, i
public void db_selectTotalBonusCount()
{
char szQuery[512];
Format(szQuery, 512, "SELECT COUNT(DISTINCT `mapname`, `zonetypeid`) FROM `ck_zones` WHERE `zonetypeid` = 0 AND `zonegroup` > 0");
Format(szQuery, 512, "SELECT COUNT(DISTINCT `mapname`, `zonetypeid`, `zonegroup`) FROM `ck_zones` WHERE `zonetypeid` = 0 AND `zonegroup` > 0");
SQL_TQuery(g_hDb, sql_selectTotalBonusCountCallback, szQuery, DBPrio_Low);
}

Expand Down Expand Up @@ -6383,7 +6383,7 @@ public void sql_viewWrcpMapRecordCallback(Handle owner, Handle hndl, const char[
public void db_selectStageTopSurfers(int client, char info[32], char mapname[128])
{
char szQuery[1024];
Format(szQuery, 1024, "SELECT db2.steamid, db1.name, db2.runtimepro as overall, db1.steamid, db2.mapname FROM ck_wrcps as db2 INNER JOIN ck_playerrank as db1 on db2.steamid = db1.steamid WHERE db2.mapname = '%s' AND db2.runtimepro > -1.0 AND db2.stage = %i AND db2.style = 0 ORDER BY overall ASC LIMIT 50;", mapname, info);
Format(szQuery, 1024, "SELECT db2.steamid, db1.name, db2.runtimepro as overall, db1.steamid, db2.mapname FROM ck_wrcps as db2 INNER JOIN ck_playerrank as db1 on db2.steamid = db1.steamid WHERE db2.mapname = '%s' AND db2.runtimepro > -1.0 AND db2.stage = %i AND db1.style = 0 AND db2.style = 0 ORDER BY overall ASC LIMIT 50;", mapname, info);
Handle pack = CreateDataPack();
WritePackCell(pack, client);
// WritePackCell(pack, stage);
Expand Down
3 changes: 2 additions & 1 deletion addons/sourcemod/scripting/surftimer/sql2.sp
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ public void db_viewCustomTitles(int client, char[] szSteamID)
Handle pack = CreateDataPack();
WritePackCell(pack, client);
WritePackString(pack, szSteamID);
Format(szQuery, 728, "SELECT `title`, `namecolour`, `textcolour`, `inuse`, `vip`, `zoner`, `joinmsg`, `pbsound`, `topsound`, `wrsound` FROM `ck_vipadmins` WHERE `steamid` = '%s'", szSteamID);
Format(szQuery, 728, "SELECT `title`, `namecolour`, `textcolour`, `inuse`, `vip`, `zoner`, `joinmsg` FROM `ck_vipadmins` WHERE `steamid` = '%s'", szSteamID);
SQL_TQuery(g_hDb, SQL_viewCustomTitlesCallback, szQuery, pack, DBPrio_Low);
}

Expand Down Expand Up @@ -624,6 +624,7 @@ public void SQL_viewCustomTitlesCallback(Handle owner, Handle hndl, const char[]
Format(szTitle, 1024, "%s", g_szCustomTitleColoured[client]);
parseColorsFromString(szTitle, 1024);
Format(g_pr_rankname[client], 1024, "%s", szTitle);
Format(g_pr_rankname_style[client], 1024, "%s", szTitle);
Format(g_szCustomTitle[client], 1024, "%s", szTitle);

if (!SQL_IsFieldNull(hndl, 6) && IsPlayerVip(client, true, false))
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/surftimer/surfzones.sp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public void StartTouch(int client, int action[3])

if (g_bToggleMapFinish[client])
{
if (GetConVarBool(g_hMustPassCheckpoints) && g_iTotalCheckpoints > 0)
if (GetConVarBool(g_hMustPassCheckpoints) && g_iTotalCheckpoints > 0 && action[2] == 0)
{
if (g_bIsValidRun[client])
CL_OnEndTimerPress(client);
Expand Down
8 changes: 7 additions & 1 deletion addons/sourcemod/scripting/surftimer/timer.sp
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,16 @@ public Action SetClanTag(Handle timer, any client)
public Action TerminateRoundTimer(Handle timer)
{
CS_TerminateRound(1.0, CSRoundEnd_CTWin, true);
bool bSlay = GetConVarBool(g_hSlayOnRoundEnd);
for (int i = 0; i <= MaxClients; i++)
{
if (IsValidClient(i) && !IsFakeClient(i))
ForcePlayerSuicide(i);
{
if (bSlay)
ForcePlayerSuicide(i);
else
Client_Stop(i, 1);
}
}
return Plugin_Handled;
}
Expand Down

0 comments on commit 83506d7

Please sign in to comment.