Raised This Month: $51 Target: $400
 12% 

random option to menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
daniel46
Senior Member
Join Date: Dec 2011
Old 10-07-2012 , 11:10   random option to menu
Reply With Quote #1

i want to build a menu with cost and i want each time the menu will show it will by random item from the cost and cant be 2 same items how i do it?
daniel46 is offline
Torge
Veteran Member
Join Date: Oct 2011
Old 10-07-2012 , 11:17   Re: random option to menu
Reply With Quote #2

Use
PHP Code:
random_num 
.
Torge is offline
daniel46
Senior Member
Join Date: Dec 2011
Old 10-07-2012 , 11:33   Re: random option to menu
Reply With Quote #3

realy? did you understand even?
daniel46 is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 10-07-2012 , 12:58   Re: random option to menu
Reply With Quote #4

Quote:
Originally Posted by daniel46 View Post
realy? did you understand even?
PHP Code:
new Strings[ ][ ] = {
  
"One",
  
"Two"
};

/*
  Strings[ random_num( 0, sizeof Strings - 1 ) ];

  ** Access "One" or "Two" randomly!
*/ 
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-07-2012 , 14:08   Re: random option to menu
Reply With Quote #5

Quote:
Originally Posted by daniel46 View Post
realy? did you understand even?
Your statement doesn't make any sense so how can anyone understand it?
__________________
fysiks is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 10-07-2012 , 14:43   Re: random option to menu
Reply With Quote #6

Either way....this is HELP. We don't do shit FOR you. Quit being lazy and do something for yourself or get another hobby.

Request was made for this kind of cancer.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
daniel46
Senior Member
Join Date: Dec 2011
Old 10-07-2012 , 15:36   Re: random option to menu
Reply With Quote #7

im new bie ok and i learning just beacause i dont know some things dont mean i dont know any at all and what i want to do is

Code:
new const EventPublic[][] = 
{
	"option1",
	"option2",
	"option3",
	"option4",
	"option5"
};

i dont do public just show

new vMenu = menu_create("IDK","menu_handler1")
	for(new i = 0;i <sizeof(EventPublic);i++)
	{
		new szIa[6]
		num_to_str(i + 1,szIa,charsmax(szIa))
		menu_additem(vMenu,EventPublic[i],szIa)
	}
	menu_display(id,vMenu)
and i want only 4 option that will by chosen randomly and same option cant by twice

Last edited by daniel46; 10-07-2012 at 15:45.
daniel46 is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 10-07-2012 , 17:59   Re: random option to menu
Reply With Quote #8

Now you gill get 4 random options.

PHP Code:
new const EventPublic[][] = 
{
    
"option1",
    
"option2",
    
"option3",
    
"option4",
    
"option5"
};

public 
random_optionsid )
{
    new 
vMenu menu_create("IDK","menu_handler1")
    
    new 
num random_num0sizeofEventPublic ) );
    
    for(new 
0;<sizeof(EventPublic);i++)
    {
        if( 
== num )
            continue;
            
        new 
szIa[6]
        
num_to_str(1,szIa,charsmax(szIa))
        
menu_additem(vMenu,EventPublic[i],szIa)
    }
    
    
menu_display(id,vMenu)

__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
ColdWar
Member
Join Date: Aug 2012
Old 10-08-2012 , 08:32   Re: random option to menu
Reply With Quote #9

He ment as if he have a string like:
PHP Code:
new g_String[][] = {
"Event 1",
"Event 2",
"Event 3",
"Event 4"

The code will take 3 or 2 random strings from that string..

Last edited by ColdWar; 10-08-2012 at 08:33.
ColdWar is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 10-08-2012 , 12:30   Re: random option to menu
Reply With Quote #10

He said that he wants to select 4 random options from 5 options.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Reply



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 04:26.


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