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

Remember selection


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 02-25-2012 , 08:42   Remember selection
Reply With Quote #1

How can i set on menu that after option is used he will remember and use that command every round.It something like choosing a class?
__________________
H.RED.ZONE is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 02-25-2012 , 09:10   Re: Remember selection
Reply With Quote #2

Another variable? And you don't open the menu again
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 02-25-2012 , 09:15   Re: Remember selection
Reply With Quote #3

Yep until you open the menu and choose option again class will be the same as you choose it first time.
__________________

Last edited by H.RED.ZONE; 02-25-2012 at 09:15.
H.RED.ZONE is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 02-25-2012 , 09:18   Re: Remember selection
Reply With Quote #4

Code:
new Class = -1; public OnMenu(client, menu, item) {     if (item != MENU_EXIT)         Class = item;         menu_destroy(menu);         return PLUGIN_HANDLED; }
Simple as that.

Last edited by hleV; 02-25-2012 at 09:19.
hleV is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 02-25-2012 , 09:28   Re: Remember selection
Reply With Quote #5

Quote:
Originally Posted by H.RED.ZONE View Post
Yep until you open the menu and choose option again class will be the same as you choose it first time.
I told you that you don't show it to the player again.
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 02-25-2012 , 12:31   Re: Remember selection
Reply With Quote #6

Tired can't do it can you show me?
Attached Files
File Type: sma Get Plugin or Get Source (menu_class.sma - 441 views - 49.8 KB)
__________________

Last edited by H.RED.ZONE; 02-25-2012 at 12:31.
H.RED.ZONE is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 02-25-2012 , 13:03   Re: Remember selection
Reply With Quote #7

I will not look at such a code.
Please create bigger functions with more functionality. Use switch case. You are basically repeating a code that could have been written just once.

Ex:
PHP Code:
        case 3
        {
            if(
zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_nemesis(id)) return PLUGIN_HANDLED;
            
//g_player_class[id] = 3
            
got_class[id] = true
            class_3
(id)
        }
        case 
4
        {
            if(
zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_nemesis(id)) return PLUGIN_HANDLED;
            
//g_player_class[id] = 4
            
got_class[id] = true
            class_4
(id)
    
        }
        case 
5
        {
            if(
zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_nemesis(id)) return PLUGIN_HANDLED;
            
//g_player_class[id] = 5
            
got_class[id] = true
            class_5
(id)
        }
        case 
6
        {
            if(
zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_nemesis(id)) return PLUGIN_HANDLED;
            
//g_player_class[id] = 6
            
got_class[id] = true
            class_6
(id)
        }
        case 
7
        {
            if(
zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_nemesis(id)) return PLUGIN_HANDLED;
            
//g_player_class[id] = 7
            
got_class[id] = true
            class_7
(id)
        }
        case 
8
        {
            if(
zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_nemesis(id)) return PLUGIN_HANDLED;
            
//g_player_class[id] = 8
            
got_class[id] = true
            class_8
(id)
        }
        case 
9
        {
            if(
zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_nemesis(id)) return PLUGIN_HANDLED;
            
//g_player_class[id] = 9
            
got_class[id] = true
            class_9
(id
TO:
PHP Code:
if(zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_nemesis(id)) return PLUGIN_HANDLED;
g_player_class[id] = key
got_class
[id] = true
class(idkey//class(id, class_number) 
Create only one class function that give the properties to the user using case, switch so that the code will be easier to debug.
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.

Last edited by ot_207; 02-25-2012 at 13:03.
ot_207 is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 02-25-2012 , 14:31   Re: Remember selection
Reply With Quote #8

Quote:
Originally Posted by ot_207 View Post
I will not look at such a code.
Please create bigger functions with more functionality. Use switch case. You are basically repeating a code that could have been written just once.
Now i get why i couldn't do it. Thanks i need to rewrite it full (:
__________________
H.RED.ZONE is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 02-25-2012 , 14:53   Re: Remember selection
Reply With Quote #9

Quote:
Originally Posted by H.RED.ZONE View Post
Now i get why i couldn't do it. Thanks i need to rewrite it full (:
Ok, after you will rewrite it, if you still have problems, please post the code here so we can help.
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 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 02:29.


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