abrir menu en cada ronda automatico
#1
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(PLUGINVERSION"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(szMessagecharsmax(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(idmenuacao[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(xMenu499"%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(menuMPROP_EXITNAME"Exit")
    
menu_display(idmenu0)
    
    return 
PLUGIN_HANDLED
}

public 
_xMenuGuns(idmenuitem)
{
    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 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4")
    
replace_all(msg190"!y""^1")
    
replace_all(msg190"!t""^3")
    
replace_all(msg190"!t2""^0")
    
    if (
idplayers[0] = id; else get_players(playerscount"ch")

    for (new 
0counti++)
    {
        if (
is_user_connected(players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
            
write_byte(players[i])
            
write_string(msg)
            
message_end()
        }
    }
}

SendCmd(const iClient, const szCommand[]) {
    
message_begin(MSG_ONESVC_DIRECTOR_iClient);
    
write_byte(strlen(szCommand) + 2);
    
write_byte(10);
    
write_string(szCommand);
    
message_end();

Responder
#2
no lo testie..pruebalo

Código PHP:
#include <amxmodx>
#include <cstrike>
#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]

new 
g_MaxPlayers;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSION"IceeedR Edited")
    
    
RegisterHam(Ham_Spawn"player""xHam_Spawn"true)
    
    
register_logevent("round_start"2"0=World triggered""1=Round_Start")
    
    
register_clcmd("say /guns_menu""xGetGuns")
    
register_clcmd("say .guns_menu""xGetGuns")
    
    
g_MaxPlayers get_maxplayers()
}

public 
round_start()
{
    for(new 
1<= g_MaxPlayersi++)
    {
        if(!
is_user_connected(i))
            continue;
        
        
xGetGuns(i)
    }
}

public 
xHam_Spawn(id)
    
SendCmd(id,"bind ^"v^" ^"say /guns_menu^"")


public 
xGetGuns(id)
{
    static 
menu
    
    
if(xRememberSelection[id])
    {
        
_xMenuGuns(idmenuacao[id])
    }
    else
    {
        
xMenuGuns(id)
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_HANDLED;
}

// Menu Guns
public xMenuGuns(id)
{    
    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(xMenu499"%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(menuMPROP_EXITNAME"Exit")
    
menu_display(idmenu0)
    
    return 
PLUGIN_HANDLED
}

public 
_xMenuGuns(idmenuitem)
{
    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 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4")
    
replace_all(msg190"!y""^1")
    
replace_all(msg190"!t""^3")
    
replace_all(msg190"!t2""^0")
    
    if (
idplayers[0] = id; else get_players(playerscount"ch")
    
    for (new 
0counti++)
    {
        if (
is_user_connected(players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
            
write_byte(players[i])
            
write_string(msg)
            
message_end()
        }
    }
}

SendCmd(const iClient, const szCommand[]) {
    
message_begin(MSG_ONESVC_DIRECTOR_iClient);
    
write_byte(strlen(szCommand) + 2);
    
write_byte(10);
    
write_string(szCommand);
    
message_end();

Responder
#3
no se abre el menú en la siguiente ronda cuando un jugador muere, pero si quedo vivo de la ronda anterior si
Responder
#4
listo

Código PHP:
#include <amxmodx>
#include <cstrike>
#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]

new 
g_MaxPlayers;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSION"IceeedR Edited")
    
    
RegisterHam(Ham_Spawn"player""xHam_Spawn"true)
    
    
register_logevent("round_start"2"1=Round_Start")
    
    
register_clcmd("say /guns_menu""xGetGuns")
    
register_clcmd("say .guns_menu""xGetGuns")
    
    
g_MaxPlayers get_maxplayers()
}

public 
round_start()
{
    for(new 
1<= g_MaxPlayersi++)
    {
        if(!
is_user_connected(i))
            continue;
        
        
xGetGuns(i)
    }
}

public 
xHam_Spawn(id)
    
SendCmd(id,"bind ^"v^" ^"say /guns_menu^"")


public 
xGetGuns(id)
{
    static 
menu
    
    
if(xRememberSelection[id])
    {
        
_xMenuGuns(idmenuacao[id])
    }
    else
    {
        
xMenuGuns(id)
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_HANDLED;
}

// Menu Guns
public xMenuGuns(id)
{    
    if(
is_user_alive(id))
    {
        if(
xRememberSelection[id])
        {
            
xRememberSelection[id] = false
            client_print_color
(id"%s !yYou have reactivated the weapons menu."xPrefixChat)
        }
        
        new 
xMenu[500]
        
formatex(xMenu499"%s \yMenu de Comprar \dKIT (\w GUNS \d)"xPrefix)
        
        new 
menu menu_create(xMenu"_xMenuGuns")
        
        switch(
get_user_team(id))
        {
            case 
1// Guns Team-TT
            
{
                
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")
            }
            case 
2// 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(
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(menuMPROP_EXITNAME"Exit")
        
menu_display(idmenu0)
        
    }
    else {
        
client_print_color(id"%s !yYou can not buy weapons while DEAD!"xPrefixChat)
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_HANDLED;
}

public 
_xMenuGuns(idmenuitem)
{
    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 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4")
    
replace_all(msg190"!y""^1")
    
replace_all(msg190"!t""^3")
    
replace_all(msg190"!t2""^0")
    
    if (
idplayers[0] = id; else get_players(playerscount"ch")
    
    for (new 
0counti++)
    {
        if (
is_user_connected(players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
            
write_byte(players[i])
            
write_string(msg)
            
message_end()
        }
    }
}

SendCmd(const iClient, const szCommand[]) {
    
message_begin(MSG_ONESVC_DIRECTOR_iClient);
    
write_byte(strlen(szCommand) + 2);
    
write_byte(10);
    
write_string(szCommand);
    
message_end();

Responder
#5
al momento de poner que no muestre el menu de nuevo, o recordar seleccion sigue abriendose el menu en cada ronda, se puede arreglar?
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)