Raised This Month: $ Target: $400
 0% 

Using menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
macas5
Member
Join Date: Aug 2008
Location: Lithuania
Old 05-22-2010 , 11:48   Using menu
Reply With Quote #1

Hello. I am trying to make a weapon giving script, but I am stuck at menu using. I have created a menu:
Code:
mChooseyourprimaryweapon = menu_create("Choose your primary weapon", "mh_Chooseyourprimaryweapon")
mcbChooseyourprimaryweapon = menu_makecallback("mcb_Chooseyourprimaryweapon")
menu_additem(mChooseyourprimaryweapon, "M4A1", "ma_Chooseyourprimaryweapon", ADMIN_ALL, mcbChooseyourprimaryweapon)
menu_additem(mChooseyourprimaryweapon, "AK47", "ma_Chooseyourprimaryweapon", ADMIN_ALL, mcbChooseyourprimaryweapon)
What do i need to write into mh_Chooseyourprimaryweapon to give AK47 or M4A1?

Thanks in advance
macas5 is offline
Send a message via Skype™ to macas5
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 05-22-2010 , 12:08   Re: Using menu
Reply With Quote #2

http://forums.alliedmods.net/showthread.php?t=46364
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
macas5
Member
Join Date: Aug 2008
Location: Lithuania
Old 05-22-2010 , 13:11   Re: Using menu
Reply With Quote #3

#8 SickneSS thank you , but I found another way by one of tutorial, but when i use:
Code:
public event_spawn (id)
{
	new menu[192]
	new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|
	format(menu, 191, "Choose your primary weapon^n^n1. AK47^n2. M4A1^n3. AWP")
	show_menu (id, keys, menu)
	PLUGIN_HANDLED	
}

public giveWeapon (id, key)
{
	if (key == 0)
	{
		give_item (id, "weapon_ak47")
	} 
	if (key == 1) {
		give_item (id, "weapon_m4a1")
		
	}
	if (key == 2) {
		give_item (id, "weapon_awp")	
	}
}
I can't get awp (i can get ak47 and m4a1). When i press 3 it doesn't happen, even menu don't dissapear, but when i change giving awp with m4a1 awp spawns and m4a1 doesn't. Can anyone help?

Last edited by macas5; 05-22-2010 at 13:13.
macas5 is offline
Send a message via Skype™ to macas5
SaM.ThE.MaN
Senior Member
Join Date: Jan 2010
Old 05-22-2010 , 16:06   Re: Using menu
Reply With Quote #4

oh u got that from a tutorial , actually the menu guy gave it to me , ok as you can see there are 4 lines in the menu , and they are :
1.Choose your primary weapon
2.ak47
3.M4a1
4.AWP

But on this line :
new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|

there are 3 keys , so add one in the end and it should be like this :

PHP Code:
public event_spawn (id)
{
    new 
menu[192]
    new 
keys MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|
    
format(menu191"Choose your primary weapon^n^n1. AK47^n2. M4A1^n3. AWP")
    
show_menu (idkeysmenu)
    
PLUGIN_HANDLED    
}

public 
giveWeapon (idkey)
{
    if (
key == 0)
    {
        
give_item (id"weapon_ak47")
    } 
    if (
key == 1) {
        
give_item (id"weapon_m4a1")
        
    }
    if (
key == 2) {
        
give_item (id"weapon_awp")    
    }

SaM.ThE.MaN is offline
macas5
Member
Join Date: Aug 2008
Location: Lithuania
Old 05-23-2010 , 02:56   Re: Using menu
Reply With Quote #5

SaM.ThE.MaN thanks for trying, but still doesn't work more ideas?
macas5 is offline
Send a message via Skype™ to macas5
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 05-23-2010 , 03:38   Re: Using menu
Reply With Quote #6

Use new menu style,it's more simple
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
macas5
Member
Join Date: Aug 2008
Location: Lithuania
Old 05-23-2010 , 04:57   Re: Using menu
Reply With Quote #7

Quote:
Originally Posted by #8 SickneSS View Post
Use new menu style,it's more simple
I have tried with new menu style, but i didn't understand how make to give specified weapon (if i choose m4a1, i will get it) could you help?

EDIT: I found it! thank you for helping me Requesting for a lock

Last edited by macas5; 05-23-2010 at 05:50.
macas5 is offline
Send a message via Skype™ to macas5
SaM.ThE.MaN
Senior Member
Join Date: Jan 2010
Old 05-23-2010 , 04:00   Re: Using menu
Reply With Quote #8

Doesnt work???? , i second let me try it.
SaM.ThE.MaN 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 03:45.


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