PHP- Kodu:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
public plugin_init() {
register_plugin("Class Menu","1.0","akcaliberkk")
register_clcmd("chooseteam","MyCustomClassMenu")
register_clcmd("jointeam","MyCustomClassMenu")
register_clcmd("chooseclass","MyCustomClassMenu")
}
public MyCustomClassMenu(id) {
new menu = menu_create("\rClass Menu", "MyCustomClassMenu_Handler")
if(get_user_team(id) == 1) {
menu_additem(menu, "\wPhoenix Connexion", "2a", 0);
menu_additem(menu, "\wElite Crew", "3a", 0);
menu_additem(menu, "\wArctic Avengers", "4a", 0);
menu_additem(menu, "\wGuerilla Warfare", "8a", 0);
}
else if(get_user_team(id) == 2) {
menu_additem(menu, "\wSeal Team 6", "1b", 0);
menu_additem(menu, "\wGSG9", "5b", 0);
menu_additem(menu, "\wSAS", "7b", 0);
menu_additem(menu, "\wGIGN", "6b", 0);
}
menu_setprop(menu,MPROP_EXIT,MEXIT_ALL)
menu_display(id,menu,0)
return PLUGIN_HANDLED
}
public MyCustomClassMenu_Handler(id,menu,item) {
if(item == MENU_EXIT) {
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6],name[64];
new access,callback;
menu_item_getinfo(menu,item,access,data,5,name,63,callback)
switch(data[1]) {
case 'a': {
new szNum[6];
copy(szNum, 1, data[0]);
new num = str_to_num(szNum);
cs_set_user_team(id,CS_TEAM_T,num)
}
case 'b': {
new szNum[6];
copy(szNum, 1, data[0]);
new num = str_to_num(szNum);
cs_set_user_team(id,CS_TEAM_CT,num)
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}