Raised This Month: $ Target: $400
 0% 

randomize menus


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
EDUTz
Senior Member
Join Date: Jun 2010
Location: Dracula's Homeland
Old 09-30-2014 , 06:10   randomize menus
Reply With Quote #1

I want to randomize some constants but i'm having trouble with it.

Code:
new const constants[][] =
{
        "constant1",
        "constant2",
        "constant3",
        "constant4",
        "constant5",
        "constan6"
}
so i wanna generate the menu to be displayed randomly, i took a look over here: https://forums.alliedmods.net/showth...=74666?t=74666 but it's a little bit tricky.

Code:
public menu_display(id)
{
	new menu = menu_create("Constantss", "handler_constants");
	/* for (new i = 0; i <sizeof(constants); i++)
	{
		menu_additem(menu, constants[i], "", 0); // case 0
	} */
        //Here it should be randomized to additem randomly according to what's in the constantans list
	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
	menu_display(id, menu, 0);
	return PLUGIN_HANDLED;
}
Code:
public handler_constants(id, menu, item)
{
	if(item == MENU_EXIT)
	{
		menu_cancel(id);
		return PLUGIN_HANDLED;
	}
        //client_print(id, print_chat, "You have selected %s", constants[item])
        //Here the randomized list generated above should be called corectly.
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}
Any ideas how to do that ? I'm thinking pushing them into the arrays, but i don't know how to corectly use them in the handler....
EDUTz is offline
 



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 17:39.


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