Raised This Month: $ Target: $400
 0% 

Save weapon what was choosen on menu.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 02-19-2009 , 14:51   Save weapon what was choosen on menu.
Reply With Quote #1

PHP Code:
public First(id)
{
    new 
menu menu_create("\yPrimary Weapons:""first_handle")
    
menu_additem(menu"\wAK47""1"0)
    
menu_additem(menu"\wM4A1""2"0)
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)

    
menu_display(idmenu0)
    
}
public 
first_handle(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    new 
data[6], iName[64]
    new 
accesscallback
    menu_item_getinfo
(menuitemaccessdata,5iName63callback)
    new 
key str_to_num(data)
    switch(
key)
    {
        case 
1:{
                
give_item(AK47-EXAMPLE)
        }
        case 
2:{
                
give item(M4a1-EXAMPLE)
        }
    }    
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED

How to save these selected weapons and how to give it, what was saved?
xbatista is offline
Send a message via Skype™ to xbatista
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 02-19-2009 , 20:31   Re: Save weapon what was choosen on menu.
Reply With Quote #2

save what key they have into a global variable
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 02-20-2009 , 06:57   Re: Save weapon what was choosen on menu.
Reply With Quote #3

Sorry I'm a noob :/
Something with keys?
I understand what you said,but I don't know how to do it :/
xbatista is offline
Send a message via Skype™ to xbatista
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 02-20-2009 , 08:44   Re: Save weapon what was choosen on menu.
Reply With Quote #4

PHP Code:
new g_StoredWeapon[33];

// <...>
// somewhere when selected weapon...

g_StoredWeapon[id] = wich_weapon
then use g_StoredWeapon[id]
__________________
xPaw is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 02-20-2009 , 09:26   Re: Save weapon what was choosen on menu.
Reply With Quote #5

PHP Code:
new g_StoredWeapon[33]; 

// <...> 
// somewhere when selected weapon... 

g_StoredWeapon[id] = wich_weapon;  
then use g_StoredWeapon[id
How to do with key1(case1) example?
g_StoredWeapon[id] = xxxkeyxx(xx)
xbatista is offline
Send a message via Skype™ to xbatista
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 02-20-2009 , 10:46   Re: Save weapon what was choosen on menu.
Reply With Quote #6

PHP Code:
// add in swich, and use 1, 2, 3 etc for giving weapons and just add this at end of it, just for space save :], in g_StoredWeapon[id] will be key wich was pressed by player
default: g_StoredWeapon[id] = key
if i understand you right.
__________________
xPaw is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 02-20-2009 , 11:14   Re: Save weapon what was choosen on menu.
Reply With Quote #7

OK look.
PHP Code:
public first(id

    new 
menu menu_create("\yPrimary Weapons:""first_handle"
    
menu_additem(menu"\wNew weapons""1"0
    
menu_additem(menu"\wLast weapons""2"0
     
    
menu_setprop(menuMPROP_EXITMEXIT_ALL

    
menu_display(idmenu0
     

public 
first_handle(idmenuitem

    if (
item == MENU_EXIT
    { 
        
menu_destroy(menu
        return 
PLUGIN_HANDLED 
    

    new 
data[6], iName[64
    new 
accesscallback 
    menu_item_getinfo
(menuitemaccessdata,5iName63callback
    new 
key str_to_num(data
    switch(
key
    { 
        case 
1:{ 
                
second(id)
        } 
        case 
2:{ 
                         !!!!!!!!!!!!!!!!!!                 !!!!!!!!!!!!!!!!!
              !!!!!!!!!!!!!!!!  
That STORED WEAPON ://///// !!!!!!!!!!!!
        

    }     
    
menu_destroy(menu
    return 
PLUGIN_HANDLED 
}
public 
second(id

    new 
menu menu_create("\yPrimary Weapons:""second_handle"
    
menu_additem(menu"\wAK47""1"0
    
menu_additem(menu"\wM4A1""2"0
     
    
menu_setprop(menuMPROP_EXITMEXIT_ALL

    
menu_display(idmenu0
     

public 
second_handle(idmenuitem

    if (
item == MENU_EXIT
    { 
        
menu_destroy(menu
        return 
PLUGIN_HANDLED 
    

    new 
data[6], iName[64
    new 
accesscallback 
    menu_item_getinfo
(menuitemaccessdata,5iName63callback
    new 
key str_to_num(data
    switch(
key
    { 
        case 
1:{ 
                
give_item(AK47-EXAMPLE
        } 
        case 
2:{ 
                
give item(M4a1-EXAMPLE
        } 
    }     
    
menu_destroy(menu
    return 
PLUGIN_HANDLED 


Last edited by xbatista; 02-20-2009 at 11:16.
xbatista is offline
Send a message via Skype™ to xbatista
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 17:00.


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