20/02/2019, 07:18 PM
Hola, pueden hacer que el menú se abra automáticamente cuando inicie la ronda y tambien que lo player normales y admines puedan abrir el menu, por favor
Código PHP:
#include <amxmodx>
#include <cstrike>
#include <fakemeta_util>
#include <hamsandwich>
#define PLUGIN "Menu de Armas"
#define VERSION "3.0"
#define xPrefix "\d[ \w ~ Your Tag ~\d ]"
#define xPrefixChat "!y[!g ~ Your Prefix ~!y]"
#define ADMIN_ACCESS ADMIN_KICK
#define TASK_MENU
new xRememberSelection[33], acao[33], xNaoMostrar[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, "IceeedR Edited")
register_clcmd("say", "Say_Hook")
RegisterHam(Ham_Spawn, "player", "xHam_Spawn", true)
}
public xHam_Spawn(id)
{
SendCmd(id,"bind ^"v^" ^"say /guns_menu^"")
}
public Say_Hook(id)
{
new szMessage[36]
read_args(szMessage, charsmax(szMessage))
remove_quotes(szMessage)
if(equal(szMessage,"/guns_menu") || equal(szMessage,".guns_menu"))
{
xGetGuns(id)
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public xGetGuns(id)
{
static menu
if(xRememberSelection[id])
{
_xMenuGuns(id, menu, acao[id])
}
else
{
xMenuGuns(id)
return PLUGIN_HANDLED;
}
return PLUGIN_HANDLED;
}
// Menu Guns
public xMenuGuns(id)
{
if(!(get_user_flags(id) & ADMIN_ACCESS))
{
client_print_color(id, "%s ^4You ^1Are ^3Not ^4Vip^3!", xPrefixChat)
return PLUGIN_HANDLED
}
if(is_user_connected(id) && is_user_alive(id) && cs_get_user_buyzone(id))
{
if(xRememberSelection[id])
{
xRememberSelection[id] = false
client_print_color(id, "%s !yYou have reactivated the weapons menu.", xPrefixChat)
}
}
new xTeam
xTeam = get_user_team(id)
new xMenu[500]
formatex(xMenu, 499, "%s \yMenu de Comprar \dKIT (\w GUNS \d)", xPrefix)
new menu = menu_create(xMenu, "_xMenuGuns")
if(xTeam == 1) // Guns Team-TR
{
menu_additem(menu, "\wKIT [\y AK47 \w]\d Desert + Grenades + vest", "1")
menu_additem(menu, "\wKIT [\y AWP \w]\d Desert + Grenades + vest", "2")
menu_additem(menu, "\wKIT [\y GALIL \w]\d Desert + Grenades + vest", "3.")
menu_additem(menu, "\wKIT [\y SCOUT \w]\d Desert + Grenades + vest^n", "4")
}
else // Guns Team-CT
{
menu_additem(menu, "\wKIT [\y M4A1 \w]\d Desert + Grenades + vest + Defuse Kit", "1")
menu_additem(menu, "\wKIT [\y AWP \w]\d Desert + Grenades + vest + Defuse Kit", "2")
menu_additem(menu, "\wKIT [\y FAMAS \w]\d Desert + Grenades + vest + Defuse Kit", "3")
menu_additem(menu, "\wKIT [\y SCOUT \w]\d Desert + Grenades + vest^n", "4")
}
if(!is_user_alive(id))
{
client_print_color(id, "%s !yYou can not buy weapons while DEAD!", xPrefixChat)
menu_destroy(menu); return PLUGIN_HANDLED;
}
else if(!cs_get_user_buyzone(id))
{
client_print_color(id, "%s !yYou can not buy weapons outside the BASE !!", xPrefixChat)
menu_destroy(menu); return PLUGIN_HANDLED;
}
if(xRememberSelection[id])
{
menu_additem(menu, "\yRecall Selection? \d[\wActivated\d]^n", "5")
}
else
{
menu_additem(menu, "\yRecall Selection? \d[\rDisabled\d]^n", "5")
}
menu_additem(menu, "\w(\r DO NOT SHOW AGAIN! \w)", "6")
menu_setprop(menu, MPROP_EXITNAME, "Exit")
menu_display(id, menu, 0)
return PLUGIN_HANDLED
}
public _xMenuGuns(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu); return PLUGIN_HANDLED;
}
new xTeam
xTeam = get_user_team(id)
if(!is_user_connected(id)) return PLUGIN_HANDLED
switch(item)
{
case 0:
{
if(xTeam == 1)
{
client_cmd(id,"vesthelm;ak47;deagle;secammo;primammo;hegren;flash;flash")
}
else
{
client_cmd(id, "defuser;vesthelm;m4a1;deagle;secammo;primammo;hegren;flash;flash")
}
acao[id] = item
}
case 1:
{
if(xTeam == 1)
{
client_cmd(id,"vesthelm;awp;deagle;secammo;primammo;hegren;flash;flash")
}
else
{
client_cmd(id, "defuser;vesthelm;awp;deagle;secammo;primammo;hegren;flash;flash")
}
acao[id] = item
}
case 2:
{
if(xTeam == 1)
{
client_cmd(id, "vesthelm;galil;deagle;secammo;primammo;hegren;flash;flash")
}
else
{
client_cmd(id, "defuser;vesthelm;famas;deagle;secammo;primammo;xhegren;flash;flash")
}
acao[id] = item
}
case 3:
{
if(xTeam == 1)
{
client_cmd(id,"vesthelm;scout;deagle;secammo;primammo;hegren;flash;flash")
}
else
{
client_cmd(id, "defuser;vesthelm;scout;deagle;secammo;primammo;hegren;flash;flash")
}
acao[id] = item
}
case 4:
{
if(xRememberSelection[id])
{
xRememberSelection[id] = false;
}
else
{
xRememberSelection[id] = true;
client_print_color(id, "%s !yYou activated !tRecall-Selection of weapons!y, type it !t/guns_menu !yto re-activate.", xPrefixChat)
xGetGuns(id)
}
}
case 5:
{
xNaoMostrar[id] = true;
client_print_color(id, "%s !gREADY!! !yNow to activate, press !gV!y or type:!g/guns_menu", xPrefixChat)
}
}
return PLUGIN_HANDLED
}
stock client_print_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, "ch")
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
write_byte(players[i])
write_string(msg)
message_end()
}
}
}
SendCmd(const iClient, const szCommand[]) {
message_begin(MSG_ONE, SVC_DIRECTOR, _, iClient);
write_byte(strlen(szCommand) + 2);
write_byte(10);
write_string(szCommand);
message_end();
}