BOM, EU JA ATÉ CRIEI UM TOPICO NA ALLIED MODDERS SOBRE.
https://forums.alliedmods.net/showthread.php?t=312150
SE ALGUEM PUDER ME AJUDAR AGRADEÇO DESDE JA.
- Código:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#define PLUGIN_NAME "[CS] Class Custom"
#define PLUGIN_VERSION "2.0.1.8"
#define PLUGIN_AUTHOR "Eclipse*"
const PDATA_SAFE = 2
const OFFSET_CSMENUCODE = 205
new const CT_ClassNames[][] = { "Seal Team 6", "GSG-9", "SAS", "GIGN" }
new const CT_ClassSysNames[][] = { "urban", "gsg9", "sas", "gign" }
new const T_ClassNames[][] = { "Phoenix Connexion", "Elite Crew", "Arctic Avengers", "Guerilla Warfare" }
new const T_ClassSysNames[][] = { "terror", "leet", "arctic", "guerilla" }
public plugin_init() {
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_message(get_user_msgid("ShowMenu"), "FWD_ShowMenu")
register_message(get_user_msgid("VGUIMenu"), "FWD_VGUIMenu")
register_clcmd("jointeam", "CLCMD_Team")
register_clcmd("chooseteam", "CLCMD_Team")
register_clcmd("joinclass", "CLCMD_Class")
}
public FWD_ShowMenu(MsgID, MsgDest, id) {
if (!is_user_connected(id))
return PLUGIN_CONTINUE;
new MenuTXT[64]; get_msg_arg_string(4, MenuTXT, charsmax(MenuTXT));
if (contain(MenuTXT, "Team_Select")) {
MENU_Team(id)
return PLUGIN_HANDLED
}
else if (contain(MenuTXT, "Terrorist_Select") || contain(MenuTXT, "CT_Select")) {
MENU_Class(id, CsTeams:cs_get_user_team(id))
return PLUGIN_HANDLED
}
//g_iMsgId[id] = MsgID
return PLUGIN_CONTINUE
}
public FWD_VGUIMenu(MsgID, MsgDest, id) {
if (!is_user_connected(id))
return PLUGIN_CONTINUE;
if (get_msg_arg_int(1) == PDATA_SAFE) {
MENU_Team(id)
return PLUGIN_HANDLED
}
else {
if (get_msg_arg_int(1) == 26 || get_msg_arg_int(1) == 27) {
MENU_Class(id, CsTeams:cs_get_user_team(id))
return PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE
}
public CLCMD_Team(id) {
/*if (!Is_Valid_Connected(id))
return PLUGIN_CONTINUE;*/
//set_pdata_int(id, 125, get_pdata_int(id, 125, 5) & ~(1<<8), 5)
MENU_Team(id)
return PLUGIN_HANDLED
}
public MENU_Team(id) {
if (!is_user_connected(id)) return PLUGIN_CONTINUE;
new MenuTXT[1024]; formatex(MenuTXT, charsmax(MenuTXT), "\yMenu da Equipe:\d");
new MenuID; MenuID = menu_create(MenuTXT, "SUBMENU_Team");
formatex(MenuTXT, charsmax(MenuTXT), "\wTerroristas")
menu_additem(MenuID, MenuTXT, "1")
formatex(MenuTXT, charsmax(MenuTXT), "\wContra-Terroristas^n")
menu_additem(MenuID, MenuTXT, "2")
formatex(MenuTXT, charsmax(MenuTXT), "\wEspectador^n")
menu_additem(MenuID, MenuTXT, "3")
/*formatex(MenuTXT, charsmax(MenuTXT), "\wSelecionar Aleatoriamente^n")
menu_additem(MenuID, MenuTXT, "4")*/
formatex(MenuTXT, charsmax(MenuTXT), "\wSair do Menu")
menu_setprop(MenuID, MPROP_EXITNAME, MenuTXT)
if (pev_valid(id) == PDATA_SAFE)
set_pdata_int(id, OFFSET_CSMENUCODE, 0);
menu_display(id, MenuID)
return PLUGIN_HANDLED
}
public SUBMENU_Team(id, Menu, Item) {
if (Item == MENU_EXIT || !is_user_connected(id)) {
menu_destroy(Menu)
return PLUGIN_HANDLED
}
new Access, Info[4], Name[32], CallBack
menu_item_getinfo(Menu, Item, Access, Info, charsmax(Info), Name, charsmax(Name), CallBack)
new Key; Key = str_to_num(Info);
switch (Key) {
case 1: {
engclient_cmd(id, "jointeam", Info)
MENU_Class(id, CsTeams:Key)
}
case 2: {
engclient_cmd(id, "jointeam", Info)
MENU_Class(id, CsTeams:Key)
}
case 3: engclient_cmd(id, "jointeam", Info);
//case 4: Fm_JoinTeam(id, random_num(1, Key-1));
}
return PLUGIN_HANDLED
}
public CLCMD_Class(id) {
/*if (!Is_Valid_Connected(id))
return PLUGIN_CONTINUE;*/
MENU_Class(id, cs_get_user_team(id))
return PLUGIN_HANDLED
}
public MENU_Class(id, CsTeams:Team) {
if (!is_user_connected(id)) return PLUGIN_CONTINUE;
new MenuTXT[1024]; formatex(MenuTXT, charsmax(MenuTXT), "\yMenu das Classes:\d");
new MenuID; MenuID = menu_create(MenuTXT, "SUBMENU_Class");
if (CsTeams:Team == CS_TEAM_T) {
for (new I = 0; I < sizeof(T_ClassNames); I++) {
formatex(MenuTXT, charsmax(MenuTXT), "\w%s", T_ClassNames[I])
new Num[4]; num_to_str(I+1, Num, charsmax(Num));
menu_additem(MenuID, MenuTXT, Num)
}
}
else if (CsTeams:Team == CS_TEAM_CT) {
for (new I = 0; I < sizeof(CT_ClassNames); I++) {
formatex(MenuTXT, charsmax(MenuTXT), "\w%s", CT_ClassNames[I])
new Num[4]; num_to_str(I+1, Num, charsmax(Num));
menu_additem(MenuID, MenuTXT, Num)
}
}
else {
menu_destroy(MenuID)
return PLUGIN_HANDLED
}
/*formatex(MenuTXT, charsmax(MenuTXT), "\wVoltar Pagina")
menu_setprop(MenuID, MPROP_BACKNAME, MenuTXT)
formatex(MenuTXT, charsmax(MenuTXT), "\wProxima Pagina")
menu_setprop(MenuID, MPROP_NEXTNAME, MenuTXT)*/
formatex(MenuTXT, charsmax(MenuTXT), "\wSair do Menu")
menu_setprop(MenuID, MPROP_EXITNAME, MenuTXT)
if (pev_valid(id) == PDATA_SAFE)
set_pdata_int(id, OFFSET_CSMENUCODE, 0);
menu_display(id, MenuID)
return PLUGIN_HANDLED
}
public SUBMENU_Class(id, Menu, Item) {
if (Item == MENU_EXIT || !is_user_connected(id) || cs_get_user_team(id) < CS_TEAM_T || cs_get_user_team(id) > CS_TEAM_CT) {
menu_destroy(Menu)
return PLUGIN_HANDLED
}
new Access, Info[4], Name[32], CallBack
menu_item_getinfo(Menu, Item, Access, Info, charsmax(Info), Name, charsmax(Name), CallBack)
new Key; Key = str_to_num(Info);
/*if (!Get_Bitvar(g_Alive, id)) {
dllfunc(
//ExecuteHamB(Ham_CS_RoundRespawn, id)
//Set_Bitvar(g_Alive, id)
}*/
engclient_cmd(id, "joinclass", Info)
if (cs_get_user_team(id) == CS_TEAM_T) {
switch (Key) {
case 1: cs_set_user_model(id, T_ClassSysNames[Key-1]);
case 2: cs_set_user_model(id, T_ClassSysNames[Key-1]);
case 3: cs_set_user_model(id, T_ClassSysNames[Key-1]);
case 4: cs_set_user_model(id, T_ClassSysNames[Key-1]);
}
}
else {
switch (Key) {
case 1: cs_set_user_model(id, CT_ClassSysNames[Key-1]);
case 2: cs_set_user_model(id, CT_ClassSysNames[Key-1]);
case 3: cs_set_user_model(id, CT_ClassSysNames[Key-1]);
case 4: cs_set_user_model(id, CT_ClassSysNames[Key-1]);
}
}
return PLUGIN_HANDLED
}
https://forums.alliedmods.net/showthread.php?t=312150
SE ALGUEM PUDER ME AJUDAR AGRADEÇO DESDE JA.