Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix'
Browse files Browse the repository at this point in the history
  • Loading branch information
Riccardo H committed Aug 18, 2019
2 parents 32894ce + 4363997 commit 2069247
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

[2019-08-18 - Version 274]
---
* **[NEW]** added `sm_autoreset` command

[2019-08-16 - Version 273]
---
* **[REQUEST/FIX]** Finally fixed maxvelocity bug ._.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# z4lab-SurfTimer 273 for CS:GO
# z4lab-SurfTimer 274 for CS:GO

## Installation and requirements
[SourceMod 1.9](https://www.sourcemod.net/downloads.php?branch=stable), [MetaMod 1.10](https://www.sourcemm.net/downloads.php/?branch=stable) and a working MySQL instance is required for this plugin
Expand Down
6 changes: 5 additions & 1 deletion addons/sourcemod/scripting/SurfTimer.sp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#pragma semicolon 1

// Plugin Info
#define VERSION "273"
#define VERSION "274"

// Database Definitions
#define MYSQL 0
Expand Down Expand Up @@ -769,6 +769,10 @@ bool g_iHasEnforcedTitle[MAXPLAYERS + 1];

// disable noclip triggers toggle
bool g_iDisableTriggers[MAXPLAYERS + 1];

// auto reset
bool g_iAutoReset[MAXPLAYERS + 1];

/*---------- Run Variables ----------*/

// Clients personal record in map
Expand Down
12 changes: 12 additions & 0 deletions addons/sourcemod/scripting/surftimer/commands.sp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ void CreateCommands()
RegConsoleCmd("sm_speedmode", Command_ChangeSpeedMode, "[SurfTimer] [settings] xy/xyz/z - change speed mode");
RegConsoleCmd("sm_centerspeed", Command_CenterSpeed, "[SurfTimer] [settings] on/off - toggle center speed display");
RegConsoleCmd("sm_nctriggers", Command_ToggleNcTriggers, "[SurfTimer] [settings] on/off - toggle triggers while noclipping");
RegConsoleCmd("sm_autoreset", Command_ToggleAutoReset, "[SurfTimer] [settings] on/off - toggle auto reset for your current map/bonus run if your above your pb");

// Trails
RegConsoleCmd("sm_trail", Command_Trail, "Opens the 'Trail Selection' menu.");
Expand All @@ -212,6 +213,17 @@ void CreateCommands()

}

public Action Command_ToggleAutoReset(int client, int args) {
if (g_iAutoReset[client]) {
g_iAutoReset[client] = false;
CPrintToChat(client, "%t", "AutoResetDisabled", g_szChatPrefix);
} else {
g_iAutoReset[client] = true;
CPrintToChat(client, "%t", "AutoResetEnabled", g_szChatPrefix);
}
return Plugin_Handled;
}

public Action Command_ToggleNcTriggers(int client, int args) {
if (g_iDisableTriggers[client]) {
g_iDisableTriggers[client] = false;
Expand Down
13 changes: 12 additions & 1 deletion addons/sourcemod/scripting/surftimer/misc.sp
Original file line number Diff line number Diff line change
Expand Up @@ -2752,8 +2752,14 @@ public void CheckRun(int client)
if (g_fCurrentRunTime[client] > g_fPersonalRecord[client] && !g_bMissedMapBest[client] && !g_bPause[client] && g_iClientInZone[client][2] == 0)
{
g_bMissedMapBest[client] = true;
if (g_fPersonalRecord[client] > 0.0)
if (g_fPersonalRecord[client] > 0.0) {
CPrintToChat(client, "%t", "MissedMapBest", g_szChatPrefix, g_szPersonalRecord[client]);
if (g_iAutoReset[client]) {
Command_Restart(client, 1);
CPrintToChat(client, "%t", "AutoResetMessage1", g_szChatPrefix);
CPrintToChat(client, "%t", "AutoResetMessage2", g_szChatPrefix);
}
}
EmitSoundToClient(client, "buttons/button18.wav", client);
}
else
Expand All @@ -2764,6 +2770,11 @@ public void CheckRun(int client)
{
g_bMissedBonusBest[client] = true;
CPrintToChat(client, "%t", "Misc29", g_szChatPrefix, g_szPersonalRecordBonus[g_iClientInZone[client][2]][client]);
if (g_iAutoReset[client]) {
Command_Teleport(client, 0);
CPrintToChat(client, "%t", "AutoResetMessage1", g_szChatPrefix);
CPrintToChat(client, "%t", "AutoResetMessage2", g_szChatPrefix);
}
EmitSoundToClient(client, "buttons/button18.wav", client);
}
}
Expand Down
20 changes: 20 additions & 0 deletions addons/sourcemod/translations/surftimer.phrases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1618,4 +1618,24 @@
"#format" "{1:s}"
"en" "{1} Triggers are now {red}disabled {default}while noclipping"
}
"AutoResetDisabled"
{
"#format" "{1:s}"
"en" "{1} Your timer {green}won't reset {default}if you've missed your PB"
}
"AutoResetEnabled"
{
"#format" "{1:s}"
"en" "{1} Your timer will {red}reset {default}if you've missed your PB"
}
"AutoResetMessage1"
{
"#format" "{1:s}"
"en" "{1} You got teleported to the start because auto-reset is enabled"
}
"AutoResetMessage2"
{
"#format" "{1:s}"
"en" "{1} Use {blue}sm_autoreset {default}to disable it"
}
}

0 comments on commit 2069247

Please sign in to comment.