AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Menu does only make first thing (https://forums.alliedmods.net/showthread.php?t=155582)

Kia 04-24-2011 05:56

Menu does only make first thing
 
Hello everybody,
I have a problem with my Glow Menu, I tried to change izzles Glow Menu so you can choose a color, but only first Color works, the others doesnt.

PHP Code:

#include <amxmodx> 
#include <cstrike> 
#include <fun> 
#include <hamsandwich> 
public plugin_init() 

    
register_plugin("JailBreak Glow Menu""1.1""Kia"
    
register_clcmd"say /glow","JBGlowMenu"); 
    
register_clcmd"say_team /glow","JBGlowMenu"); 
    
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1

public 
fw_PlayerSpawn_Post(id

    
set_user_rendering(id)    

public 
JBGlowMenu(id

    if (
cs_get_user_team(id) != CS_TEAM_CT || !is_user_alive(id)) 
    {  
        return 
PLUGIN_HANDLED
    } 
    new 
menu menu_create("\rGlow Menu:""sub_menu"); 
    
    new 
players[32], pnumtempid
    new 
szName[32], szTempid[10]; 
    
    
get_players(playerspnum"a"); 
    
    for( new 
ii<pnumi++ ) 
    { 
        
tempid players[i]; 
        
        
        
        
get_user_name(tempidszName31); 
        
num_to_str(tempidszTempid9); 
        
menu_additem(menuszNameszTempid0); 
    } 
    
    
menu_display(idmenu); 
    return 
PLUGIN_HANDLED

public 
sub_menu(idmenuitem

    
    new 
data[6], iName[64]; 
    new 
accesscallback
    
menu_item_getinfo(menuitemaccessdata,5iName63callback); 
    
    new 
menu menu_create("Glow Farbe:""farbe_handler")
    
    
menu_additem(menu"Rot""1"0);
    
menu_additem(menu"Gruen""2"0);
    
menu_additem(menu"Blau""3"0);
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu);
    
 
    return 
PLUGIN_HANDLED
}  

public 
farbe_handler(idmenuitem)
{
    new 
data[6], iName[64]; 
    new 
accesscallback
    
menu_item_getinfo(menuitemaccessdata,5iName63callback); 
    
    new 
tempid str_to_num(data); 
    new 
szName[32], szName2[32]; 
    
get_user_name(idszName31); 
    
get_user_name(tempidszName231); 
    
    new 
key str_to_num(data)
    switch(
key)
    {
        case 
1:
        {
            
set_user_rendering(tempidkRenderFxGlowShell25500kRenderNormal20)
            
client_print(0,print_chat,"[JailMod] %s glowte %s^n in Rot"szNameszName2);
        }
        case 
2:
        {
            
set_user_rendering(tempidkRenderFxGlowShell02550kRenderNormal20)
            
client_print(0,print_chat,"[JailMod] %s glowte %s^n in Blau "szNameszName2);
        }
        case 
3:
        {
            
set_user_rendering(tempidkRenderFxGlowShell00255kRenderNormal20)
            
client_print(0,print_chat,"[JailMod] %s glowte %s^n in Gruen"szNameszName2);
        }
    }



Kia 04-24-2011 11:46

Re: Menu does only make first thing
 
Does work, but where is the menu where you choose the player who gets glowed?
I thought this was the problem.

Kia 04-24-2011 13:11

Re: Menu does only make first thing
 
Are you kidding me?
I want the Players Menu IN the Glow Menu so the Menu has this Order :

1) Choose Player
2) Choose Color
3) Glow Player

vato loco [GE-S] 04-24-2011 13:14

Re: Menu does only make first thing
 
i'm kidding you ?
i have try to help you
oh sorry for wasting your time
maybe you should learn to exlpain
a bit better what you want
it seems you are kidding me
i have better things to do...:down: :stupid:

your're welcome and good luck

Kia 04-25-2011 04:40

Re: Menu does only make first thing
 
Well sorry, I tried to explain at good as I can.
This Menu does work almost perfect, but when I glow someone, he is only one that I can glow. I mean when I glow Player1 and want to glow Player2 after Player1, Player1 gets glow.

PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#include <cstrike>

#define PLUGIN "Glow Menu"
#define VERSION "1.0"
#define AUTHOR "vl"

#define OFFSET_TEAM 114

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn"1)
    
    
register_clcmd"say /glow","vorGlow")
    
register_clcmd"say_team /glow","vorGlow")
}

public 
fw_PlayerSpawn(id)
{
    if(
is_user_alive(id))
    {
        
set_user_rendering(id)
    }
}

public 
vorGlow(id)
{
    
    if (
cs_get_user_team(id) != CS_TEAM_CT || !is_user_alive(id)) 
    {  
        return 
PLUGIN_HANDLED
    } 
    
    new 
menu menu_create("Glow Menu:""GlowMenu"); 
    
    new 
players[32], pnumtempid
    new 
szName[32], szTempid[10]; 
    
    
get_players(playerspnum"a"); 
    
    for( new 
ii<pnumi++ ) 
    { 
        
tempid players[i]; 
        
        
get_user_name(tempidszName31); 
        
num_to_str(tempidszTempid9); 
        
menu_additem(menuszNameszTempid0); 
    } 
    
    
menu_display(idmenu); 
    return 
PLUGIN_HANDLED


public 
GlowMenu(id)
{
    
    
    if(!
is_user_alive(id) || get_pdata_int(idOFFSET_TEAM) != 2
    {  
        return 
PLUGIN_HANDLED
    
}
    new 
menu menu_create("Glow Menu:""GlowHandler")
    
    
menu_additem(menu"Rot""1"0)
    
menu_additem(menu"Blau""2"0)
    
menu_additem(menu"Gruen""3"0)
    
menu_additem(menu"UnGlow""4"0)
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
    return 
PLUGIN_HANDLED
}

public 
GlowHandler(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    new 
data[6]
    new 
accesscallback
    
new szName[32], szTempid[10];
    new 
players[32], pnumtempid;
    
menu_item_getinfo(menuitemaccessdatacharsmax(data), szNamecharsmax(szName), callback)
    
    
    
    
get_players(playerspnum"a"); 
    for( new 
ii<pnumi++ ) 
    { 
        
tempid players[i]; 
        
get_user_name(tempidszName31); 
        
num_to_str(tempidszTempid9); 
    }
    new 
key str_to_num(data)
    switch(
key)
    {
        case 
1:
        {
            
set_user_rendering(tempidkRenderFxGlowShell25500kRenderNormal20)
            
client_print(0print_chat"[JailMod] %s leuchtet jetzt Rot."tempid)
        }
        case 
2:
        {
            
set_user_rendering(tempidkRenderFxGlowShell00255kRenderNormal20)
            
client_print(0print_chat"[JailMod] %s leuchtet jetzt Blau."tempid)
        }
        case 
3:
        {
            
set_user_rendering(tempidkRenderFxGlowShell02550kRenderNormal20)
            
client_print(0print_chat"[JailMod] %s leuchtet jetzt Gruen."tempid)
        }
        case 
4:
        {
            
set_user_rendering(tempidkRenderFxGlowShell000kRenderNormal20)
            
client_print(0print_chat"[JailMod] %s leuchtet nun nicht mehr."tempid)
        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED



Hunter-Digital 04-25-2011 04:47

Re: Menu does only make first thing
 
So you don't want the menu with players list to disappear after you pick someone ?

Kia 04-25-2011 04:53

Re: Menu does only make first thing
 
No, I wan't to glow Players which have been chosen in the menu before.
In the Code above, you can choose all players, but the first Person who gets glowed, is the only who gets a glow, even when I choose another player, like this :

1) Choosed Player X
2) Glowed Player X

3) Open Menu again, and choose Player Y
4) Want to glow Player Y but Player X get glowed.

Hunter-Digital 04-25-2011 05:00

Re: Menu does only make first thing
 
You need to store selected players into an global array and then loop through it when you set the glow, also clear it when you trigger the glow so it won't glitch on the second use.

But your 1/2/3/3 thing explains a different thing... (I wasn't talking about your miscount)

I can't help you with the code because I never used "new menu" functions.

Kia 04-25-2011 05:05

Re: Menu does only make first thing
 
I mean 1,2,3,4 sorry. ^^

Ok, thanks for help.

fysiks 04-25-2011 18:47

Re: Menu does only make first thing
 
This:

PHP Code:

    get_players(playerspnum"a");
    for( new 
ii<pnumi++ )
    {
        
tempid players[i];
        
get_user_name(tempidszName31);
        
num_to_str(tempidszTempid9);
    } 

should not be in GlowHandler(). It will just get the last player in the entity list and set their rendering.

First, you should make an actual handler for your first menu that will cache the selected player's entity number into a global array and then call the second menu to be shown.

PHP Code:

new g_iTarget[33]

// ....

    
g_iTarget[id] = str_to_num(data// data is from menu_item_getinfo()
// ....

    
set_user_rendering(g_iTarget[id], ...) 



All times are GMT -4. The time now is 20:11.

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