Raised This Month: $ Target: $400
 0% 

[Help] Set TIme to a Menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
demon81
Member
Join Date: Sep 2010
Location: Portugal
Old 11-29-2011 , 17:12   [Help] Set TIme to a Menu
Reply With Quote #1

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.

Last edited by demon81; 11-29-2011 at 17:13.
demon81 is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 11-29-2011 , 17:29   Re: [Help] Set TIme to a Menu
Reply With Quote #2

- 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.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
demon81
Member
Join Date: Sep 2010
Location: Portugal
Old 11-29-2011 , 17:32   Re: [Help] Set TIme to a Menu
Reply With Quote #3

I just want the menu disapear in 10 seconds if any option is choosed...
demon81 is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 11-29-2011 , 17:34   Re: [Help] Set TIme to a Menu
Reply With Quote #4

I'm confused.

A menu automaticly disappears when you choose any option.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
demon81
Member
Join Date: Sep 2010
Location: Portugal
Old 11-29-2011 , 17:36   Re: [Help] Set TIme to a Menu
Reply With Quote #5

but if someone is afk, the menu keeps opened... and i dont want that
demon81 is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 11-29-2011 , 18:06   Re: [Help] Set TIme to a Menu
Reply With Quote #6

Then set a task when you create the menu
& use
PHP Code:
show_menu(id0"^n"1); 
to make the menu disappear.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 11-29-2011 , 18:07   Re: [Help] Set TIme to a Menu
Reply With Quote #7

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.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
demon81
Member
Join Date: Sep 2010
Location: Portugal
Old 11-29-2011 , 18:12   Re: [Help] Set TIme to a Menu
Reply With Quote #8

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)

demon81 is offline
Reply


Thread Tools
Display Modes

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 08:23.


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