AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Using menu (https://forums.alliedmods.net/showthread.php?t=127554)

macas5 05-22-2010 11:48

Using menu
 
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 :)

#8 SickneSS 05-22-2010 12:08

Re: Using menu
 
http://forums.alliedmods.net/showthread.php?t=46364

macas5 05-22-2010 13:11

Re: Using menu
 
#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?

SaM.ThE.MaN 05-22-2010 16:06

Re: Using menu
 
oh u got that from a tutorial , actually the menu guy gave it to me :D , 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")    
    }



macas5 05-23-2010 02:56

Re: Using menu
 
SaM.ThE.MaN thanks for trying, but still doesn't work :cry: more ideas? :)

#8 SickneSS 05-23-2010 03:38

Re: Using menu
 
Use new menu style,it's more simple

SaM.ThE.MaN 05-23-2010 04:00

Re: Using menu
 
Doesnt work???? , i second let me try it.

macas5 05-23-2010 04:57

Re: Using menu
 
Quote:

Originally Posted by #8 SickneSS (Post 1188561)
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


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

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