@@ -41,29 +41,21 @@ public stock const PluginAuthor[] = "Sergey Shorokhov"
4141public stock const PluginURL[] = " https://Dev-CS.ru/"
4242public stock const PluginDescription[] = " A core plugin for control different types of chat."
4343
44- public plugin_init () {
44+ public plugin_precache () {
4545 register_plugin (PluginName, PluginVersion, PluginAuthor)
4646 create_cvar (" ChatAdditions_version" , PluginVersion, (FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED))
4747
4848 GetLogsFilePath (g_logsPath, .dir = LOG_FOLDER)
4949
50- bind_pcvar_num (create_cvar (" ca_log_type" , " 1" ,
51- .description = fmt (" Log file type\n 0 = log to common amxx log file (logs/L*.log)\n 1 = log to plugins folder (logs/%s /[plugin name]/L*.log)" , LOG_FOLDER),
52- .has_min = true , .min_val = 0 .0 ,
53- .has_max = true , .max_val = float (_LogToDir)
54- ),
55- ca_log_type
56- )
57- bind_pcvar_num (create_cvar (" ca_log_level" , " 3" ,
58- .description = " Log level\n 0 = disable logs\n 1 = add info messages logs\n 2 = add warinigs info\n 3 = add debug messages" ,
59- .has_min = true , .min_val = 0 .0 ,
60- .has_max = true , .max_val = float (logLevel_Debug)
61- ),
62- ca_log_level
63- )
50+ Register_CVars ()
6451
52+ AutoExecConfig (true , " ChatAdditions_core" , " ChatAdditions" )
53+ }
54+
55+ public plugin_init () {
6556 register_clcmd (" say" , " ClCmd_Say" , ADMIN_ALL)
6657 register_clcmd (" say_team" , " ClCmd_SayTeam" , ADMIN_ALL)
58+
6759 RegisterHookChain (RG_CSGameRules_CanPlayerHearPlayer, " CSGameRules_CanPlayerHearPlayer" , .post = false )
6860 RegisterHookChain (RG_CBasePlayer_SetClientUserInfoName, " CBasePlayer_SetClientUserInfoName" , .post = false )
6961
@@ -75,8 +67,6 @@ public plugin_init() {
7567 g_fwdClientVoice = CreateMultiForward (" CA_Client_Voice" , ET_STOP, FP_CELL, FP_CELL)
7668 g_fwdClientChangeName = CreateMultiForward (" CA_Client_ChangeName" , ET_STOP, FP_CELL, FP_STRING)
7769
78- AutoExecConfig (true , " ChatAdditions_core" , " ChatAdditions" )
79-
8070 CA_Log (logLevel_Debug, " Chat Additions: Core initialized!" )
8171}
8272
@@ -86,6 +76,24 @@ public plugin_end() {
8676 DestroyForward (g_fwdClientVoice)
8777}
8878
79+ Register_CVars () {
80+ bind_pcvar_num (create_cvar (" ca_log_type" , " 1" ,
81+ .description = fmt (" Log file type\n 0 = log to common amxx log file (logs/L*.log)\n 1 = log to plugins folder (logs/%s /[plugin name]/L*.log)" , LOG_FOLDER),
82+ .has_min = true , .min_val = 0 .0 ,
83+ .has_max = true , .max_val = float (_LogToDir)
84+ ),
85+ ca_log_type
86+ )
87+
88+ bind_pcvar_num (create_cvar (" ca_log_level" , " 3" ,
89+ .description = " Log level\n 0 = disable logs\n 1 = add info messages logs\n 2 = add warinigs info\n 3 = add debug messages" ,
90+ .has_min = true , .min_val = 0 .0 ,
91+ .has_max = true , .max_val = float (logLevel_Debug)
92+ ),
93+ ca_log_level
94+ )
95+ }
96+
8997public plugin_natives () {
9098 register_library (" ChatAdditions_Core" )
9199
0 commit comments