Raised This Month: $ Target: $400
 0% 

randomize menus


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 10-01-2014 , 02:46   Re: randomize menus
Reply With Quote #1

how about you create a new variable for each random menu content
like
new funtions[64][32]
functions[1]="give_usp(id)"
functions[2]="give_health(id)"

and in the handler function
new data[6], iName[64];
new access, callback;

menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
new key = str_to_num(data); <--this is so you can store unique ids for each menu item above 1->8
for(int i=1;i<=MAX_FUNCTIONS(whatever);i++)
{
if(i==key)
{
functions[key]
}
}

I'm not sure this will work or even if you understand what I'm talking about
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-01-2014 , 05:07   Re: randomize menus
Reply With Quote #2

You can't directly execute code that is in a string.

The "data" field of the 'new menus' should be used to keep appropriate associations between the options in the menu and the menu handler.

So, you would need one array for the menu options and another for the unique data identifier (this value will be an integer that will be used in the switch of the menu handler). Simply get your random value with what ever method you want. Use that cached random value to register the menu item with the menu option and the data identifier.

Your menu handler will never need to change.
__________________

Last edited by fysiks; 10-01-2014 at 05:08.
fysiks is offline
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 17:39.


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