AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help] Set TIme to a Menu (https://forums.alliedmods.net/showthread.php?t=173077)

demon81 11-29-2011 17:12

[Help] Set TIme to a Menu
 
How i set time in a menu ? Because i need the menu have only 10 seconds to choose 1 option.



Sory, if im using bad english.

drekes 11-29-2011 17:29

Re: [Help] Set TIme to a Menu
 
- Create the menu with the default time in a global variable.
- use set_task() with a 1.0 interval & reduce the time variable by 1.
- Destroy & recreate the menu again until the time var is 0.

There are several plugins that use countdowns in menu's.
Try looking at the code of those.

demon81 11-29-2011 17:32

Re: [Help] Set TIme to a Menu
 
I just want the menu disapear in 10 seconds if any option is choosed...

drekes 11-29-2011 17:34

Re: [Help] Set TIme to a Menu
 
I'm confused.

A menu automaticly disappears when you choose any option.

demon81 11-29-2011 17:36

Re: [Help] Set TIme to a Menu
 
but if someone is afk, the menu keeps opened... and i dont want that

drekes 11-29-2011 18:06

Re: [Help] Set TIme to a Menu
 
Then set a task when you create the menu
& use
PHP Code:

show_menu(id0"^n"1); 

to make the menu disappear.

Emp` 11-29-2011 18:07

Re: [Help] Set TIme to a Menu
 
You could use old style menus (they have a time argument for how long the menu will show) or you can just set a task to use menu_cancel on a player (the menu will still show, but the menu will not work).

Additionally, instead of menu_cancel you could use:
Code:

show_menu( iPlayer, 0, "^n", 1 );
And it will clear the menu from the player's screen.

demon81 11-29-2011 18:12

Re: [Help] Set TIme to a Menu
 
How i put it in here:
PHP Code:

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

#define PLUGIN "Weapons Menu"
#define VERSION "1.0"
#define AUTHOR "KuLL"

#define OFFSET_PRIMARYWEAPON        116

new g_iMenu

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_Spawn"player""HamPlayerSpawn"1)
    
    
g_iMenu menu_create"\r[WEAPONS] \yChoose tour Gun:""menuarmas")
    
menu_additem(g_iMenu"AK47""1"0)
    
menu_additem(g_iMenu"M4A1""2"0)
    
menu_additem(g_iMenu"AWP""3"0)
    
menu_additem(g_iMenu"M3""4"0)
    
menu_additem(g_iMenu"MP5""5"0)
    
menu_additem(g_iMenu"P90""6"0)
    
menu_setprop(g_iMenuMPROP_EXITMEXIT_ALL)




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

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