Skip to content

Commit 01b3153

Browse files
BaradPexxIAMJacobChristiansenshipyytslashd
authored
Merge dev into Master for new Release (#540)
* Test server should based on dev branch * Allow pr tests against the dev branch * Upload build packages for dev branch too * Remove artifact after one month * remove old code, wait 2 frames before setting velocity to 0 (#518) * Update fresh_install.sql (#519) Fixed errors. * Add missing ck_replays table (#520) * Fix version in error message (#521) * --wrong value on check (#522) * fix for #524 (#525) * --fix style records/forwards * --added oldtime var for styles --added time difference between old and new server style record to printed phrase --actually fixed issues(?) * --missing set values for new var * --missing indexation * --wrong format * Rename some files for clarity for updating tables * Add semicolons (#528) * Use LogStackTrace instead of LogError (#530) Usage of sizeof instead of hardcoded size * Add radar images to DownloadTable (#529) * add radar images to download table * remove colon from readme * add surf load screens to readme * Add EU test server to workflow * Add EU test server to README.md * Fix chat processor for our commands (#533) * Log query times (#531) * Hello World * Hello World * Print each query time into server console while startup * Log query times into logs/surftimer/<map>.log logs * Update globals.sp (#536) if database name is greater than 32 then will get following error [SM] Exception reported: More/Less then 1 rows? RowCount: 0, Table: ck_bonus, Column: runtime [SM] Blaming: SurfTimer.smx [SM] Call stack trace: [SM] [0] SetFailState [SM] [1] Line 241, surftimer/db/updater.sp::SQLCheckDataType * Increase name length (#534) * Increase name length from 32 to 128 * Increase name size per updater * Add missing tables * Update VARCHAR size in fresh_install.sql * Skip error check to prevent invalid error * 128 -> 64 * practice mode changes (#539) * practice mode changes * remove timer function * forgot this timer seperates stuff into a million different functions :) * add mapper names to ck_maptier (#538) * add mapper names to ck_maptier * use translation * readme: improve installation + requirements docs (#537) * readme: improve installation + requirements docs * readme: EndTouchFix note update * readme: EndTouchFix note update Co-authored-by: dPexxIAM <38400978+dPexxIAM@users.noreply.github.com> Co-authored-by: Jacob Christiansen <kin.jacob.chr@gmail.com> Co-authored-by: shipyy <70631212+shipyy@users.noreply.github.com> Co-authored-by: T <74899888+tslashd@users.noreply.github.com> Co-authored-by: Kyle <kyle@kxnrl.com> Co-authored-by: 8guawong <8guawong@gmail.com> Co-authored-by: Markus <mark@saiko.tech>
1 parent 838f2a2 commit 01b3153

File tree

19 files changed

+2064
-418
lines changed

19 files changed

+2064
-418
lines changed

.github/workflows/test_server.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,18 @@ jobs:
8989
done
9090
working-directory: ${{ env.SCRIPTING_PATH }}
9191

92-
- name: Upload files
92+
- name: Upload files to EU
93+
uses: SamKirkland/FTP-Deploy-Action@2.0.0
94+
env:
95+
FTP_SERVER: ${{ secrets.SFTP_HOST_EU }}
96+
FTP_USERNAME: ${{ secrets.SFTP_USER_EU }}
97+
FTP_PASSWORD: ${{ secrets.SFTP_PASS_EU }}
98+
LOCAL_DIR: upload
99+
METHOD: sftp
100+
PORT: ${{ secrets.SFTP_PORT_EU }}
101+
ARGS: --no-empty-dirs
102+
103+
- name: Upload files to NA
93104
uses: SamKirkland/FTP-Deploy-Action@2.0.0
94105
env:
95106
FTP_SERVER: ${{ secrets.SFTP_HOST }}
@@ -100,7 +111,17 @@ jobs:
100111
PORT: ${{ secrets.SFTP_PORT }}
101112
ARGS: --no-empty-dirs
102113

103-
- name: Restart test server
114+
- name: Restart EU test server
115+
shell: bash
116+
run: |
117+
curl --request POST \
118+
--url ${{ secrets.BASE_URL_EU }}api/client/servers/${{ secrets.SERVER_ID_EU }}/power \
119+
--header 'Accept: application/json' \
120+
--header 'Authorization: Bearer ${{ secrets.API_KEY_EU }}' \
121+
--header 'Content-Type: application/json' \
122+
--data '{ "signal": "restart" }'
123+
124+
- name: Restart NA test server
104125
shell: bash
105126
run: |
106127
curl --request POST \

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This is an open source timer plugin made for CS:GO.
66

77
SurfTimer Test Servers:
88
- North America: `connect na-test-server.surftimer.dev`
9+
- Europe: `connect eu-test-server.surftimer.dev:27045`
910

1011
## Project Goals
1112

@@ -37,16 +38,16 @@ Less bugs = better experience = more players for surf!
3738
* Download and install [Metamod 1.11](https://www.sourcemm.net/downloads.php/?branch=stable)
3839
* Download and install [SourceMod 1.10](https://www.sourcemod.net/downloads.php?branch=stable) (latest stable) or [SourceMod 1.11](https://www.sourcemod.net/downloads.php?branch=master&all=1) (required for some recommended plugins)
3940
* Download latest [release](https://github.com/surftimer/SurfTimer/releases/latest) and upload all the files to your csgo server directory
40-
* Set up A MySQL Database (MySQL 5.7, MySQL 8+, MariaDB supported)
41+
* Set up A MySQL Database (MySQL 5.7, MySQL 8+, MariaDB supported) and [initialise a schema for surftimer](https://github.com/surftimer/SurfTimer/blob/master/scripts/mysql-files/fresh_install.sql)
4142
* Add a MySQL database called surftimer to csgo/addons/sourcemod/configs/databases.cfg
42-
* Ensure [End-Touch-Fix](https://github.com/rumourA/End-Touch-Fix) is loaded, this is required to ensure times are always accurate
43+
* Ensure [End-Touch-Fix](https://github.com/rumourA/End-Touch-Fix) is loaded, this is required to ensure times are always accurate (note: this is included in the official SurfTimer release build and loaded automatically without installing separately unless you are compiling SurfTimer yourself)
4344
* Ensure you have added all the requirements below
4445

4546
## Installation common errors
4647
<details>
4748
<summary>[SurfTimer] Database tables could not be created! Error: Lost connection to MySQL server during query</summary>
4849

49-
Run the following [queries](https://github.com/surftimer/SurfTimer/blob/master/scripts/mysql-files/fresh_install.sql) on your database:
50+
Run the following [queries](https://github.com/surftimer/SurfTimer/blob/master/scripts/mysql-files/fresh_install.sql) on your database
5051

5152
</details>
5253

@@ -73,10 +74,15 @@ Run the following queries on your database:
7374
## Requirements
7475

7576
**SourceMod Extensions**
76-
* [DHooks](https://github.com/peace-maker/DHooks2)
77+
* (\*) [DHooks](https://github.com/peace-maker/DHooks2)
7778
* *(recommended)* [Cleaner](https://github.com/Accelerator74/Cleaner) - Suppresses server console warnings
7879

80+
(\*) *Already included with SourceMod 1.11.6820 and newer*
81+
7982
**SourceMod Libraries**
83+
84+
ℹ️ SourceMod Libraries are only required if you are compiling SurfTimer yourself
85+
8086
* [SMLib](https://github.com/bcserv/smlib/tree/transitional_syntax)
8187
* [ColorLib](https://github.com/c0rp3n/colorlib-sm)
8288
* [AutoExecConfig](https://github.com/Impact123/AutoExecConfig)
@@ -96,6 +102,7 @@ Run the following queries on your database:
96102
* *(recommended)* [Stripper:Source](http://www.bailopan.net/stripper/) - Allows adding/modifying/removing entities from a map before it loads (config files included)
97103
* *(optional)* [Surftimer-Web-Stats](https://github.com/KristianP26/Surftimer-Web-Stats) - Web statistics
98104
* *(optional)* [Surftimer-Discord-Bot](https://github.com/Sarrus1/SurfTimer-Discord-Bot) - Discord BOT
105+
* *(optional)* [CSGO-Surf-Load-Screens](https://github.com/Sayt123/CSGO-Surf-Load-Screens) - Map loading images for surf maps
99106

100107
## Upgrading
101108

addons/sourcemod/scripting/SurfTimer.sp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ public void OnMapStart()
159159
// Get mapname
160160
GetCurrentMap(g_szMapName, 128);
161161

162+
// Download map radar image if existing
163+
AddRadarImages();
164+
162165
// Create nav file
163166
CreateNavFile();
164167

@@ -177,22 +180,26 @@ public void OnMapStart()
177180

178181
// Load spawns
179182
if (!g_bRenaming && !g_bInTransactionChain)
183+
{
180184
checkSpawnPoints();
185+
}
181186

182187
db_viewMapSettings();
183188

184189
/// Start Loading Server Settings
185190
ConVar cvHibernateWhenEmpty = FindConVar("sv_hibernate_when_empty");
186191

187-
if(g_tables_converted){
192+
if(g_tables_converted)
193+
{
188194
if (!g_bRenaming && !g_bInTransactionChain && (IsServerProcessing() || !cvHibernateWhenEmpty.BoolValue))
189195
{
190-
LogToFileEx(g_szLogFile, "[surftimer] Starting to load server settings");
196+
LogQueryTime("[surftimer] Starting to load server settings");
191197
g_fServerLoading[0] = GetGameTime();
192198
db_selectMapZones();
193199
}
194200
}
195-
else{
201+
else
202+
{
196203
CreateTimer(1.0, DatabaseUpgrading, INVALID_HANDLE, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
197204
}
198205

@@ -214,7 +221,9 @@ public void OnMapStart()
214221
}
215222

216223
for (int i = 0; i < MAX_STYLES; i++)
224+
{
217225
g_bReplayTickFound[i] = false;
226+
}
218227

219228
// Precache
220229
InitPrecache();
@@ -246,7 +255,9 @@ public void OnMapStart()
246255
// Hook Zones
247256
iEnt = -1;
248257
if (g_hTriggerMultiple != null)
258+
{
249259
CloseHandle(g_hTriggerMultiple);
260+
}
250261

251262
g_hTriggerMultiple = CreateArray(256);
252263
while ((iEnt = FindEntityByClassname(iEnt, "trigger_multiple")) != -1)

addons/sourcemod/scripting/surftimer/admin.sp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,33 @@ public int TopMenuHandler2(Handle topmenu, TopMenuAction action, TopMenuObject o
5151
return 0;
5252
}
5353

54+
public Action Admin_insertMapperName(int client, int args)
55+
{
56+
if (!IsValidClient(client))
57+
return Plugin_Handled;
58+
59+
if (!IsPlayerZoner(client))
60+
{
61+
CReplyToCommand(client, "%t", "AdminMapperName", g_szChatPrefix);
62+
return Plugin_Handled;
63+
}
64+
65+
if (args == 0)
66+
{
67+
CReplyToCommand(client, "%t", "MapperNameUsage", g_szChatPrefix);
68+
return Plugin_Handled;
69+
}
70+
else
71+
{
72+
char arg1[64];
73+
//char sMapperName[64];
74+
GetCmdArgString(arg1, sizeof(arg1));
75+
76+
db_insertMapperName(client, arg1);
77+
}
78+
return Plugin_Handled;
79+
}
80+
5481
public Action Admin_insertMapTier(int client, int args)
5582
{
5683
if (!IsValidClient(client))

addons/sourcemod/scripting/surftimer/buttonpress.sp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ public void CL_OnEndTimerPress(int client)
704704
else if (style != 0)
705705
{
706706
g_fPBDifference_Bonus[client][style][zGroup] = g_fFinalTime[client] - g_fStylePersonalRecordBonus[style][zGroup][client];
707-
g_fWRDifference_Bonus[client][style][zGroup] = g_fFinalTime[client] - g_fStyleBonusFastest[style][zGroup]
707+
g_fWRDifference_Bonus[client][style][zGroup] = g_fFinalTime[client] - g_fStyleBonusFastest[style][zGroup];
708708

709709
if (GetConVarBool(g_hReplaceReplayTime) && (g_fFinalTime[client] < g_fReplayTimes[zGroup][style] || g_fReplayTimes[zGroup][style] == 0.0))
710710
{

addons/sourcemod/scripting/surftimer/commands.sp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ void CreateCommands()
108108
RegConsoleCmd("sm_hookzone", Command_HookZones, "[surftimer] [zoner] Opens up zone hook creation menu.");
109109
RegConsoleCmd("sm_addmaptier", Admin_insertMapTier, "[surftimer] [zoner] Changes maps tier");
110110
RegConsoleCmd("sm_amt", Admin_insertMapTier, "[surftimer] [zoner] Changes maps tier");
111+
RegConsoleCmd("sm_amn", Admin_insertMapperName, "[surftimer] [zoner] Adds mapper name to DB.");
112+
RegConsoleCmd("sm_addmappername", Admin_insertMapperName, "[surftimer] [zoner] Adds mapper name to DB.");
111113
RegConsoleCmd("sm_addspawn", Admin_insertSpawnLocation, "[surftimer] [zoner] Changes the position !r takes players to");
112114
RegConsoleCmd("sm_delspawn", Admin_deleteSpawnLocation, "[surftimer] [zoner] Removes custom !r position");
113115
RegConsoleCmd("sm_mapsettings", Admin_MapSettings, "[surftimer] [zoner] Displays menu containing various options to change map settings");
@@ -625,7 +627,10 @@ public Action Command_normalMode(int client, int args)
625627
return Plugin_Handled;
626628

627629
Client_Stop(client, 1);
628-
CreateTimer(0.1, DisablePrac, GetClientSerial(client));
630+
631+
if (g_bPracticeMode[client])
632+
g_bPracticeMode[client] = false;
633+
629634
Command_Restart(client, 1);
630635

631636
CPrintToChat(client, "%t", "PracticeNormal", g_szChatPrefix);
@@ -1250,7 +1255,7 @@ public Action Command_ToBonus(int client, int args)
12501255

12511256
if (g_bPracticeMode[client])
12521257
{
1253-
CreateTimer(0.1, DisablePrac, GetClientSerial(client));
1258+
g_bPracticeMode[client] = false;
12541259
CPrintToChat(client, "%t", "PracticeNormal", g_szChatPrefix);
12551260
}
12561261
return Plugin_Handled;
@@ -1375,7 +1380,7 @@ public Action Command_ToStage(int client, int args)
13751380

13761381
if (g_bPracticeMode[client])
13771382
{
1378-
CreateTimer(0.1, DisablePrac, GetClientSerial(client));
1383+
g_bPracticeMode[client] = false;
13791384
CPrintToChat(client, "%t", "PracticeNormal", g_szChatPrefix);
13801385
}
13811386

@@ -1438,7 +1443,7 @@ public Action Command_Restart(int client, int args)
14381443
teleportClient(client, 0, 1, true);
14391444
if (g_bPracticeMode[client])
14401445
{
1441-
CreateTimer(0.1, DisablePrac, GetClientSerial(client));
1446+
g_bPracticeMode[client] = false;
14421447
CPrintToChat(client, "%t", "PracticeNormal", g_szChatPrefix);
14431448
}
14441449
return Plugin_Handled;

addons/sourcemod/scripting/surftimer/convars.sp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ ConVar g_iHintsInterval = null; // Time between two hints. 0 = off
115115
ConVar g_bHintsRandomOrder = null; // If hints are in random order
116116
ConVar g_hOverrideClantag = null;
117117
ConVar g_hDefaultPreSpeed = null;
118+
ConVar g_hLogQueryTimes = null;
118119

119120
void CreateConVars()
120121
{
@@ -408,6 +409,7 @@ void CreateConVars()
408409
g_hSlayOnRoundEnd = AutoExecConfig_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");
409410

410411
g_hLimitSpeedType = AutoExecConfig_CreateConVar("ck_limit_speed_type", "1", "1 Use new style of limiting speed, 0 use old/cksurf way");
412+
g_hLogQueryTimes = AutoExecConfig_CreateConVar("ck_log_query_times", "1", "Log query times or just print in server console. Default \"0\", it'll just print into servers console.", _, true, 0.0, true, 1.0);
411413

412414
// Server Name
413415
g_hHostName = FindConVar("hostname");

0 commit comments

Comments
 (0)