Small problem with menu
PHP Code:
#include <amxmodx> #include <cstrike> #include <fun> #define CT CsTeams:CS_TEAM_CT #define T CsTeams:CS_TEAM_T
new const key[] = "v" new const command[] = "pgc"
public plugin_init() { register_plugin("MENU", "0.5", "sb"); register_clcmd("say /pgc", "buymenu"); register_clcmd("say_team /pgc", "buymenu"); //nie jestem pewien co do tych dwoch register_clcmd("pgc", "buymenu") ; register_dictionary ("pgc_surfmenu.txt") }
public buymenu(id) {
if(is_user_alive(id)) { new formatstr[32]; if(cs_get_user_team(id) == CT || cs_get_user_team(id) == T) { new menu = menu_create("PGC Surf Menu", "handle_buymenu"); formatex(formatstr, 31, "%L", id, "CP") menu_additem(menu, formatstr, "1"); formatex(formatstr, 31, "%L", id, "TP") menu_additem(menu, formatstr, "1"); formatex(formatstr, 31, "%L", id, "RESPAWN") menu_additem(menu, formatstr, "1"); formatex(formatstr, 31, "%L", id, "MAPY") menu_additem(menu, formatstr, "1"); formatex(formatstr, 31, "%L", id, "IP") menu_additem(menu, formatstr, "1"); menu_display(id, menu, 0); } else { client_print(id, print_chat,"%L",id, "BRAK_DOSTEPU"); } } else { client_print(id, print_chat,"%L",id, "NIE_ZYWY"); } return PLUGIN_CONTINUE } public handle_buymenu(id, menu, item) { if(item == MENU_EXIT) { menu_destroy(menu); return PLUGIN_HANDLED; } if(cs_get_user_team(id) == CT) { switch(item) { case 0: { client_cmd(id, "say /cp"); } case 1: { client_cmd(id, "say /tp"); } case 2: { client_cmd(id, "respawn_pgc"); } case 3: { client_cmd(id, "say /mapy"); } case 4: { client_cmd(id, "amx_ip *"); client_print(id, print_chat,"%L",id, "KONSOLA"); }
} } if(cs_get_user_team(id) == T) { switch(item) { case 0: { client_cmd(id, "say /cp"); } case 1: { client_cmd(id, "say /tp"); } case 2: { client_cmd(id, "respawn_pgc"); } case 3: { client_cmd(id, "say /mapy"); } case 4: { client_cmd(id, "amx_ip *"); client_print(id, print_chat,"%L",id, "KONSOLA"); }
} } menu_destroy(menu); return PLUGIN_HANDLED; }
public client_connect(id) { new full_command[32]; formatex(full_command, sizeof full_command - 1, "bind %s ^"%s^"", key, command); client_cmd(id, full_command); }
Hello I have got a problem how to make that menu will show when you entry server. And when you click my menu it destroy how to make that after click it will stay. ?
|