Skip to content

Commit

Permalink
Add cvar to change karma file ( Close #377 )
Browse files Browse the repository at this point in the history
  • Loading branch information
Bara committed Oct 18, 2018
1 parent d1505c0 commit 7c39ad9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
3 changes: 2 additions & 1 deletion addons/sourcemod/scripting/ttt/core/config.sp
Expand Up @@ -78,7 +78,8 @@ void SetupConfig()
g_cEnableDamage = AutoExecConfig_CreateConVar("ttt_prestart_damage", "0", "Enable damage before round start (Default disabled to prevent kills)?", _, true, 0.0, true, 1.0);
g_croundendDamage = AutoExecConfig_CreateConVar("ttt_roundend_dm", "0", "Enable damage after a round until round end.", _, true, 0.0, true, 1.0);
g_clogFile = AutoExecConfig_CreateConVar("ttt_log_file", "logs/ttt/ttt-<DATE>.log", "The default file to log TTT data to (including end of round) - DON'T REMOVE \"-<DATE>\" IF YOU DON'T KNOW WHAT YOU DO.");
g_cerrFile = AutoExecConfig_CreateConVar("ttt_error_file", "logs/ttt/ttt-error-<DATE>.log", "The default file to log TTT errors/bugs to - DON'T REMOVE \"-<DATE>\" IF YOU DON'T KNOW WHAT YOU DO.");
g_cerrFile = AutoExecConfig_CreateConVar("ttt_error_file", "logs/ttt/ttt-error-<DATE>.log", "The default file to log TTT errors/bugs - DON'T REMOVE \"-<DATE>\" IF YOU DON'T KNOW WHAT YOU DO.");
g_cKarmaFile = AutoExecConfig_CreateConVar("ttt_karma_file", "logs/ttt/ttt-karma-<DATE>.log", "The default file to log TTT karma changes (Require ttt_debug_mode - 1) - DON'T REMOVE \"-<DATE>\" IF YOU DON'T KNOW WHAT YOU DO.");
g_cdefaultPriD = AutoExecConfig_CreateConVar("ttt_default_primary_d", "weapon_m4a1_silencer", "The default primary gun to give players when they become a Detective (if they have no primary).");
g_cdefaultSec = AutoExecConfig_CreateConVar("ttt_default_secondary", "weapon_glock", "The default secondary gun to give players when they get their role (if they have no secondary).");
g_cRoundStartedFontSize = AutoExecConfig_CreateConVar("ttt_round_started_font_size", "32", "Font size of the text if round started");
Expand Down
1 change: 1 addition & 0 deletions addons/sourcemod/scripting/ttt/core/globals.sp
Expand Up @@ -212,6 +212,7 @@ ConVar g_cforceTeams = null;
ConVar g_crandomWinner = null;
ConVar g_clogFile = null;
ConVar g_cerrFile = null;
ConVar g_cKarmaFile = null;
ConVar g_cdefaultPriD = null;
ConVar g_cdefaultSec = null;
ConVar g_cendwithD = null;
Expand Down
27 changes: 15 additions & 12 deletions addons/sourcemod/scripting/ttt/ttt.sp
Expand Up @@ -198,18 +198,21 @@ public void OnConfigsExecuted()

g_clogFile.GetString(g_sLogFile, sizeof(g_sLogFile));
g_cerrFile.GetString(g_sErrorFile, sizeof(g_sErrorFile));
g_cKarmaFile.GetString(g_sKarmaFile, sizeof(g_sKarmaFile));

ReplaceString(g_sLogFile, sizeof(g_sLogFile), "<DATE>", sDate, true);
ReplaceString(g_sErrorFile, sizeof(g_sErrorFile), "<DATE>", sDate, true);
ReplaceString(g_sKarmaFile, sizeof(g_sKarmaFile), "<DATE>", sDate, true);

BuildPath(Path_SM, g_sLogFile, sizeof(g_sLogFile), g_sLogFile);
BuildPath(Path_SM, g_sErrorFile, sizeof(g_sErrorFile), g_sErrorFile);
BuildPath(Path_SM, g_sKarmaFile, sizeof(g_sKarmaFile), "logs/ttt/ttt-karma-%s.log", sDate);
BuildPath(Path_SM, g_sKarmaFile, sizeof(g_sKarmaFile), g_sKarmaFile);

if (g_cDebug.BoolValue)
{
LogMessage("Log File: \"%s\"", g_sLogFile);
LogMessage("Error File :\"%s\"", g_sErrorFile);
LogMessage("Karma File :\"%s\"", g_sKarmaFile);
}

if (g_cLogButtons.BoolValue)
Expand Down Expand Up @@ -1661,14 +1664,14 @@ public void OnClientPutInServer(int client)
}

HookClient(client);
if (g_cDebugMessages.BoolValue)
if (g_cDebug.BoolValue)
{
LogToFileEx(g_sKarmaFile, "OnClientPutInServer - 1 (%N)", client);
}

if (g_dDB != null)
{
if (g_cDebugMessages.BoolValue)
if (g_cDebug.BoolValue)
{
LogToFileEx(g_sKarmaFile, "OnClientPutInServer - 2 (%N), Valid Database", client);
}
Expand All @@ -1680,14 +1683,14 @@ void LateLoadClients(bool bHook = false)
{
LoopValidClients(i)
{
if (g_cDebugMessages.BoolValue)
if (g_cDebug.BoolValue)
{
LogToFileEx(g_sKarmaFile, "LateLoadClients - 1 (%N)", i);
}

if (g_dDB != null)
{
if (g_cDebugMessages.BoolValue)
if (g_cDebug.BoolValue)
{
LogToFileEx(g_sKarmaFile, "LateLoadClients - 2 (%N), Valid Database", i);
}
Expand Down Expand Up @@ -2135,7 +2138,7 @@ public Action Timer_OnClientPutInServer(Handle timer, any userid)

if (TTT_IsClientValid(client))
{
if (g_cDebugMessages.BoolValue)
if (g_cDebug.BoolValue)
{
LogToFileEx(g_sKarmaFile, "Timer_OnClientPutInServer - 1 (%N)", client);
}
Expand Down Expand Up @@ -4132,7 +4135,7 @@ public Action Timer_5(Handle timer)
iKarma *= -1;
}

if (g_cDebugMessages.BoolValue)
if (g_cDebug.BoolValue)
{
LogToFileEx(g_sKarmaFile, "(Timer_5) - 1 Client: \"%L\", g_bKarma: %d, g_cKarmaBan: %d, iKarma: %d (g_iKarma: %d)", i, g_bKarma[i], g_ckarmaBan.IntValue, iKarma, g_iKarma[i]);
}
Expand Down Expand Up @@ -4418,7 +4421,7 @@ void LoadClientKarma(int userid)

if (!IsFakeClient(client))
{
if (g_cDebugMessages.BoolValue)
if (g_cDebug.BoolValue)
{
LogToFileEx(g_sKarmaFile, "(LoadClientKarma) - 1 Client: \"%L\"", client);
}
Expand All @@ -4427,7 +4430,7 @@ void LoadClientKarma(int userid)

if (!GetClientAuthId(client, AuthId_SteamID64, sCommunityID, sizeof(sCommunityID)))
{
if (g_cDebugMessages.BoolValue)
if (g_cDebug.BoolValue)
{
LogToFileEx(g_sKarmaFile, "(LoadClientKarma) - 1.1 Client: \"%L\"", client);
}
Expand All @@ -4437,19 +4440,19 @@ void LoadClientKarma(int userid)

char sQuery[2048];
Format(sQuery, sizeof(sQuery), "SELECT `karma` FROM `ttt` WHERE `communityid`= \"%s\";", sCommunityID);
if (g_cDebugMessages.BoolValue)
if (g_cDebug.BoolValue)
{
LogToFileEx(g_sKarmaFile, "(LoadClientKarma) - 2 Client: \"%L\", Query: \"%s\"", client, sQuery);
}

if (g_cDebugMessages.BoolValue)
if (g_cDebug.BoolValue)
{
LogToFileEx(g_sLogFile, sQuery);
}

if (g_dDB != null)
{
if (g_cDebugMessages.BoolValue)
if (g_cDebug.BoolValue)
{
LogToFileEx(g_sKarmaFile, "(LoadClientKarma) - 3 Client: \"%L\", Valid Database", client);
}
Expand Down

0 comments on commit 7c39ad9

Please sign in to comment.