Skip to content

Commit b09ec31

Browse files
authored
ca_log_type: add 3 type with using elog_message (#332)
1 parent f728b63 commit b09ec31

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

cstrike/addons/amxmodx/scripting/ChatAdditions/ChatAdditions_Core.sma

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
enum logType_s {
1313
_Default,
1414
_LogToDir,
15-
_LogToDirSilent
15+
_LogToDirSilent,
16+
_LogToAlertMessage,
1617
}
1718

1819
new logType_s: ca_log_type,
@@ -147,19 +148,26 @@ Create_CVars() {
147148

148149
bind_pcvar_num(create_cvar("ca_log_type", "1",
149150
.description = fmt("Log file type^n \
150-
0 = log to common amxx log file (logs/L*.log)^n \
151-
1 = log to plugins folder (logs/%s/[plugin name]/L*.log)^n \
152-
2 = silent log to plugins folder (logs/%s/[plugin name]/L*.log)", LOG_FOLDER, LOG_FOLDER),
151+
0 = log to common amxx log file (logs/L*.log)^n \
152+
1 = log to plugins folder (logs/%s/[plugin name]/L*.log)^n \
153+
2 = silent log to plugins folder (logs/%s/[plugin name]/L*.log)^n \
154+
3 = use elog_message) \
155+
",
156+
LOG_FOLDER, LOG_FOLDER),
153157
.has_min = true, .min_val = 0.0,
154-
.has_max = true, .max_val = float(_LogToDirSilent)
158+
.has_max = true, .max_val = float(logType_s) - 1.0
155159
),
156160
ca_log_type
157161
)
158162

159163
bind_pcvar_num(create_cvar("ca_log_level", "1",
160-
.description = "Log level^n 0 = disable logs^n 1 = add info messages logs^n 2 = add warinigs info^n 3 = add debug messages",
164+
.description = "Log level^n \
165+
0 = disable logs^n \
166+
1 = add info messages logs^n \
167+
2 = add warinigs info^n \
168+
3 = add debug messages",
161169
.has_min = true, .min_val = 0.0,
162-
.has_max = true, .max_val = float(logLevel_Debug)
170+
.has_max = true, .max_val = float(logLevel_s) - 1.0
163171
),
164172
ca_log_level
165173
)
@@ -294,7 +302,7 @@ public bool: native_CA_Log(const plugin_id, const argc) {
294302

295303
new logsFile[PLATFORM_MAX_PATH]
296304

297-
if (ca_log_type > _Default) {
305+
if (ca_log_type == _LogToDir || ca_log_type == _LogToDirSilent) {
298306
new logsPath[PLATFORM_MAX_PATH]
299307
get_localinfo("amxx_logs", logsPath, charsmax(logsPath))
300308

@@ -322,6 +330,7 @@ public bool: native_CA_Log(const plugin_id, const argc) {
322330
case _Default: log_amx(msg)
323331
case _LogToDir: log_to_file(logsFile, msg)
324332
case _LogToDirSilent: log_to_file_ex(logsFile, msg)
333+
case _LogToAlertMessage: elog_message(msg)
325334
}
326335

327336
return true

0 commit comments

Comments
 (0)