Raised This Month: $ Target: $400
 0% 

playermenu help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
plowed
Senior Member
Join Date: Oct 2010
Location: germany
Old 10-01-2011 , 18:46   playermenu help
Reply With Quote #1

hi there.

I start making a menu that listen all players on the server. After a player on the menu is choosen a submenu open (which is not fully included here) where the submenu show some amounts ( 5, 10, 20, 50, 100 )

My problem is: I cant hold the id (in my code the var: tempid) of the player I choose in the menu through to the submenu.

PHP Code:
#include <amxmodx>
#include <fun>
#include <zp50_ammopacks>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "plowed"

#define MAXAMOUNT 5

new g_ammoAmount[MAXAMOUNT][] = {
    
5,
    
10
    
20,
    
50
    
100
}


public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /menu""donateMenu")    
}

public 
donateMenu(id) {
    new 
menu menu_create("Donate menu:","menu_handler")
    
    new 
players[32], pnumtempid
    
new szName[32], szTempid[10]
    new 
ammos[32]
    new 
desc[64]
    
get_players(playerspnum)
    
    for(new 
0pnumi++) {
        
tempid players[i]
        
ammos[tempid] = zp_ammopacks_get(tempid)
        
        
get_user_name(tempidszNamecharsmax(szName))
        
formatex(desccharsmax(desc), "\w%s      \rAmmos: \y%d"szNameammos[tempid])
        
num_to_str(tempidszTempidcharsmax(szTempid))
        
menu_additem(menudescszTempid0)
    }
    
menu_display(idmenu0)
}
    
public  
menu_handler(idmenuitem) {
    if(
item == MENU_EXIT) {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], szName[64]
    new 
accesscallback
    menu_item_getinfo
(menuitemaccessdatacharsmax(data), szNamecharsmax(szName), callback)
    new 
tempid str_to_num(data)
    new 
Title[128], name[32], Auswahl[20]
    
get_user_name(tempidnamecharsmax(name))
    
formatex(Titlecharsmax(Title), "Donate ammos to %s"name)
    
    
    new 
submenu menu_create(Title"submenu_handler")
    
    for(new 
isizeof g_ammoAmount;i++) {
    
formatex(Auswahlcharsmax(Auswahl),"\y%d\w HP"g_ammoAmount[i])
    
menu_additem(submenuAuswahl"i"0)
    }
    
menu_setprop(submenuMPROP_EXITMEXIT_ALL)
    
menu_display(idsubmenu0)
    
    return 
PLUGIN_HANDLED
}

public 
submenu_handler(idsubmenuitem) {
    
    if(
item == MENU_EXIT) {
        
menu_destroy(submenu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], szName[64]
    new 
accesscallback
    
    menu_item_getinfo
(submenuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);
    
    new 
key str_to_num(data)
    
    switch(
key)
    {
     case 
1:
    {
    
//ex set_user_health of the player I choose..BUT I dont know how to get on that playerid I choose :S:DSX
    
}
    case 
2:
    {
        
    }
    case 
3
    {

    }
    case 
4
    {

    }
    case 
5
    {

    }
    }

some help or advices would be nice !
__________________
Zombie Mod + gameMe stats :

Last edited by plowed; 10-01-2011 at 18:50.
plowed is offline
 



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 19:36.


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