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

Commit

Permalink
added command for all miscellaneous options
Browse files Browse the repository at this point in the history
  • Loading branch information
Riccardo H committed Aug 2, 2019
1 parent 80eb78d commit 075694a
Show file tree
Hide file tree
Showing 2 changed files with 143 additions and 12 deletions.
90 changes: 78 additions & 12 deletions addons/sourcemod/scripting/surftimer/commands.sp
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,87 @@ void CreateCommands()
RegConsoleCmd("sm_prestrafe", Command_Prestrafe, "[surftimer] [settings] Toggles prestrafe messages for player");
RegConsoleCmd("sm_silentspec", Command_SilentSpec, "[surftimer] [settings] Toggles silent spectate for player");
RegConsoleCmd("sm_sspec", Command_SilentSpec, "[surftimer] [settings] Toggles silent spectate for player");
RegConsoleCmd("sm_togglewrcps", Command_ToggleWrcps, "[surftimer] on/off - Enable player checkpoints");
RegConsoleCmd("sm_togglecps", Command_ToggleCps, "[surftimer] on/off - Enable player checkpoints");
RegConsoleCmd("sm_togglewrcps", Command_ToggleWrcps, "[surftimer] [settings] on/off - Enable player checkpoints");
RegConsoleCmd("sm_togglecps", Command_ToggleCps, "[surftimer] [settings] on/off - Enable player checkpoints");
RegConsoleCmd("sm_quake", Command_ToggleQuake, "[surftimer] [settings] on/off - Enable sounds");
RegConsoleCmd("sm_startside", Command_ChangeStartSide, "[surftimer] [settings] left/right - change start side");
RegConsoleCmd("sm_speedgradient", Command_ChangeSpeedGradient, "[surftimer] [settings] white/green/rainbow/momentum - change speed gradient");
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");

}

public Action Command_CenterSpeed(int client, int args) {
if (g_bCenterSpeedDisplay[client]) {
g_bCenterSpeedDisplay[client] = false;
CPrintToChat(client, "%t", "CenterSpeedOff", g_szChatPrefix);
} else {
g_bCenterSpeedDisplay[client] = true;
SetHudTextParams(-1.0, 0.30, 1.0, 255, 255, 255, 255, 0, 0.25, 0.0, 0.0);
CreateTimer(0.1, CenterSpeedDisplayTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
CPrintToChat(client, "%t", "CenterSpeedOn", g_szChatPrefix);
}
return Plugin_Handled;
}

public Action Command_ChangeSpeedMode(int client, int args) {
if (g_SpeedMode[client] == 0) {
g_SpeedMode[client]++;
CPrintToChat(client, "%t", "SpeedModeXYZ", g_szChatPrefix);
} else if (g_SpeedMode[client] == 1) {
g_SpeedMode[client]++;
CPrintToChat(client, "%t", "SpeedModeZ", g_szChatPrefix);
} else {
g_SpeedMode[client] = 0;
CPrintToChat(client, "%t", "SpeedModeXY", g_szChatPrefix);
}
return Plugin_Handled;
}

public Action Command_ChangeSpeedGradient(int client, int args) {
if (g_SpeedGradient[client] == 0) {
g_SpeedGradient[client]++;
CPrintToChat(client, "%t", "SpeedGradientGreen", g_szChatPrefix);
} else if (g_SpeedGradient[client] == 1) {
g_SpeedGradient[client]++;
CPrintToChat(client, "%t", "SpeedGradientRainbow", g_szChatPrefix);
} else if (g_SpeedGradient[client] == 2) {
g_SpeedGradient[client]++;
CPrintToChat(client, "%t", "SpeedGradientMomentum", g_szChatPrefix);
} else {
g_SpeedGradient[client] = 0;
CPrintToChat(client, "%t", "SpeedGradientWhite", g_szChatPrefix);
}
return Plugin_Handled;
}

public Action Command_ChangeStartSide(int client, int args) {
if (g_iTeleSide[client] == 0) {
g_iTeleSide[client] = 1;
CPrintToChat(client, "%t", "StartSideRight", g_szChatPrefix);
} else {
g_iTeleSide[client] = 0;
CPrintToChat(client, "%t", "StartSideLeft", g_szChatPrefix);
}
return Plugin_Handled;
}

public Action Command_ToggleQuake(int client, int args) {
if (g_bEnableQuakeSounds[client]) {
g_bEnableQuakeSounds[client] = false;
CPrintToChat(client, "%t", "QuakeToggleOff", g_szChatPrefix);
} else {
g_bEnableQuakeSounds[client] = true;
CPrintToChat(client, "%t", "QuakeToggleOn", g_szChatPrefix);
}
return Plugin_Handled;
}

public Action Command_ToggleWrcps(int client, int args) {
if (g_iWrcpMessages[client]) {
g_iWrcpMessages[client] = false;
CPrintToChat(client, "%t", "ToggleWrcpsMessageToggleOff", g_szChatPrefix);
}
else {
} else {
g_iWrcpMessages[client] = true;
CPrintToChat(client, "%t", "ToggleWrcpsMessageToggleOn", g_szChatPrefix);
}
Expand All @@ -230,8 +300,7 @@ public Action Command_ToggleCps(int client, int args) {
if (g_iCpMessages[client]) {
g_iCpMessages[client] = false;
CPrintToChat(client, "%t", "ToggleCpsMessageToggleOff", g_szChatPrefix);
}
else {
} else {
g_iCpMessages[client] = true;
CPrintToChat(client, "%t", "ToggleCpsMessageToggleOn", g_szChatPrefix);
}
Expand All @@ -244,8 +313,7 @@ public Action Command_SilentSpec(int client, int args) {
if (g_iSilentSpectate[client]) {
g_iSilentSpectate[client] = false;
CPrintToChat(client, "%t", "SilentSpecMessageToggleOff", g_szChatPrefix);
}
else {
} else {
g_iSilentSpectate[client] = true;
CPrintToChat(client, "%t", "SilentSpecMessageToggleOn", g_szChatPrefix);
}
Expand All @@ -256,8 +324,7 @@ public Action Command_Prestrafe(int client, int args) {
if (g_iPrespeedText[client]) {
g_iPrespeedText[client] = false;
CPrintToChat(client, "%t", "PrestrafeMessageToggleOff", g_szChatPrefix);
}
else {
} else {
g_iPrespeedText[client] = true;
CPrintToChat(client, "%t", "PrestrafeMessageToggleOn", g_szChatPrefix);
}
Expand All @@ -271,8 +338,7 @@ public Action Command_DeleteRecords(int client, int args)
char sqlStripped[128];
GetCmdArg(1, sqlStripped[client], 128);
SQL_EscapeString(g_hDb, sqlStripped, g_EditingMap[client], 256);
}
else
} else
Format(g_EditingMap[client], 256, g_szMapName);

ShowMainDeleteMenu(client);
Expand Down
65 changes: 65 additions & 0 deletions addons/sourcemod/translations/surftimer.phrases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1538,4 +1538,69 @@
"#format" "{1:s}"
"en" "{1} CP messages are now {red}disabled"
}
"QuakeToggleOn"
{
"#format" "{1:s}"
"en" "{1} Timer sounds are now {green}enabled"
}
"QuakeToggleOff"
{
"#format" "{1:s}"
"en" "{1} Timer sounds are now {red}disabled"
}
"StartSideLeft"
{
"#format" "{1:s}"
"en" "{1} Your start side is now {blue}left"
}
"StartSideRight"
{
"#format" "{1:s}"
"en" "{1} Your start side is now {yellow}right"
}
"SpeedGradientWhite"
{
"#format" "{1:s}"
"en" "{1} Your speed gradient is now {blue}white"
}
"SpeedGradientGreen"
{
"#format" "{1:s}"
"en" "{1} Your speed gradient is now {green}green"
}
"SpeedGradientRainbow"
{
"#format" "{1:s}"
"en" "{1} Your speed gradient is now {pink}r{purple}a{darkblue}i{green}n{yellow}b{orange}o{red}w"
}
"SpeedGradientMomentum"
{
"#format" "{1:s}"
"en" "{1} Your speed gradient is now {blue}momen{red}tum"
}
"SpeedModeXY"
{
"#format" "{1:s}"
"en" "{1} Your speed mode is now {yellow}X{orange}Y"
}
"SpeedModeXYZ"
{
"#format" "{1:s}"
"en" "{1} Your speed mode is now {yellow}X{orange}Y{red}Z"
}
"SpeedModeZ"
{
"#format" "{1:s}"
"en" "{1} Your speed mode is now {red}Z"
}
"CenterSpeedOn"
{
"#format" "{1:s}"
"en" "{1} The center speed display is now {green}enabled"
}
"CenterSpeedOff"
{
"#format" "{1:s}"
"en" "{1} The center speed display is now {red}disabled"
}
}

0 comments on commit 075694a

Please sign in to comment.