|
Member
Join Date: Aug 2016
Location: Việt Nam
|

07-26-2017
, 03:43
Cannot cout admin
|
#1
|
This is my code
PHP Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta> #include <fun>
#define PLUGIN "BB: ADMIN CHECK" #define VERSION "1.0" #define AUTHOR "VINAGHOST"
new text_msg const AdminFlag = ADMIN_BAN new hadadmin, admin[33], p_report[33], checking[33], originold[33][3] public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /report", "report") register_clcmd("say /check", "check", ADMIN_BAN) register_clcmd("say /done", "done", ADMIN_BAN) text_msg = get_user_msgid("SayText") hadadmin = 0 } public telemod(id, target) { if (!is_user_alive(id) || !is_user_alive(target)) return; p_report[target] = false checking[id] = true fm_set_entity_visibility(id, 0) new origin[3] get_user_origin(target, origin) get_user_origin(id, originold[id]) set_user_origin(id, origin) set_user_noclip(id, 0) client_color(id, "!g[Report ADMIN] !yAfter you check, say /done to be normal.") } public done(id, level, cid) { if(!cmd_access(id, level, cid, 0)) return PLUGIN_CONTINUE if(!checking[id]) return PLUGIN_CONTINUE fm_set_entity_visibility(id, 1) set_user_noclip(id, 1) set_user_origin(id, originold[id]) return PLUGIN_CONTINUE } public client_authorized(id) { if( is_user_connected(id) ) { if (get_user_flags(id) & AdminFlag) { hadadmin++ admin[id] = true } } p_report[id] = false checking[id] = false } public client_disconnect(id) { if( admin[id] ) { hadadmin-- admin[id] = false } p_report[id] = false checking[id] = false } public check(id, level, cid) { if(!cmd_access(id, level, cid, 0)) return PLUGIN_CONTINUE new check_p = menu_create("Check player:^n", "check_menu") new Players[32], PlayersNum, index get_players(Players, PlayersNum) new PlayerName[43], UserId[6] for(new i ; i < PlayersNum; i++) { index = Players[i] if (index == id ) continue; get_user_name(index, PlayerName, charsmax(PlayerName)) num_to_str(get_user_userid(index), UserId, charsmax(UserId)) format(PlayerName, charsmax(PlayerName), "%s%s", p_report[index] ? "\r" : "\w", PlayerName) menu_additem(check_p, PlayerName, UserId, 0) } menu_display(id, check_p, 0) return PLUGIN_CONTINUE } public check_menu(id, menu, item) { if(item == MENU_EXIT) { menu_destroy(menu) return; } new UserId[6], Name[32], Access, CallBack menu_item_getinfo(menu, item, Access, UserId, charsmax(UserId), Name, charsmax(Name), CallBack) new IntUserId = str_to_num(UserId) new Target = find_player("k", IntUserId) if(Target) { if (!is_user_alive(id)) return; telemod(id, Target) } else client_color(id, "!g[Report ADMIN] !ySorry but !g%s escaped", Name) menu_destroy(menu) } public report(id) { if (hadadmin) { new report_main = menu_create("Reported:", "report_menu") menu_additem(report_main, "Need help", "admin will teleport to you"); menu_additem(report_main, "Report someone", "admin will check this guy for you") menu_setprop( report_main, MPROP_EXIT, MEXIT_ALL ); menu_display( id, report_main, 0 ); } else { client_color(id,"!g[Report ADMIN] !ySorry but no admin is online") } return PLUGIN_CONTINUE } public report_menu(id, menu, item ) { switch( item ) { case 0: { client_color(id, "!g[Report ADMIN] !yYou have sent the report, admin will teleport to you.") new Players[32], Num, index get_players(Players, Num, "c") for(new i; i < Num; i++) { index = Players[i] if(get_user_flags(index) & AdminFlag) { new name[33] get_user_name(id,name,charsmax(name)) client_color(index, "!g[Report ADMIN] !y%s need help.", name) } } p_report[id] = true } case 1: report_player(id) } menu_destroy( menu ); return PLUGIN_HANDLED; } public report_player(id) { new report_p = menu_create("Bao cao player:", "report_playermenu") new Players[32], PlayersNum, index get_players(Players, PlayersNum) new PlayerName[32], UserId[6] for(new i ; i < PlayersNum; i++) { index = Players[i] if (index == id ) continue; get_user_name(index, PlayerName, charsmax(PlayerName)) num_to_str(get_user_userid(index), UserId, charsmax(UserId)) menu_additem(report_p, PlayerName, UserId, 0) } menu_display(id, report_p, 0) } public report_playermenu(id, menu, item) { if(item == MENU_EXIT) { menu_destroy(menu) return } new UserId[6], Name[32], Access, CallBack menu_item_getinfo(menu, item, Access, UserId, charsmax(UserId), Name, charsmax(Name), CallBack) new IntUserId = str_to_num(UserId) new Target = find_player("k", IntUserId) if(Target) { client_color(id, "!g[Report ADMIN] !yYou have sent the report. Admin will check !g%s", Name) new Players[32], Num, index get_players(Players, Num, "c") for(new i; i < Num; i++) { index = Players[i] if(get_user_flags(index) & AdminFlag) { new nameT[33] get_user_name(id,nameT,charsmax(nameT)) client_color(index, "!g[Report ADMIN] !y%s need admin check %s.", nameT, Name) } } p_report[Target] = true } else client_color(id, "!g[Report ADMIN] !ySorry but !g%s escaped", Name) menu_destroy(menu) }
stock client_color(const id, const input[], any:...) { new count = 1, players[32] static msg[191] vformat(msg, 190, input, 3) replace_all(msg, 190, "!g", "^4") replace_all(msg, 190, "!y", "^1") replace_all(msg, 190, "!t", "^3") replace_all(msg, 190, "!t2", "^0") if (id) players[0] = id; else get_players(players, count, "sch") for (new i = 0; i < count; i++) { if (is_user_connected(players[i])) { message_begin(MSG_ONE_UNRELIABLE, text_msg, _, players[i]) write_byte(players[i]) write_string(msg) message_end() } } } stock fm_set_entity_visibility(index, visible = 1) { set_pev(index, pev_effects, visible == 1 ? pev(index, pev_effects) & ~EF_NODRAW : pev(index, pev_effects) | EF_NODRAW);
return 1; }
But when I enter my server and say /check, noting is happening. And when I say /report, I take this
"[Report ADMIN] Sorry but no admin is online" even then I already have flag ADMIN_BAN
So anyone help me please and sorry for my bad English, I'm from Viet Nam ._.
Last edited by VINAGHOST; 07-26-2017 at 08:27.
Reason: sorry for mistakes I use my language in code and I change to English before I post ._.
|
|