From fa42dbf011cf718fb9e5c28b24ef73b56b66887d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Wed, 30 Mar 2005 11:37:41 +0000 Subject: [PATCH] Added stock admin_print(access, const DESTINATION, const MSG[]); --- plugins/include/amxmisc.inc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/plugins/include/amxmisc.inc b/plugins/include/amxmisc.inc index 702624e6..80765e29 100755 --- a/plugins/include/amxmisc.inc +++ b/plugins/include/amxmisc.inc @@ -190,4 +190,31 @@ stock AddMenuItem_call(const MENU_TEXT[], const MENU_CMD[], const MENU_ACCESS, c callfunc_push_str(MENU_PLUGIN) callfunc_end() +} + +// Send out MSG using client_print() to all clients having required access. +stock admin_print(access, const DESTINATION, const MSG[]) { + new const MAXPLAYERS = get_maxplayers() + + new bool:mustBeAdmin + if (access & ADMIN_ADMIN) { + mustBeAdmin = true + access &= ~ADMIN_ADMIN + } + else + mustBeAdmin = false + + for (new i = 1; i <= MAXPLAYERS; i++) { + // No offliners, bots or people without the required access. + if (!is_user_connected(i) || is_user_bot(i)) + continue + + if (mustBeAdmin && !is_user_admin(i)) + continue + + if (access > 0 && !(get_user_flags(i) & access)) + continue + + client_print(i, DESTINATION, MSG) + } } \ No newline at end of file