Raised This Month: $2 Target: $400
 0% 

Small problem with menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Watt
Senior Member
Join Date: Jan 2008
Location: Poland :D
Old 02-25-2008 , 08:49   Small problem with menu
Reply With Quote #1

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. ?
Watt is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 02-25-2008 , 09:06   Re: Small problem with menu
Reply With Quote #2

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...
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Watt
Senior Member
Join Date: Jan 2008
Location: Poland :D
Old 02-25-2008 , 09:16   Re: Small problem with menu
Reply With Quote #3

Quote:
you want when they choose an item for the menu to stay up, unless they choose exit?
Yes
Watt is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 02-25-2008 , 15:16   Re: Small problem with menu
Reply With Quote #4

Quote:
Originally Posted by Rolnaaba View Post
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...
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Watt
Senior Member
Join Date: Jan 2008
Location: Poland :D
Old 02-26-2008 , 09:24   Re: Small problem with menu
Reply With Quote #5

How kz_ menu does it
Watt is offline
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 02-26-2008 , 11:47   Re: Small problem with menu
Reply With Quote #6

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; }
__________________
|<-- Retired from everything Small/Pawn related -->|
You know when you've been Rango'd
Orangutanz is offline
Watt
Senior Member
Join Date: Jan 2008
Location: Poland :D
Old 02-26-2008 , 13:24   Re: Small problem with menu
Reply With Quote #7

OK but
Quote:
public client_putinserver
{
client_cmd(id, "pgc");
}
Doesnt work it should show the menu when player conntes to my server
Watt is offline
Watt
Senior Member
Join Date: Jan 2008
Location: Poland :D
Old 02-26-2008 , 14:22   Re: Small problem with menu
Reply With Quote #8

And where can I find funkcions like that FM_EmitSound
It isnt in funwicki
Watt is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 02-26-2008 , 14:37   Re: Small problem with menu
Reply With Quote #9

Quote:
Originally Posted by Watt View Post
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
__________________
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
Watt
Senior Member
Join Date: Jan 2008
Location: Poland :D
Old 02-27-2008 , 07:54   Re: Small problem with menu
Reply With Quote #10

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


Thread Tools
Display Modes

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 09:23.


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