Junior Member
|
04-26-2010
, 11:44
Show it only for Admin's (Flag_H)
|
#1
|
Hey, i have some problem, that menu is showed for all player, i need to show it to only admins who have Flag H. (it's automaticaly showed in start of the round). Thank you for helping me !
PHP Code:
#include <amxmodx> #include <fakemeta> #include <fakemeta_util> #include <hamsandwich> #include <cstrike> #include <amxmisc> #include <fun> #define PLUGIN_NAME "JAILBREAK VIP" #define PLUGIN_AUTHOR "AURIMASKO" #define PLUGIN_VERSION "0.1" #define ADMINACCESS ADMIN_LEVEL_H static const COLOR[] = "^x04" static const CONTACT[] = "" new maxplayers new gmsgSayText new bool:FirstSpawn[33] public plugin_init() { register_plugin(PLUGIN_NAME, PLUGIN_AUTHOR, PLUGIN_VERSION); register_event("ResetHUD","event_reset_hud","be"); register_clcmd( "say vipmenu","MenuCmd",ADMIN_LEVEL_H,"Description of the command"); register_menucmd(register_menuid("Vali vaade"), 1023, "setview") register_clcmd("camera", "chooseview") register_clcmd("camera", "chooseview") register_cvar("amx_contactinfo", CONTACT, FCVAR_SERVER) gmsgSayText = get_user_msgid("SayText") maxplayers = get_maxplayers() RegisterHam (Ham_Spawn, "player", "Player_Spawn", 1) register_forward( FM_PlayerPreThink, "forward_player_prethink" ); register_logevent( "logevent_round_start", 2, "1=Round_Start" ); } public event_reset_hud(id) { if(is_user_alive(id) && get_user_flags(id) & ADMIN_LEVEL_H) return PLUGIN_CONTINUE; if(!access(id,ADMIN_LEVEL_H)) return PLUGIN_CONTINUE; set_task(1.0,"give_stuff",id); return PLUGIN_CONTINUE; } public give_stuff(id) { if(!is_user_connected(id)) return; fm_give_item(id, "weapon_flashbang"); fm_give_item(id, "weapon_flashbang"); set_user_health(id, get_user_health(id) + 30); } public handle_say(id) { new said[192] read_args(said,192) if(( containi(said, "who") != -1 && containi(said, "admin") != -1) || contain(said, "/vips") != -1) set_task(0.1,"print_viplist", id) return PLUGIN_CONTINUE } public print_viplist(user) { new adminnames[33][32] new message[256] new contactinfo[256], contact[112] new id, count, x, len for(id = 1 ; id <= maxplayers ; id++) if(is_user_connected(id)) if(get_user_flags(id) & ADMIN_LEVEL_H) get_user_name(id, adminnames[count++], 31) len = format(message, 255, "%s Prisijunge vipai: ",COLOR) if(count > 0) { for(x = 0 ; x < count ; x++) { len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count-1) ? ", ":"") if(len > 96 ) { print_message(user, message) len = format(message, 255, "%s ",COLOR) } } print_message(user, message) } else { len += format(message[len], 255-len, "Nera prisijungusiu vipu.") print_message(user, message) } get_cvar_string("amx_contactinfo", contact, 63) if(contact[0]) { format(contactinfo, 111, "%s Contact Server Admin -- %s", COLOR, contact) print_message(user, contactinfo) } } print_message(id, msg[]) { message_begin(MSG_ONE, gmsgSayText, {0,0,0}, id) write_byte(id) write_string(msg) message_end() } public Player_Spawn(id) { if( !is_user_alive(id) ) { FirstSpawn[id] = true return } FirstSpawn[id] = false new menu = menu_create("VIP MENU:", "vip_menu"); menu_additem(menu, "Glockas + 20HP", "1", ADMIN_LEVEL_H); menu_additem(menu, "Usp + 20HP", "2", ADMIN_LEVEL_H); menu_additem(menu, "+100 armor", "3", ADMIN_LEVEL_H); menu_additem(menu ,"+50 HP", "4" , ADMIN_LEVEL_H); menu_additem(menu ,"Usp +50 armor", "5" , ADMIN_LEVEL_H); menu_additem(menu ,"Glockas + 50 armor", "6" , ADMIN_LEVEL_H); menu_additem(menu ,"Glokas", "7" , ADMIN_LEVEL_H); menu_additem(menu ,"Usp", "8" , ADMIN_LEVEL_H); menu_setprop(menu, MPROP_EXIT, MEXIT_ALL); menu_display(id, menu, 0); } public vip_menu(id, menu, item) { if( item == MENU_EXIT ) { menu_destroy(menu); return PLUGIN_HANDLED; } new data[6], iName[64]; new access, callback; menu_item_getinfo(menu, item, access, data,5, iName, 63, callback); new key = str_to_num(data); switch(key) { case 1: { strip_user_weapons (id) fm_give_item( id, "weapon_knife" ); fm_give_item( id, "weapon_glock18" ); fm_give_item( id, "ammo_50ae" ); fm_set_user_health( id, get_user_health( id ) + 20 ); client_print(id, print_chat, "Gavai Glocka + 20HP"); menu_destroy(menu); return PLUGIN_HANDLED; } case 2: { strip_user_weapons (id) fm_give_item( id, "weapon_knife" ); fm_give_item( id, "weapon_usp" ); fm_give_item( id, "ammo_50ae" ); fm_set_user_health( id, get_user_health( id ) + 20 ); client_print(id, print_chat, "Gavai Usp + 20 HP"); } case 3: { fm_set_user_armor( id, get_user_armor( id ) + 100 ); client_print(id, print_chat, "Gavai 100 Armoro"); } case 4: { fm_set_user_health( id, get_user_health( id ) + 50 ); client_print(id, print_chat, "Gavai + 50 HP"); } case 5: { fm_give_item( id, "weapon_knife" ); fm_give_item( id, "weapon_usp" ); fm_give_item( id, "ammo_50ae" ); fm_set_user_armor( id, get_user_armor( id ) + 50 ); client_print(id, print_chat, "Gavai Usp + 50 Armor"); } case 6: { fm_give_item( id, "weapon_knife" ); fm_give_item( id, "weapon_glock18" ); fm_give_item( id, "ammo_50ae" ); fm_set_user_armor( id, get_user_armor( id ) + 50 ); client_print(id, print_chat, "Gavai Glocka + 50 Armor"); } case 7: { fm_give_item( id, "weapon_knife" ); fm_give_item( id, "weapon_glock18" ); fm_give_item( id, "ammo_50ae" ); fm_give_item( id, "ammo_50ae" ); client_print(id, print_chat, "Gavai Gloka "); } case 8: { fm_give_item( id, "weapon_knife" ); fm_give_item( id, "weapon_usp" ); fm_give_item( id, "ammo_50ae" ); fm_give_item( id, "ammo_50ae" ); client_print(id, print_chat, "Gavai Usp "); } } menu_destroy(menu); return PLUGIN_HANDLED; }
|
|