Skip to content

Commit

Permalink
Merge dev into Master for new Release (#540)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: Jacob Christiansen <[email protected]>
Co-authored-by: shipyy <[email protected]>
Co-authored-by: T <[email protected]>
Co-authored-by: Kyle <[email protected]>
Co-authored-by: 8guawong <[email protected]>
Co-authored-by: Markus <[email protected]>
  • Loading branch information
8 people authored Nov 14, 2022
1 parent 838f2a2 commit 01b3153
Show file tree
Hide file tree
Showing 19 changed files with 2,064 additions and 418 deletions.
25 changes: 23 additions & 2 deletions .github/workflows/test_server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,18 @@ jobs:
done
working-directory: ${{ env.SCRIPTING_PATH }}

- name: Upload files
- name: Upload files to EU
uses: SamKirkland/[email protected]
env:
FTP_SERVER: ${{ secrets.SFTP_HOST_EU }}
FTP_USERNAME: ${{ secrets.SFTP_USER_EU }}
FTP_PASSWORD: ${{ secrets.SFTP_PASS_EU }}
LOCAL_DIR: upload
METHOD: sftp
PORT: ${{ secrets.SFTP_PORT_EU }}
ARGS: --no-empty-dirs

- name: Upload files to NA
uses: SamKirkland/[email protected]
env:
FTP_SERVER: ${{ secrets.SFTP_HOST }}
Expand All @@ -100,7 +111,17 @@ jobs:
PORT: ${{ secrets.SFTP_PORT }}
ARGS: --no-empty-dirs

- name: Restart test server
- name: Restart EU test server
shell: bash
run: |
curl --request POST \
--url ${{ secrets.BASE_URL_EU }}api/client/servers/${{ secrets.SERVER_ID_EU }}/power \
--header 'Accept: application/json' \
--header 'Authorization: Bearer ${{ secrets.API_KEY_EU }}' \
--header 'Content-Type: application/json' \
--data '{ "signal": "restart" }'
- name: Restart NA test server
shell: bash
run: |
curl --request POST \
Expand Down
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This is an open source timer plugin made for CS:GO.

SurfTimer Test Servers:
- North America: `connect na-test-server.surftimer.dev`
- Europe: `connect eu-test-server.surftimer.dev:27045`

## Project Goals

Expand Down Expand Up @@ -37,16 +38,16 @@ Less bugs = better experience = more players for surf!
* Download and install [Metamod 1.11](https://www.sourcemm.net/downloads.php/?branch=stable)
* 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)
* Download latest [release](https://github.com/surftimer/SurfTimer/releases/latest) and upload all the files to your csgo server directory
* Set up A MySQL Database (MySQL 5.7, MySQL 8+, MariaDB supported)
* 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)
* Add a MySQL database called surftimer to csgo/addons/sourcemod/configs/databases.cfg
* Ensure [End-Touch-Fix](https://github.com/rumourA/End-Touch-Fix) is loaded, this is required to ensure times are always accurate
* 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)
* Ensure you have added all the requirements below

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

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

</details>

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

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

(\*) *Already included with SourceMod 1.11.6820 and newer*

**SourceMod Libraries**

ℹ️ SourceMod Libraries are only required if you are compiling SurfTimer yourself

* [SMLib](https://github.com/bcserv/smlib/tree/transitional_syntax)
* [ColorLib](https://github.com/c0rp3n/colorlib-sm)
* [AutoExecConfig](https://github.com/Impact123/AutoExecConfig)
Expand All @@ -96,6 +102,7 @@ Run the following queries on your database:
* *(recommended)* [Stripper:Source](http://www.bailopan.net/stripper/) - Allows adding/modifying/removing entities from a map before it loads (config files included)
* *(optional)* [Surftimer-Web-Stats](https://github.com/KristianP26/Surftimer-Web-Stats) - Web statistics
* *(optional)* [Surftimer-Discord-Bot](https://github.com/Sarrus1/SurfTimer-Discord-Bot) - Discord BOT
* *(optional)* [CSGO-Surf-Load-Screens](https://github.com/Sayt123/CSGO-Surf-Load-Screens) - Map loading images for surf maps

## Upgrading

Expand Down
17 changes: 14 additions & 3 deletions addons/sourcemod/scripting/SurfTimer.sp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ public void OnMapStart()
// Get mapname
GetCurrentMap(g_szMapName, 128);

// Download map radar image if existing
AddRadarImages();

// Create nav file
CreateNavFile();

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

// Load spawns
if (!g_bRenaming && !g_bInTransactionChain)
{
checkSpawnPoints();
}

db_viewMapSettings();

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

if(g_tables_converted){
if(g_tables_converted)
{
if (!g_bRenaming && !g_bInTransactionChain && (IsServerProcessing() || !cvHibernateWhenEmpty.BoolValue))
{
LogToFileEx(g_szLogFile, "[surftimer] Starting to load server settings");
LogQueryTime("[surftimer] Starting to load server settings");
g_fServerLoading[0] = GetGameTime();
db_selectMapZones();
}
}
else{
else
{
CreateTimer(1.0, DatabaseUpgrading, INVALID_HANDLE, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
}

Expand All @@ -214,7 +221,9 @@ public void OnMapStart()
}

for (int i = 0; i < MAX_STYLES; i++)
{
g_bReplayTickFound[i] = false;
}

// Precache
InitPrecache();
Expand Down Expand Up @@ -246,7 +255,9 @@ public void OnMapStart()
// Hook Zones
iEnt = -1;
if (g_hTriggerMultiple != null)
{
CloseHandle(g_hTriggerMultiple);
}

g_hTriggerMultiple = CreateArray(256);
while ((iEnt = FindEntityByClassname(iEnt, "trigger_multiple")) != -1)
Expand Down
27 changes: 27 additions & 0 deletions addons/sourcemod/scripting/surftimer/admin.sp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,33 @@ public int TopMenuHandler2(Handle topmenu, TopMenuAction action, TopMenuObject o
return 0;
}

public Action Admin_insertMapperName(int client, int args)
{
if (!IsValidClient(client))
return Plugin_Handled;

if (!IsPlayerZoner(client))
{
CReplyToCommand(client, "%t", "AdminMapperName", g_szChatPrefix);
return Plugin_Handled;
}

if (args == 0)
{
CReplyToCommand(client, "%t", "MapperNameUsage", g_szChatPrefix);
return Plugin_Handled;
}
else
{
char arg1[64];
//char sMapperName[64];
GetCmdArgString(arg1, sizeof(arg1));

db_insertMapperName(client, arg1);
}
return Plugin_Handled;
}

public Action Admin_insertMapTier(int client, int args)
{
if (!IsValidClient(client))
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/surftimer/buttonpress.sp
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ public void CL_OnEndTimerPress(int client)
else if (style != 0)
{
g_fPBDifference_Bonus[client][style][zGroup] = g_fFinalTime[client] - g_fStylePersonalRecordBonus[style][zGroup][client];
g_fWRDifference_Bonus[client][style][zGroup] = g_fFinalTime[client] - g_fStyleBonusFastest[style][zGroup]
g_fWRDifference_Bonus[client][style][zGroup] = g_fFinalTime[client] - g_fStyleBonusFastest[style][zGroup];

if (GetConVarBool(g_hReplaceReplayTime) && (g_fFinalTime[client] < g_fReplayTimes[zGroup][style] || g_fReplayTimes[zGroup][style] == 0.0))
{
Expand Down
13 changes: 9 additions & 4 deletions addons/sourcemod/scripting/surftimer/commands.sp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ void CreateCommands()
RegConsoleCmd("sm_hookzone", Command_HookZones, "[surftimer] [zoner] Opens up zone hook creation menu.");
RegConsoleCmd("sm_addmaptier", Admin_insertMapTier, "[surftimer] [zoner] Changes maps tier");
RegConsoleCmd("sm_amt", Admin_insertMapTier, "[surftimer] [zoner] Changes maps tier");
RegConsoleCmd("sm_amn", Admin_insertMapperName, "[surftimer] [zoner] Adds mapper name to DB.");
RegConsoleCmd("sm_addmappername", Admin_insertMapperName, "[surftimer] [zoner] Adds mapper name to DB.");
RegConsoleCmd("sm_addspawn", Admin_insertSpawnLocation, "[surftimer] [zoner] Changes the position !r takes players to");
RegConsoleCmd("sm_delspawn", Admin_deleteSpawnLocation, "[surftimer] [zoner] Removes custom !r position");
RegConsoleCmd("sm_mapsettings", Admin_MapSettings, "[surftimer] [zoner] Displays menu containing various options to change map settings");
Expand Down Expand Up @@ -625,7 +627,10 @@ public Action Command_normalMode(int client, int args)
return Plugin_Handled;

Client_Stop(client, 1);
CreateTimer(0.1, DisablePrac, GetClientSerial(client));

if (g_bPracticeMode[client])
g_bPracticeMode[client] = false;

Command_Restart(client, 1);

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

if (g_bPracticeMode[client])
{
CreateTimer(0.1, DisablePrac, GetClientSerial(client));
g_bPracticeMode[client] = false;
CPrintToChat(client, "%t", "PracticeNormal", g_szChatPrefix);
}
return Plugin_Handled;
Expand Down Expand Up @@ -1375,7 +1380,7 @@ public Action Command_ToStage(int client, int args)

if (g_bPracticeMode[client])
{
CreateTimer(0.1, DisablePrac, GetClientSerial(client));
g_bPracticeMode[client] = false;
CPrintToChat(client, "%t", "PracticeNormal", g_szChatPrefix);
}

Expand Down Expand Up @@ -1438,7 +1443,7 @@ public Action Command_Restart(int client, int args)
teleportClient(client, 0, 1, true);
if (g_bPracticeMode[client])
{
CreateTimer(0.1, DisablePrac, GetClientSerial(client));
g_bPracticeMode[client] = false;
CPrintToChat(client, "%t", "PracticeNormal", g_szChatPrefix);
}
return Plugin_Handled;
Expand Down
2 changes: 2 additions & 0 deletions addons/sourcemod/scripting/surftimer/convars.sp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ ConVar g_iHintsInterval = null; // Time between two hints. 0 = off
ConVar g_bHintsRandomOrder = null; // If hints are in random order
ConVar g_hOverrideClantag = null;
ConVar g_hDefaultPreSpeed = null;
ConVar g_hLogQueryTimes = null;

void CreateConVars()
{
Expand Down Expand Up @@ -408,6 +409,7 @@ void CreateConVars()
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");

g_hLimitSpeedType = AutoExecConfig_CreateConVar("ck_limit_speed_type", "1", "1 Use new style of limiting speed, 0 use old/cksurf way");
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);

// Server Name
g_hHostName = FindConVar("hostname");
Expand Down
Loading

0 comments on commit 01b3153

Please sign in to comment.