AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How come this menu won't pop up? (https://forums.alliedmods.net/showthread.php?t=188375)

iloverain 06-25-2012 15:52

How come this menu won't pop up?
 
Well... I have a menu that will get the players alive, team, and skip bots. the team = terrorists. It will give health to terrorists to who ever you select.

Code:

public HMenu(id) {   
    new menu = menu_create ( "\rWee", "menu_handler_2" );

    new players[32], pnum, tempid;

    new szName[32], szTempid[10];

    get_players( players, pnum, "ceh", "TERRORIST" );

    for( new i; i<pnum; i++ )
    {
        tempid = players[i];
   
        get_user_name( tempid, szName, charsmax( szName ) );
        num_to_str( tempid, szTempid, charsmax( szTempid ) );

        menu_additem( menu, szName, szTempid, 0 );

    }

    menu_display( id, menu, 0 );
}
 
public menu_handler_2(id, menu, item) {
    if( item == MENU_EXIT )
    {
        menu_destroy( menu );
        return PLUGIN_HANDLED;
    }

    new data[6], szName[64];
    new access, callback;
    menu_item_getinfo( menu, item, access, data,charsmax( data ), szName,charsmax( szName ), callback );

    new tempid = str_to_num( data );
 
    if ( is_user_alive ( tempid ) ) {
    set_user_health( tempid, 1000 )
 }

    menu_destroy( menu );
    return PLUGIN_HANDLED;
}


Liverwiz 06-25-2012 17:34

Re: How come this menu won't pop up?
 
how do you call HMenu() function?

fysiks 06-25-2012 19:06

Re: How come this menu won't pop up?
 
Show the whole code. If it's a long plugin (greater than 100 lines) then post it as an attachment.

iloverain 06-25-2012 19:19

Re: How come this menu won't pop up?
 
Heres the code;

Code:

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd ( "say /hpp", "GetH" )
    register_clcmd ( "say_team /hpp", "GetH" )
}

public GetH(id) {
    if ( cs_get_user_team( id ) == CS_TEAM_CT ) {
    HMenu( id )
    } else {
    ColorChat( id, GREEN, "You are not a^x03 CT^x01!" )   
    }
}

then the above!

thats it o.0

fysiks 06-25-2012 19:23

Re: How come this menu won't pop up?
 
Why can't people just post the whole freakin' code????? That's not the whole code.

On topic: Debug it. Find out what functions/conditions are actually being executed.

Liverwiz 06-25-2012 19:50

Re: How come this menu won't pop up?
 
Quote:

Originally Posted by fysiks (Post 1736133)
On topic: Debug it. Find out what functions/conditions are actually being executed.

What he said.

And just put the checks in GetH right into HMenu. and return PLUGIN_HANDLED under your ColorChat statement.

iloverain 06-25-2012 20:28

Re: How come this menu won't pop up?
 
First off it is the whole code. Want me to put it together for you?
Here.
Spoiler

that's it bro.

debuging ; editing later on.

hornet 06-25-2012 21:56

Re: How come this menu won't pop up?
 
That will work fine. Are you testing in a server with other players ... non bot players since that's what you've specified in your player return?

iloverain 06-25-2012 22:39

Re: How come this menu won't pop up?
 
I've been testing mostly by myself. I thought the menu should still pop-up even if there's no terrorists? I will try as soon as my friend comes online. Thanks. I'll edit this post if it works fine then.

hornet 06-25-2012 23:12

Re: How come this menu won't pop up?
 
A menu will only show if it has an item to show. And since there is no players on Terrorist nothing will come up. Try commenting out the CT team check just for the purpose of testing - Then go Terrorist, type /hpp, and you'll find that your name will come up in the menu and then you can use it on yourself.


All times are GMT -4. The time now is 06:10.

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