Raised This Month: $51 Target: $400
 12% 

Show this menu at the start of the round


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
artYY
Member
Join Date: May 2020
Location: Brazil, Curitiba, PR
Old 07-20-2020 , 00:28   Show this menu at the start of the round
Reply With Quote #1

Hi guys,

I need this menu to always appear at the beginning of each round for live players.

Can someone help me?

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta_util>
#include <hamsandwich>

#define PLUGIN "4Fun: Menu de Armas"
#define VERSION "1.2"

#define xPrefix "\y>\rT'KING\d<"
#define xPrefixChat "!t>!gT'KING!t<"


new xRememberSelection[33], acao[33], xNaoMostrar[33]

public 
plugin_init()
{
   
register_plugin(PLUGINVERSION"Wilian M.")
   
   
register_clcmd("say /guns""xMenuGuns")
   
   
RegisterHam(Ham_Spawn"player""xHam_Spawn"true)
}

public 
client_putinserver(id)
{
   
xRememberSelection[id] = false
   xNaoMostrar
[id] = false
}


// Menu Guns
public xMenuGuns(id)
{
   if(
xRememberSelection[id])
   {
      
xRememberSelection[id] = false
      client_print_color
(id"%s !yVoce reativou o menu de armas."xPrefixChat)
   }
   
   new 
xTeam
   xTeam  
get_user_team(id)
   
   new 
xMenu[500]
   
   
formatex(xMenu499"%s \wMenu de Armas"xPrefix)

   new 
menu menu_create(xMenu"_xMenuGuns")
   
   if(
xTeam == 1// Armas TR
   
{
      
menu_additem(menu"Kit \r[\yAK47 \r+ \yDesert\r] ""1")
      
menu_additem(menu"Kit \r[\yAK47 \r+ \yUsp\r]""2")
      
menu_additem(menu"Kit \r[\yAWP \r+ \yDesert\r]""3")
      
menu_additem(menu"Kit \r[\yGalil \r+ \yDesert\r]^n""4")
      
menu_additem(menu"Kit \d[\rVIP\d]^n""5")
   }
   else 
// Armas CTS
   
{
      
menu_additem(menu"Kit \r[\yM4A1 \r+ \yDesert\d]""1")
      
menu_additem(menu"Kit \r[\yM4A1 \r+ \yUsp\d]""2")
      
menu_additem(menu"Kit \r[\yAWP \r+ \yDesert\d]""3")
      
menu_additem(menu"Kit \r[\yFamas \r+ \yDesert\d]^n""4")
      
menu_additem(menu"Kit \d[\rVIP\d]^n""5")
   }
   
   if(
xRememberSelection[id])
   {
      
menu_additem(menu"Relembrar Selecao? \r[Ativado]^n""6")
   }
   else
   {
      
menu_additem(menu"Relembrar Selecao? \r[Desativado]^n""7")
   }
   
   
menu_additem(menu"Nao Exibir este menu novamente.""6")
   
   
   
menu_setprop(menuMPROP_EXITNAME"Sair")
   
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;ak47;usp;secammo;primammo;hegren;flash;flash")
         }
         else
         {
            
client_cmd(id"defuser;vesthelm;m4a1;usp;secammo;primammo;hegren;flash;flash")
         }
         
         
acao[id] = item
      
}
      
      case 
2:
      {
         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 
3:
      {
         if(
xTeam == 1)
         {
            
client_cmd(id,"vesthelm;galil;deagle;secammo;primammo;hegren;flash;flash")
         }
         else
         {
            
client_cmd(id"defuser;vesthelm;famas;deagle;secammo;primammo;hegren;flash;flash")
         }
         
         
acao[id] = item
      
}
      case 
4:
      {
         if(
xTeam == ADMIN_KICK)
         {
            
client_cmd(id,"defuser;vesthelm;m4a1;deagle;secammo;primammo;hegren;flash;flash")
         }
         else
         {
            
client_cmd(id"vesthelm;ak47;deagle;secammo;primammo;hegren;flash;flash")
         }
         
         
acao[id] = item
      
}
      
      case 
5:
      {
         if(
xRememberSelection[id])
         {
            
xRememberSelection[id] = false;
            
         }
         else
         {
            
xRememberSelection[id] = true;
            
client_print_color(id"%s !yVoce Ativou !tRelembrar-Selecao de armas! !yDigite !g/guns !ypara re-ativar."xPrefixChat)
            
         }
      }
      
      case 
6:
      {
         
xNaoMostrar[id] = true;
         
client_print_color(id"%s !tPRONTO!! !yAgora para ativar somente relogando..."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()
      }
   }
}

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

__________________
artYY is offline
ZaX
Senior Member
Join Date: Jan 2015
Old 07-20-2020 , 01:18   Re: Show this menu at the start of the round
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta_util>
#include <hamsandwich>

#define PLUGIN "4Fun: Menu de Armas"
#define VERSION "1.2"

#define xPrefix "\y>\rT'KING\d<"
#define xPrefixChat "!t>!gT'KING!t<"


new xRememberSelection[33], acao[33], xNaoMostrar[33]
new 
g_iMaxPlayers;

public 
plugin_init()
{
   
register_plugin(PLUGINVERSION"Wilian M.")
   
   
register_clcmd("say /guns""xMenuGuns")
   

   
// Disable if you dont use it, to avoid errors.
   //RegisterHam(Ham_Spawn, "player", "xHam_Spawn", true)

   
register_event("HLTV""newRound""a""1=0""2=0");

   
g_iMaxPlayers get_maxplayers();
}

public 
client_putinserver(id)
{
   
xRememberSelection[id] = false
   xNaoMostrar
[id] = false
}


public 
newRound()
{
    
set_task(1.0"openMenu");
}

public 
openMenu()
{
    for(new 
1<= g_iMaxPlayersi++)
    {
        if(
is_user_connected(i))
            
xMenuGuns(i);
    }
}

// Menu Guns
public xMenuGuns(id)
{
   if(
xRememberSelection[id])
   {
      
xRememberSelection[id] = false
      client_print_color
(id"%s !yVoce reativou o menu de armas."xPrefixChat)
   }
   
   new 
xTeam
   xTeam  
get_user_team(id)
   
   new 
xMenu[500]
   
   
formatex(xMenu499"%s \wMenu de Armas"xPrefix)

   new 
menu menu_create(xMenu"_xMenuGuns")
   
   if(
xTeam == 1// Armas TR
   
{
      
menu_additem(menu"Kit \r[\yAK47 \r+ \yDesert\r] ""1")
      
menu_additem(menu"Kit \r[\yAK47 \r+ \yUsp\r]""2")
      
menu_additem(menu"Kit \r[\yAWP \r+ \yDesert\r]""3")
      
menu_additem(menu"Kit \r[\yGalil \r+ \yDesert\r]^n""4")
      
menu_additem(menu"Kit \d[\rVIP\d]^n""5")
   }
   else 
// Armas CTS
   
{
      
menu_additem(menu"Kit \r[\yM4A1 \r+ \yDesert\d]""1")
      
menu_additem(menu"Kit \r[\yM4A1 \r+ \yUsp\d]""2")
      
menu_additem(menu"Kit \r[\yAWP \r+ \yDesert\d]""3")
      
menu_additem(menu"Kit \r[\yFamas \r+ \yDesert\d]^n""4")
      
menu_additem(menu"Kit \d[\rVIP\d]^n""5")
   }
   
   if(
xRememberSelection[id])
   {
      
menu_additem(menu"Relembrar Selecao? \r[Ativado]^n""6")
   }
   else
   {
      
menu_additem(menu"Relembrar Selecao? \r[Desativado]^n""7")
   }
   
   
menu_additem(menu"Nao Exibir este menu novamente.""6")
   
   
   
menu_setprop(menuMPROP_EXITNAME"Sair")
   
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;ak47;usp;secammo;primammo;hegren;flash;flash")
         }
         else
         {
            
client_cmd(id"defuser;vesthelm;m4a1;usp;secammo;primammo;hegren;flash;flash")
         }
         
         
acao[id] = item
      
}
      
      case 
2:
      {
         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 
3:
      {
         if(
xTeam == 1)
         {
            
client_cmd(id,"vesthelm;galil;deagle;secammo;primammo;hegren;flash;flash")
         }
         else
         {
            
client_cmd(id"defuser;vesthelm;famas;deagle;secammo;primammo;hegren;flash;flash")
         }
         
         
acao[id] = item
      
}
      case 
4:
      {
         if(
xTeam == ADMIN_KICK)
         {
            
client_cmd(id,"defuser;vesthelm;m4a1;deagle;secammo;primammo;hegren;flash;flash")
         }
         else
         {
            
client_cmd(id"vesthelm;ak47;deagle;secammo;primammo;hegren;flash;flash")
         }
         
         
acao[id] = item
      
}
      
      case 
5:
      {
         if(
xRememberSelection[id])
         {
            
xRememberSelection[id] = false;
            
         }
         else
         {
            
xRememberSelection[id] = true;
            
client_print_color(id"%s !yVoce Ativou !tRelembrar-Selecao de armas! !yDigite !g/guns !ypara re-ativar."xPrefixChat)
            
         }
      }
      
      case 
6:
      {
         
xNaoMostrar[id] = true;
         
client_print_color(id"%s !tPRONTO!! !yAgora para ativar somente relogando..."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()
      }
   }
}

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


Last edited by ZaX; 07-20-2020 at 03:04.
ZaX is offline
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 07-20-2020 , 01:28   Re: Show this menu at the start of the round
Reply With Quote #3

Code:
public xHam_Spawn(id) {     xMenuGuns(id); }
__________________
GitHub
SteamWishlist

六四天安門事件

Last edited by +ARUKARI-; 07-20-2020 at 01:28.
+ARUKARI- is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:43.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode