AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Countdown function in menu (https://forums.alliedmods.net/showthread.php?t=127723)

xakintosh 05-24-2010 04:14

Countdown function in menu
 
Is possible to add countdown to menu ?

#8 SickneSS 05-24-2010 04:16

Re: Countdown function in menu
 
yes

xakintosh 05-24-2010 04:28

Re: Countdown function in menu
 
Can you show me some easy way :)

Alka 05-24-2010 05:04

Re: Countdown function in menu
 
Using new menus can be a waste of time if you don't use arrays for menu items and also the text must be formated before... but using old menus, just store all menu in a string and where you want counter put a "%d" and show a specific integer(which can be increased / decreased in a task).

#8 SickneSS 05-24-2010 05:55

Re: Countdown function in menu
 
I just want to know,what do u really want,a countdown and open a menu or a countdown in one of the cases of the menu?

One 05-24-2010 07:51

Re: Countdown function in menu
 
Quote:

Originally Posted by #8 SickneSS (Post 1189577)
I just want to know,what do u really want,a countdown and open a menu or a countdown in one of the cases of the menu?

he want to have a countdown showed as menu like the countdown in galileo.


Search for galileo & see the code how you can add a countdown in this.

#8 SickneSS 05-24-2010 10:54

Re: Countdown function in menu
 
Oh!.. I See,I think is easy to do.

xakintosh 05-24-2010 12:27

Re: Countdown function in menu
 
You can see where i want to put it.
PHP Code:

public x(id) {
    new 
x1[8]
    if(
id(id,x1)) {
        new 
menu menu_create("""menu_handler")
        
menu_additem(menu"1""1")
        
menu_additem(menu"2""2")
        
menu_additem(menu"3""3")
        
menu_additem(menu"4""4")
        
menu_additem(menu"5""5")
        
menu_additem(menu"6""6")
        
menu_additem(menu"(%d)sec.""7")
        
menu_setprop(menuMPROP_EXITMEXIT_ALL)
        
menu_display(idmenu0)
        } else {
        
ColorChat(id,GREEN,"This server is made by X?k!n7osh")
    }



Alka 05-24-2010 16:39

Re: Countdown function in menu
 
You must create a temporary string, maybe static, then format it like you wish...
PHP Code:

static szTemp[16];
formatex(szTempcharsmax(szTemp), "(%d)sec."iSeconds); //iSeconds it's your integer that hold seconds num.

menu_additem(menuszTemp"7");
... 


wrecked_ 05-24-2010 16:50

Re: Countdown function in menu
 
Code:
#define count 20 static item[5] for( new i = 1; i <= count; i++ ) {     num_to_str( i, item, 4 )     menu_additem( menuindex, item, item, 0 ) }
Output:
Code:

1. 1
2. 2
3. 3
4. 4
...



Code:
#define count 20 static item[5] static place[5] for( new i = count, j; i > 0; i-- ) {     num_to_str( i, item, 4 )     num_to_str( ++j, place, 4 )     menu_additem( menuindex, item, place, 0 ) }
Output:
Code:

1. 20
2. 19
3. 18
4. 17
...



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

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