AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   One menu blocks other to show up! (https://forums.alliedmods.net/showthread.php?t=101386)

spiN- 08-23-2009 12:21

One menu blocks other to show up!
 
Hello. I have created a menu that pops-up at round start with some good stuff in it, but there is a problem... I want to use it with Zombie Plague mod and when the round starts the mods gun menu blocks my created menu to show up... So, is there a way to do a menu that will pop-up after some time or when the ZP gun menu will be closed?

P.S. If there are a topic with answer, please post a link. Thank you! :wink:

ot_207 08-23-2009 12:50

Re: One menu blocks other to show up!
 
http://www.amxmodx.org/funcwiki.php?go=func&id=280
I think that this does the trick. Using it in conjunction with a loop set_task will do the trick.

spiN- 08-23-2009 13:27

Re: One menu blocks other to show up!
 
Can you (or some1 else) give me an example with that? Because I'm not good at scripting and I can't understand how to put it in my menu... :oops: This is my first time I have this problem. :|

ot_207 08-23-2009 13:57

Re: One menu blocks other to show up!
 
Before you show the menu use the function that I have stated above.

spiN- 08-23-2009 16:39

Re: One menu blocks other to show up!
 
Thanks for your reply.

I puted this in my code:
Code:

public menu_keys() {
    new menu,keys
 
    for(new o=1;o<33;o++) {
        get_user_menu(o, menu, keys)
    }

it compiles fine, but menu still disappears... What I'm doing wrong?

Alucard^ 08-23-2009 21:22

Re: One menu blocks other to show up!
 
I think you should use get_maxplayers() instead of "33" in your loop.

spiN- 08-24-2009 10:56

Re: One menu blocks other to show up!
 
Man, I still can't get it to work... Can someone make that this menu will show up after some time?
Code:

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

new bool:FirstSpawn[33]

 public plugin_init()
 {

    register_plugin("ExtraMenu","1.0","spiN-")
    RegisterHam        (Ham_Spawn, "player", "Player_Spawn", 1) 

 }
 
 public Player_Spawn(id)
{
    if( !is_user_alive(id) )
   
        {
            FirstSpawn[id] = true
            return
        }
    FirstSpawn[id] = false
   
    new menu = menu_create("\rMenu:", "menu_handler");

    menu_additem(menu, "\wExtra Weapons", "1", ADMIN_LEVEL_D);
    menu_additem(menu, "\wExtra Health", "2", ADMIN_LEVEL_D);

    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);

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

    new data[6], iName[64];
    new access, callback;
   
    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);

    new key = str_to_num(data);

    switch(key)
    {
        case 1:
        {
            strip_user_weapons (id) 
            give_item( id, "weapon_m4a1" );
            give_item( id, "ammo_556nato" );
            give_item( id, "ammo_556nato" );
            give_item( id, "ammo_556nato" );
            give_item( id, "weapon_deagle" );
            give_item( id, "ammo_50ae" );
            give_item( id, "ammo_50ae" );         
            give_item( id, "ammo_50ae" );
            give_item( id, "ammo_50ae" );
            give_item( id, "ammo_50ae" );
            give_item( id, "ammo_50ae" );
            give_item( id, "weapon_hegrenade" );
            give_item( id, "weapon_flashbang" );
            give_item( id, "weapon_flashbang" );
            give_item( id, "weapon_smokegrenade" );
            give_item( id, "weapon_knife" );
            client_print(id, print_chat, "You get M4A1, Deagle and Grenades!");
            menu_destroy(menu);
            return PLUGIN_HANDLED;
        }
        case 2:
        {
            set_user_health( id, get_user_health( id ) + 100 );
            client_print(id, print_chat, "You get +100 HP!");
        }
    }

    menu_destroy(menu);
    return PLUGIN_HANDLED;
 }

Please. :)

Alucard^ 08-24-2009 10:59

Re: One menu blocks other to show up!
 
using tasks i think: http://www.amxmodx.org/funcwiki.php?go=func&id=253

spiN- 08-24-2009 11:49

Re: One menu blocks other to show up!
 
Code:

new args[1];
public example(id)
{
args[0] = id;
set_task(15.0,"Player_Spawn",0,args,1,"c",0);
}

Will this work and am I correct with my code above? Will it show the menu after 15 seconds and will it be showen after every player spawn?

spiN- 08-24-2009 16:51

Re: One menu blocks other to show up!
 
SOLVED with that menu show up!

Now I have other problems with menu...

1th - When some one chooses from menu Extra Speed, they don't get it... This is how looks speed code:
PHP Code:

public ev_CurWeapon(id)
{
    if(
g_iSpeedy[id])
    {
        new 
iCheckWeapon read_data(2)
        if(
iCheckWeapon != g_iCheckWeapon[id])
        {
            
g_iCheckWeapon[id] = iCheckWeapon
            
new Float:fMaxSpeed get_user_maxspeed(id)
            if(
fMaxSpeed 450.0)
            {
                
set_user_maxspeed(id450.0)
            }
        }
    }


and:
PHP Code:

case 3
        { 
            
set_user_maxspeed(id 450.0);
            
client_print(idprint_center "Your speed increased!");
            
g_iSpeedy[id] = true 
        


Why this isn't working?!

2nd - How to make, that only CT's can choose weapon from menu?

P.S. Sorry for double-post.


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

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