Add elog_message native (#451)

* elog_message

Like "log_message". Logs a message to the current server log file, however the messages sent are also sent to all plugins and can be hooked using "register_logevent".

* Update amxmodx.cpp

* Update Editor.sci

* Update UnitfrmMain.dfm
This commit is contained in:
PartialCloning 2017-08-01 06:14:53 -07:00 committed by Vincent Herbet
parent 1dc1f1b9c4
commit 24e56d0476
4 changed files with 29 additions and 1 deletions

View File

@ -2011,6 +2011,19 @@ static cell AMX_NATIVE_CALL log_message(AMX *amx, cell *params) /* 1 param */
return len; return len;
} }
static cell AMX_NATIVE_CALL elog_message(AMX *amx, cell *params) /* 1 param */
{
int len;
g_langMngr.SetDefLang(LANG_SERVER);
char* message = format_amxstring(amx, params, 1, len);
message[len++] = '\n';
message[len] = 0;
g_pEngTable->pfnAlertMessage(at_logged, "%s", message);
return len;
}
static cell AMX_NATIVE_CALL log_to_file(AMX *amx, cell *params) /* 1 param */ static cell AMX_NATIVE_CALL log_to_file(AMX *amx, cell *params) /* 1 param */
{ {
int ilen; int ilen;
@ -4782,6 +4795,7 @@ AMX_NATIVE_INFO amxmodx_Natives[] =
{"lang_exists", lang_exists}, {"lang_exists", lang_exists},
{"log_amx", log_amx}, {"log_amx", log_amx},
{"log_message", log_message}, {"log_message", log_message},
{"elog_message", elog_message},
{"log_to_file", log_to_file}, {"log_to_file", log_to_file},
{"md5", amx_md5}, {"md5", amx_md5},
{"md5_file", amx_md5_file}, {"md5_file", amx_md5_file},

View File

@ -7369,6 +7369,7 @@ object frmMain: TfrmMain
'list_store_string' 'list_store_string'
'log_amx' 'log_amx'
'log_message' 'log_message'
'elog_message'
'log_to_file' 'log_to_file'
'make_deathmsg' 'make_deathmsg'
'make_string' 'make_string'

View File

@ -389,7 +389,7 @@ server_changelevel plugin_cfg plugin_end plugin_log plugin_precache client_infoc
set_localinfo get_localinfo show_motd client_print engclient_print console_print console_cmd register_event register_logevent set_hudmessage show_hudmessage show_menu read_data read_datanum read_logdata read_logargc read_logargv\ set_localinfo get_localinfo show_motd client_print engclient_print console_print console_cmd register_event register_logevent set_hudmessage show_hudmessage show_menu read_data read_datanum read_logdata read_logargc read_logargv\
parse_loguser server_print is_map_valid is_user_bot is_user_hltv is_user_connected is_user_connecting is_user_alive is_dedicated_server is_linux_server is_jit_enabled get_amxx_verstring get_user_attacker get_user_aiming get_user_frags get_user_armor get_user_deaths\ parse_loguser server_print is_map_valid is_user_bot is_user_hltv is_user_connected is_user_connecting is_user_alive is_dedicated_server is_linux_server is_jit_enabled get_amxx_verstring get_user_attacker get_user_aiming get_user_frags get_user_armor get_user_deaths\
get_user_health get_user_index get_user_ip user_has_weapon get_user_weapon get_user_ammo num_to_word get_user_team get_user_time get_user_ping get_user_origin get_user_weapons get_weaponname get_user_name get_user_authid get_user_userid user_slap\ get_user_health get_user_index get_user_ip user_has_weapon get_user_weapon get_user_ammo num_to_word get_user_team get_user_time get_user_ping get_user_origin get_user_weapons get_weaponname get_user_name get_user_authid get_user_userid user_slap\
user_kill log_amx log_message log_to_file get_playersnum get_players read_argv read_args read_argc read_flags get_flags find_player remove_quotes client_cmd engclient_cmd server_cmd set_cvar_string\ user_kill log_amx log_message elog_message log_to_file get_playersnum get_players read_argv read_args read_argc read_flags get_flags find_player remove_quotes client_cmd engclient_cmd server_cmd set_cvar_string\
cvar_exists remove_cvar_flags set_cvar_flags get_cvar_flags set_cvar_float get_cvar_float get_cvar_num set_cvar_num get_cvar_string get_mapname get_timeleft get_gametime get_maxplayers get_modname get_time format_time get_systime\ cvar_exists remove_cvar_flags set_cvar_flags get_cvar_flags set_cvar_float get_cvar_float get_cvar_num set_cvar_num get_cvar_string get_mapname get_timeleft get_gametime get_maxplayers get_modname get_time format_time get_systime\
parse_time set_task remove_task change_task task_exists set_user_flags get_user_flags remove_user_flags register_clcmd register_concmd register_srvcmd get_clcmd get_clcmdsnum get_srvcmd get_srvcmdsnum get_concmd get_concmd_plid\ parse_time set_task remove_task change_task task_exists set_user_flags get_user_flags remove_user_flags register_clcmd register_concmd register_srvcmd get_clcmd get_clcmdsnum get_srvcmd get_srvcmdsnum get_concmd get_concmd_plid\
get_concmdsnum get_plugins_cvarsnum get_plugins_cvar register_menuid register_menucmd get_user_menu server_exec emit_sound register_cvar random_float random_num get_user_msgid get_user_msgname xvar_exists get_xvar_id get_xvar_num get_xvar_float\ get_concmdsnum get_plugins_cvarsnum get_plugins_cvar register_menuid register_menucmd get_user_menu server_exec emit_sound register_cvar random_float random_num get_user_msgid get_user_msgname xvar_exists get_xvar_id get_xvar_num get_xvar_float\

View File

@ -1288,6 +1288,19 @@ native log_amx(const string[], any:...);
*/ */
native log_message(const message[], any:...); native log_message(const message[], any:...);
/**
* Logs a message hookable by plugins to the current server log file.
*
* @note The log will include a timestamp with the message.
* @note The message can be hooked using "register_logevent".
*
* @param string Formatting rules
* @param ... Variable number of formatting parameters
*
* @return Number of printed characters
*/
native elog_message(const message[], any:...);
/** /**
* Logs a message to the specified file * Logs a message to the specified file
* *