Raised This Month: $ Target: $400
 0% 

[Solved] A little question about "Menu"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kys1952
New Member
Join Date: Aug 2010
Old 08-21-2010 , 12:04   [Solved] A little question about "Menu"
Reply With Quote #1

Hi all , I'm totally a newbie about scripting...I've got a problem when creating Menus...Here's my incomplete script

PHP Code:
public plugin_init()
{
 
register_plugin("Menu Demo""1.0""BAILOPAN")
 new 
keys MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9
 register_menucmd
(register_menuid("ShowHandGun"), keys"ShowHandGun")
 
register_menucmd(register_menuid("Handguns"), keys"GiveHandGun")
 
register_clcmd("giveme""showWeaponMenu")
}
public 
showWeaponMenu(id)
{
 new 
menu[192]
 new 
keys MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9
 
 format
(menu191"MainPage^n^n1. Handguns^n2. Shotguns^n3. Submachine guns^n4. Assault Rifles^n5. Snipers")
 
show_menu(idkeysmenu)
 return 
PLUGIN_HANDLED
}
public 
ShowHandGun(idkey)
{
 if (
key == 0)
 {
  new 
keys MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9
  
new Hmenu[192]
  
format(Hmenu191"Handguns^n^n1. Glock18 - $200^n2. Usp - $500^n3. p228 - $300^n4. Deagle - $900^n5. FiveSeven - $500^n6. Elite - $400")
  
show_menu(id,keysHmenu)
  return 
PLUGIN_HANDLED
 
}
 return 
PLUGIN_HANDLED
}
 
//Our menu function will get the player id and the key they pressed
public GiveHandGun(idkey)
{
 
//key will start at zero
 
if (key == 0)
 {
  
give_item(id"weapon_glock18")
  } else if (
key == 1) {
  
give_item(id"weapon_usp")
  } else if (
key == 2) {
  
give_item(id"weapon_p228")
 }

I want to create a menu that Let players chooses their guns...When I type "giveme" in console , "showWeaponMenu" comes out , but when I press "1" , it gives me a glock , instead of showing "ShowHandGun"...
can anyone tell me where's my problem? thx a lot

======================

O my god , how come I've forgotten "Switch" ... the problem's solved...

Last edited by Kys1952; 08-21-2010 at 13:29.
Kys1952 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 21:52.


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