Signature
stock show_activity(id, const name[], const fmt[], any:...){ static __amx_show_activity; if(__amx_show_activity == 0) { __amx_show_activity = get_cvar_pointer("amx_show_activity"); // if still not found, then register the cvar as a dummy if(__amx_show_activity == 0) { __amx_show_activity = register_cvar("amx_show_activity", "2", FCVAR_PROTECTED); } } new prefix[10]; if(is_user_admin(id)) { copy(prefix, charsmax(prefix), "ADMIN"); } else { copy(prefix, charsmax(prefix), "PLAYER"); } new buffer[512]; vformat(buffer, charsmax(buffer), fmt, 4); switch(get_pcvar_num(__amx_show_activity)) { case 5: // hide name only to admins, show nothing to normal users { for(new i = 1; i <= MaxClients; i++) { if(is_user_connected(i)) { if(is_user_admin(i)) { client_print(i, print_chat, "%L: %s", i, prefix, buffer); } } } } case 4: // show name only to admins, show nothing to normal users { for(new i = 1; i <= MaxClients; i++) { if(is_user_connected(i)) { if(is_user_admin(i)) { client_print(i, print_chat, "%L %s: %s", i, prefix, name, buffer); } } } } case 3: // show name only to admins, hide name from normal users { for(new i = 1; i <= MaxClients; i++) { if(is_user_connected(i)) { if(is_user_admin(i)) { client_print(i, print_chat, "%L %s: %s", i, prefix, name, buffer); } else { client_print(i, print_chat, "%L: %s", i, prefix, buffer); } } } } case 2: // show name to all { client_print(0, print_chat, "%L %s: %s", LANG_PLAYER, prefix , name , buffer); } case 1: // hide name to all { client_print(0, print_chat, "%L: %s", LANG_PLAYER, prefix, buffer); } }}
Description
Standard method to show admin activity to clients connected to the server.
This depends on the amx_show_activity cvar. See documentation for more details.
Parameters
- id — Client index performing the action
- name — Name of client performing the action
- fmt — Formatting rules
- ... — Variable number of formatting parameters
No return value