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

Commit

Permalink
Merge pull request #36 from totles/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Riccardo H authored Aug 1, 2019
2 parents 73e0be1 + 4c2a8cb commit 19a5fd4
Show file tree
Hide file tree
Showing 20 changed files with 137 additions and 49 deletions.
Binary file modified addons/sourcemod/plugins/SurfTimer.smx
Binary file not shown.
29 changes: 10 additions & 19 deletions addons/sourcemod/scripting/SurfTimer.sp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#pragma semicolon 1

// Plugin Info
#define VERSION "2.6"
#define VERSION "261"

// Database Definitions
#define MYSQL 0
Expand Down Expand Up @@ -71,24 +71,12 @@
#define DEFAULT_TITLES_PATH "configs/surftimer/default_titles.txt"

// Paths for sounds
#define PRO_FULL_SOUND_PATH "sound/surftimer/quake/holyshit.mp3"
#define PRO_RELATIVE_SOUND_PATH "*surftimer/quake/holyshit.mp3"
#define CP_FULL_SOUND_PATH "sound/surftimer/quake/wickedsick.mp3"
#define CP_RELATIVE_SOUND_PATH "*surftimer/quake/wickedsick.mp3"
#define UNSTOPPABLE_SOUND_PATH "sound/surftimer/quake/unstoppable.mp3"
#define UNSTOPPABLE_RELATIVE_SOUND_PATH "*surftimer/quake/unstoppable.mp3"
#define WR_FULL_SOUND_PATH "sound/surftimer/wr/1/valve_logo_music.mp3"
#define WR_RELATIVE_SOUND_PATH "*surftimer/wr/1/valve_logo_music.mp3"
#define WR2_FULL_SOUND_PATH "sound/surftimer/wr/2/valve_logo_music.mp3"
#define WR2_RELATIVE_SOUND_PATH "*surftimer/wr/2/valve_logo_music.mp3"
#define TOP10_FULL_SOUND_PATH "sound/surftimer/top10/valve_logo_music.mp3"
#define TOP10_RELATIVE_SOUND_PATH "*surftimer/top10/valve_logo_music.mp3"
#define PR_FULL_SOUND_PATH "sound/surftimer/pr/valve_logo_music.mp3"
#define PR_RELATIVE_SOUND_PATH "*surftimer/pr/valve_logo_music.mp3"
#define WRCP_FULL_SOUND_PATH "sound/surftimer/wow_fast.mp3"
#define WRCP_RELATIVE_SOUND_PATH "*surftimer/wow_fast.mp3"
#define DISCOTIME_FULL_SOUND_PATH "sound/surftimer/discotime.mp3"
#define DISCOTIME_RELATIVE_SOUND_PATH "*/surftimer/discotime.mp3"
#define WR2_FULL_SOUND_PATH "sound/surftimer/wr.mp3"
#define WR2_RELATIVE_SOUND_PATH "*surftimer/wr.mp3"
#define TOP10_FULL_SOUND_PATH "sound/surftimer/top10.mp3"
#define TOP10_RELATIVE_SOUND_PATH "*surftimer/top10.mp3"
#define PR_FULL_SOUND_PATH "sound/surftimer/pr.mp3"
#define PR_RELATIVE_SOUND_PATH "*surftimer/pr.mp3"

#define MAX_STYLES 7

Expand Down Expand Up @@ -776,6 +764,9 @@ int g_iTeleSide[MAXPLAYERS + 1];
// Prestrafe Message
bool g_iPrespeedText[MAXPLAYERS + 1];

// Silent Spectate
bool g_iSilentSpectate[MAXPLAYERS + 1];

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

// Clients personal record in map
Expand Down
73 changes: 51 additions & 22 deletions addons/sourcemod/scripting/surftimer/buttonpress.sp
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,31 @@ public void CL_OnStartTimerPress(int client)
}
}

if (!IsFakeClient(client))
{
if (IsPlayerAlive(client)){
if (g_iPrespeedText[client]){
char szSpeed[128];
Format(szSpeed, sizeof(szSpeed), "%i", RoundToNearest(g_fLastSpeed[client]));
if (g_iClientInZone[client][2] == 0)
CPrintToChat(client, "%s Mapstart Prestrafe: %s u/s", g_szChatPrefix, szSpeed);
else
CPrintToChat(client, "%s Bonus %s Prestrafe: %s u/s", g_szChatPrefix, g_szZoneGroupName[g_iClientInZone[client][2]][6], szSpeed);
}
if (!g_bPracticeMode[client] && !IsFakeClient(client)) {
char szSpeed[128];
char preMessage[128];
Format(szSpeed, sizeof(szSpeed), "%i", RoundToNearest(g_fLastSpeed[client]));
Format(preMessage, sizeof(preMessage), "%t", "StartPrestrafe", g_szChatPrefix, szSpeed);
if (g_iPrespeedText[client])
CPrintToChat(client, preMessage);

for (int i = 1; i <= MaxClients; i++) {
if (!IsClientInGame(i))
continue;

if (GetClientTeam(i) != CS_TEAM_SPECTATOR)
continue;

int ObserverMode = GetEntProp(i, Prop_Send, "m_iObserverMode");
if (ObserverMode != 4 && ObserverMode != 5)
continue;

int ObserverTarget = GetEntPropEnt(i, Prop_Send, "m_hObserverTarget");
if (ObserverTarget != client)
continue;

if (g_iPrespeedText[i])
CPrintToChat(i, preMessage);
}
}

Expand Down Expand Up @@ -758,16 +772,31 @@ public void CL_OnStartWrcpTimerPress(int client)
g_WrcpStage[client] = g_Stage[0][client];
Stage_StartRecording(client);
}
if (!IsFakeClient(client))
{
if (IsPlayerAlive(client)){
if (g_iPrespeedText[client]){
if (g_Stage[0][client] != 1) {
char szSpeed[128];
Format(szSpeed, sizeof(szSpeed), "%i", RoundToNearest(g_fLastSpeed[client]));
CPrintToChat(client, "%s Stage %i Prestrafe: %s u/s", g_szChatPrefix, g_Stage[0][client], szSpeed);
}
}
if (g_Stage[0][client] > 1 && !g_bPracticeMode[client] && !IsFakeClient(client)) {
char szSpeed[128];
char preMessage[128];
Format(szSpeed, sizeof(szSpeed), "%i", RoundToNearest(g_fLastSpeed[client]));
Format(preMessage, sizeof(preMessage), "%t", "StagePrestrafe", g_szChatPrefix, g_Stage[0][client], szSpeed);
if (g_iPrespeedText[client])
CPrintToChat(client, preMessage);

for (int i = 1; i <= MaxClients; i++) {
if (!IsClientInGame(i))
continue;

if (GetClientTeam(i) != CS_TEAM_SPECTATOR)
continue;

int ObserverMode = GetEntProp(i, Prop_Send, "m_iObserverMode");
if(ObserverMode != 4 && ObserverMode != 5)
continue;

int ObserverTarget = GetEntPropEnt(i, Prop_Send, "m_hObserverTarget");
if (ObserverTarget != client)
continue;

if (g_iPrespeedText[i])
CPrintToChat(i, preMessage);
}
}
}
Expand Down Expand Up @@ -818,7 +847,7 @@ public void CL_OnEndWrcpTimerPress(int client, float time2)
//Stage 1 to stage 2 glitch stopper.
if(g_wrcpStage2Fix[client] && stage == 2){
g_wrcpStage2Fix[client] = false;
CPrintToChat(client, "Potential S1 to S2 glitch stopped. Stage time was not recorded"); // add to trans. file and add prefix!
CPrintToChat(client, "%t", "StageNotRecorded", g_szChatPrefix);
return;
}

Expand Down
37 changes: 35 additions & 2 deletions addons/sourcemod/scripting/surftimer/commands.sp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ void CreateCommands()
RegConsoleCmd("sm_prac", Command_goToPlayerCheckpoint, "[surftimer] Teleports player to his last checkpoint");
RegConsoleCmd("sm_practice", Command_goToPlayerCheckpoint, "[surftimer] Teleports player to his last checkpoint");
RegConsoleCmd("sm_loadloc", Command_goToPlayerCheckpoint, "[surftimer] Teleports player to his last checkpoint");

RegConsoleCmd("sm_cp", Command_createPlayerCheckpoint, "[surftimer] Creates a checkpoint, where the player can teleport back to");
RegConsoleCmd("sm_checkpoint", Command_createPlayerCheckpoint, "[surftimer] Creates a checkpoint, where the player can teleport back to");
RegConsoleCmd("sm_saveloc", Command_createPlayerCheckpoint, "[surftimer] Creates a checkpoint, where the player can teleport back to");
Expand All @@ -84,11 +83,12 @@ void CreateCommands()
RegConsoleCmd("sm_normal", Command_normalMode, "[surftimer] Switches player back to normal mode.");
RegConsoleCmd("sm_n", Command_normalMode, "[surftimer] Switches player back to normal mode.");

// Admin Commands
RegConsoleCmd("sm_ckadmin", Admin_ckPanel, "[surftimer] Displays the surftimer admin menu panel");
RegConsoleCmd("sm_refreshprofile", Admin_RefreshProfile, "[surftimer] Recalculates player profile for given steam id");

RegConsoleCmd("sm_clearassists", Admin_ClearAssists, "[surftimer] Clears assist points (map progress) from all players");

// Zoning/Mapsetting Commands
RegConsoleCmd("sm_zones", Command_Zones, "[surftimer] [zoner] Opens up the zone creation menu.");
RegConsoleCmd("sm_hookzone", Command_HookZones, "[surftimer] [zoner] Opens up zone hook creation menu.");
RegConsoleCmd("sm_addmaptier", Admin_insertMapTier, "[surftimer] [zoner] Changes maps tier");
Expand Down Expand Up @@ -203,6 +203,39 @@ void CreateCommands()
// Delete records
RegAdminCmd("sm_deleterecords", Command_DeleteRecords, g_ZonerFlag, "[surftimer] [zoner] Delete records");
RegAdminCmd("sm_dr", Command_DeleteRecords, g_ZonerFlag, "[surftimer] [zoner] Delete records");

// Setting Commands
RegConsoleCmd("sm_pre", Command_Prestrafe, "[surftimer] [settings] Toggles prestrafe messages for player");
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");

}

public Action Command_SilentSpec(int client, int args) {
if (!IsPlayerVip(client)) return Plugin_Handled;

if (g_iSilentSpectate[client]) {
g_iSilentSpectate[client] = false;
CPrintToChat(client, "%t", "SilentSpecMessageToggleOff", g_szChatPrefix);
}
else {
g_iSilentSpectate[client] = true;
CPrintToChat(client, "%t", "SilentSpecMessageToggleOn", g_szChatPrefix);
}
return Plugin_Handled;
}

public Action Command_Prestrafe(int client, int args) {
if (g_iPrespeedText[client]) {
g_iPrespeedText[client] = false;
CPrintToChat(client, "%t", "PrestrafeMessageToggleOff", g_szChatPrefix);
}
else {
g_iPrespeedText[client] = true;
CPrintToChat(client, "%t", "PrestrafeMessageToggleOn", g_szChatPrefix);
}
return Plugin_Handled;
}

public Action Command_DeleteRecords(int client, int args)
Expand Down
6 changes: 3 additions & 3 deletions addons/sourcemod/scripting/surftimer/convars.sp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ void CreateConVars()
g_hPlayReplayVipOnly = CreateConVar("ck_play_replay_vip_only", "1", "Sets whether the sm_replay command will be VIP only Disable/Enable");

// Sound Convars
g_hSoundPathWR = CreateConVar("ck_sp_wr", "sound/surftimer/wr/2/valve_logo_music.mp3", "Set the sound path for the WR sound");
g_hSoundPathWR = CreateConVar("ck_sp_wr", "sound/surftimer/wr.mp3", "Set the sound path for the WR sound");
HookConVarChange(g_hSoundPathWR, OnSettingChanged);
GetConVarString(g_hSoundPathWR, g_szSoundPathWR, sizeof(g_szSoundPathWR));
if (FileExists(g_szSoundPathWR))
Expand All @@ -361,7 +361,7 @@ void CreateConVars()
Format(g_szRelativeSoundPathWR, sizeof(g_szRelativeSoundPathWR), WR2_RELATIVE_SOUND_PATH);
}

g_hSoundPathTop = CreateConVar("ck_sp_top", "sound/surftimer/top10/valve_logo_music.mp3", "Set the sound path for the Top 10 sound");
g_hSoundPathTop = CreateConVar("ck_sp_top", "sound/surftimer/top10.mp3", "Set the sound path for the Top 10 sound");
HookConVarChange(g_hSoundPathTop, OnSettingChanged);
GetConVarString(g_hSoundPathTop, g_szSoundPathTop, sizeof(g_szSoundPathTop));
if (FileExists(g_szSoundPathTop))
Expand All @@ -376,7 +376,7 @@ void CreateConVars()
Format(g_szRelativeSoundPathTop, sizeof(g_szRelativeSoundPathTop), TOP10_RELATIVE_SOUND_PATH);
}

g_hSoundPathPB = CreateConVar("ck_sp_pb", "sound/surftimer/pr/valve_logo_music.mp3", "Set the sound path for the PB sound");
g_hSoundPathPB = CreateConVar("ck_sp_pb", "sound/surftimer/pr.mp3", "Set the sound path for the PB sound");
HookConVarChange(g_hSoundPathPB, OnSettingChanged);
GetConVarString(g_hSoundPathPB, g_szSoundPathPB, sizeof(g_szSoundPathPB));
if (FileExists(g_szSoundPathPB))
Expand Down
6 changes: 3 additions & 3 deletions addons/sourcemod/scripting/surftimer/misc.sp
Original file line number Diff line number Diff line change
Expand Up @@ -1586,7 +1586,7 @@ public void PlayRecordSound(int iRecordtype)
{
if (IsValidClient(i) && !IsFakeClient(i) && g_bEnableQuakeSounds[i] == true)
{
Format(buffer, sizeof(buffer), "play %s", DISCOTIME_RELATIVE_SOUND_PATH);
Format(buffer, sizeof(buffer), "play %s", g_szRelativeSoundPathTop);
ClientCommand(i, buffer);
}
}
Expand Down Expand Up @@ -2949,7 +2949,7 @@ public void SpecListMenuDead(int client) // What Spectators see

for (x = 1; x <= MaxClients; x++)
{
if (IsValidClient(x) && !IsFakeClient(client) && !IsPlayerAlive(x) && GetClientTeam(x) >= 1 && GetClientTeam(x) <= 3)
if (IsValidClient(x) && !IsFakeClient(client) && !IsPlayerAlive(x) && GetClientTeam(x) >= 1 && GetClientTeam(x) <= 3 && !g_iSilentSpectate[x])
{

SpecMode = GetEntProp(x, Prop_Send, "m_iObserverMode");
Expand Down Expand Up @@ -3815,7 +3815,7 @@ public void SideHudAlive(int client)
int count = 0;
for (int j = 0; j <= MaxClients; j++)
{
if (IsValidClient(j) && !IsFakeClient(client) && !IsPlayerAlive(j) && !g_bFirstTeamJoin[j] && g_bSpectate[j])
if (IsValidClient(j) && !IsFakeClient(client) && !IsPlayerAlive(j) && !g_bFirstTeamJoin[j] && g_bSpectate[j] && !g_iSilentSpectate[j])
{
SpecMode = GetEntProp(j, Prop_Send, "m_iObserverMode");
if (SpecMode == 4 || SpecMode == 5)
Expand Down
35 changes: 35 additions & 0 deletions addons/sourcemod/translations/surftimer.phrases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1483,4 +1483,39 @@
"#format" "{1:s},{2:s}"
"en" "{1} {darkred}You must pass all {2} to finish your run"
}
"PrestrafeMessageToggleOn"
{
"#format" "{1:s}"
"en" "{1} Prestrafe messages are now {green}enabled"
}
"PrestrafeMessageToggleOff"
{
"#format" "{1:s}"
"en" "{1} Prestrafe messages are now {red}disabled"
}
"StageNotRecorded"
{
"#format" "{1:s}"
"en" "{1} Potential S1 to S2 glitch stopped. Stage time was not recorded"
}
"StartPrestrafe"
{
"#format" "{1:s},{2:s}"
"en" "{1} Start Prestrafe: {2} u/s"
}
"StagePrestrafe"
{
"#format" "{1:s},{2:i},{3:s}"
"en" "{1} Stage {2} Prestrafe: {3} u/s"
}
"SilentSpecMessageToggleOn"
{
"#format" "{1:s}"
"en" "{1} Silent spectate is now {green}enabled"
}
"SilentSpecMessageToggleOff"
{
"#format" "{1:s}"
"en" "{1} Silent spectate is now {red}disabled"
}
}
Binary file removed sound/surftimer/discotime.mp3
Binary file not shown.
File renamed without changes.
Binary file removed sound/surftimer/quake/dominating.mp3
Binary file not shown.
Binary file removed sound/surftimer/quake/godlike.mp3
Binary file not shown.
Binary file removed sound/surftimer/quake/holyshit.mp3
Binary file not shown.
Binary file removed sound/surftimer/quake/perfect.mp3
Binary file not shown.
Binary file removed sound/surftimer/quake/rampage.mp3
Binary file not shown.
Binary file removed sound/surftimer/quake/unstoppable.mp3
Binary file not shown.
Binary file removed sound/surftimer/quake/wickedsick.mp3
Binary file not shown.
File renamed without changes.
Binary file removed sound/surftimer/wow_fast.mp3
Binary file not shown.
File renamed without changes.
Binary file removed sound/surftimer/wr/1/valve_logo_music.mp3
Binary file not shown.

0 comments on commit 19a5fd4

Please sign in to comment.