Raised This Month: $ Target: $400
 0% 

controling variables with menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bcKq
Member
Join Date: Dec 2012
Location: Tczew, Poland
Old 11-21-2013 , 17:18   Re: controling variables with menu
Reply With Quote #1

PHP Code:
// option1
new szText[24];
formatex(szTextcharsmax(szText), "%s"option1 "OPTION1 [ON]" "OPTION1 [OFF]");
menu_additem(menuszText);
// option2
formatex(szTextcharsmax(szText), "%s"option2 "OPTION2 [ON]" "OPTION2 [OFF]");
menu_additem(menuszText); 
__________________
This is my signature.
bcKq is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 11-22-2013 , 05:42   Re: controling variables with menu
Reply With Quote #2

Quote:
Originally Posted by bcKq View Post
PHP Code:
// option1
new szText[24];
formatex(szTextcharsmax(szText), "%s"option1 "OPTION1 [ON]" "OPTION1 [OFF]");
menu_additem(menuszText);
// option2
formatex(szTextcharsmax(szText), "%s"option2 "OPTION2 [ON]" "OPTION2 [OFF]");
menu_additem(menuszText); 
or simply this



Code:
// above plugin_init() new bool:option1[ 33 ], bool:option2[ 33 ]; // in menu function // option1 new szText[24]; formatex(szText, charsmax(szText), "OPTION1  [%s]", option1[ id ] ? "ON" : "OFF"); menu_additem(menu, szText); // option2 formatex(szText, charsmax(szText), "OPTION2  [%s]", option2[ id ] ? "ON" : "OFF"); menu_additem(menu, szText);

if you didnt index the boolean then there would be only one on/off for anyone using that.. then anyone could turn on/off the option.
this way you can set individual settings on each index.
__________________

Last edited by Blizzard_87; 11-22-2013 at 05:47.
Blizzard_87 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 23:12.


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