randomize menus
I want to randomize some constants but i'm having trouble with it.
Code:
new const constants[][] =Code:
public menu_display(id)Code:
public handler_constants(id, menu, item) |
Re: randomize menus
Try
PHP Code:
|
Re: randomize menus
that's 100% incorrect, even if you put it this way showing the menu, you have to exclude the ones already shown ... so it's definetly incorrect. Even if you show it like that, you don't have a method for the callback .. it should be another way ...
|
Re: randomize menus
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 |
Re: randomize menus
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. |
Re: randomize menus
You can push everything in an array, get a random data, clear it and so on.
|
| All times are GMT -4. The time now is 17:39. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.