AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Small problem with menu (https://forums.alliedmods.net/showthread.php?t=67507)

Watt 02-25-2008 08:49

Small problem with menu
 
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fun>
#define CT CsTeams:CS_TEAM_CT
#define T CsTeams:CS_TEAM_T

new const key[] = "v"
new const command[] = "pgc"

public plugin_init()
{
  
register_plugin("MENU""0.5""sb");
  
register_clcmd("say /pgc""buymenu");
  
register_clcmd("say_team /pgc""buymenu"); //nie jestem pewien co do tych dwoch
  
register_clcmd("pgc""buymenu") ;
  
register_dictionary ("pgc_surfmenu.txt")
}


public 
buymenu(id)
{

    
    if(
is_user_alive(id))
    {
        new 
formatstr[32];
        if(
cs_get_user_team(id) == CT || cs_get_user_team(id) == T)
        {
            
            new 
menu menu_create("PGC Surf Menu""handle_buymenu");
            
formatex(formatstr31"%L"id"CP")
            
menu_additem(menuformatstr"1");
            
formatex(formatstr31"%L"id"TP")
            
menu_additem(menuformatstr"1");
            
formatex(formatstr31"%L"id"RESPAWN")
            
menu_additem(menuformatstr"1");
            
formatex(formatstr31"%L"id"MAPY")
            
menu_additem(menuformatstr"1");
            
formatex(formatstr31"%L"id"IP")
            
menu_additem(menuformatstr"1");
            
menu_display(idmenu0);
        }
        else
        {
            
client_print(idprint_chat,"%L",id,  "BRAK_DOSTEPU");
        }
    }
    else
    {
        
client_print(idprint_chat,"%L",id"NIE_ZYWY");
    }
    return 
PLUGIN_CONTINUE
}
public 
handle_buymenu(idmenuitem)
{
  if(
item == MENU_EXIT)
  {
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
  }
  if(
cs_get_user_team(id) == CT)
  {
    switch(
item)
    {
      case 
0:
      {
      
client_cmd(id"say /cp");
       
      }
      
       case 
1:
      {
      
    
client_cmd(id"say /tp");
    
     }
      case 
2:
      {
      
    
client_cmd(id"respawn_pgc");
     }
     case 
3:
      {
      
    
client_cmd(id"say /mapy");
     }
     case 
4:
      {
      
    
client_cmd(id"amx_ip *");
    
client_print(idprint_chat,"%L",id"KONSOLA");
     }

     
     
        }
      }
  
  
  if(
cs_get_user_team(id) == T)
      {
    switch(
item)
    {
      case 
0:
      {
      
client_cmd(id"say /cp");
       
      }
      
       case 
1:
      {
      
    
client_cmd(id"say /tp");
    
     }
      case 
2:
      {
      
    
client_cmd(id"respawn_pgc");
     }
     case 
3:
      {
      
    
client_cmd(id"say /mapy");
     }
     case 
4:
      {
      
    
client_cmd(id"amx_ip *");
    
client_print(idprint_chat,"%L",id"KONSOLA");
     }

      
    }
  }
  
menu_destroy(menu);
  return 
PLUGIN_HANDLED;
}

public 
client_connect(id)
{   
    new 
full_command[32];
   
    
formatex(full_commandsizeof full_command 1"bind %s ^"%s^""keycommand);
    
client_cmd(idfull_command);


Hello I have got a problem how to make that menu will show when you entry server. And when you click my menu it destroy how to make that after click it will stay. ?

Rolnaaba 02-25-2008 09:06

Re: Small problem with menu
 
you want when they choose an item for the menu to stay up, unless they choose exit? just on handle, call your "buymenu(id)" function, because when they choose an item it will close the menu, but you can bring it up again after it closes, until they click exit...

Watt 02-25-2008 09:16

Re: Small problem with menu
 
Quote:

you want when they choose an item for the menu to stay up, unless they choose exit?
Yes

Rolnaaba 02-25-2008 15:16

Re: Small problem with menu
 
Quote:

Originally Posted by Rolnaaba (Post 589484)
just on handle, call your "buymenu(id)" function, because when they choose an item it will close the menu, but you can bring it up again after it closes, until they click exit...


Watt 02-26-2008 09:24

Re: Small problem with menu
 
How kz_ menu does it :D

Orangutanz 02-26-2008 11:47

Re: Small problem with menu
 
Code:
public handle_buymenu(id, menu, item) {   if(item == MENU_EXIT)   {     menu_destroy(menu);     return PLUGIN_HANDLED;   }   if(cs_get_user_team(id) == CT)   {     switch(item)     {       case 0:       {       client_cmd(id, "say /cp");               }              case 1:       {           client_cmd(id, "say /tp");          }       case 2:       {           client_cmd(id, "respawn_pgc");      }      case 3:       {           client_cmd(id, "say /mapy");      }      case 4:       {           client_cmd(id, "amx_ip *");     client_print(id, print_chat,"%L",id, "KONSOLA");      }                     }       }       if(cs_get_user_team(id) == T)       {     switch(item)     {       case 0:       {       client_cmd(id, "say /cp");               }              case 1:       {           client_cmd(id, "say /tp");          }       case 2:       {           client_cmd(id, "respawn_pgc");      }      case 3:       {           client_cmd(id, "say /mapy");      }      case 4:       {           client_cmd(id, "amx_ip *");     client_print(id, print_chat,"%L",id, "KONSOLA");      }           }   }   menu_destroy(menu);   buymenu(id) // WHAT YOUR WERE MISSING   return PLUGIN_HANDLED; }

Watt 02-26-2008 13:24

Re: Small problem with menu
 
OK but
Quote:

public client_putinserver
{
client_cmd(id, "pgc");
}
Doesnt work it should show the menu when player conntes to my server

Watt 02-26-2008 14:22

Re: Small problem with menu
 
And where can I find funkcions like that FM_EmitSound
It isnt in funwicki

Greenberet 02-26-2008 14:37

Re: Small problem with menu
 
Quote:

Originally Posted by Watt (Post 590132)
And where can I find funkcions like that FM_EmitSound
It isnt in funwicki

FM_EmitSound isnt a function! it's an enum value
http://www.amxmodx.org/funcwiki.php?...id=16#const_fm

Watt 02-27-2008 07:54

Re: Small problem with menu
 
Quote:

Quote:
public client_putinserver
{
client_cmd(id, "pgc");
}
Doesnt work it should show the menu when player conntes to my server


All times are GMT -4. The time now is 02:22.

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