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

Admin only menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Andriis
Member
Join Date: May 2019
Old 05-27-2019 , 14:19   Admin only menu
Reply With Quote #1

If I have a menu with something in it, and when I choose one of them, it brings up another menu but for just a specific type of admin for example who has the admin flag a -immunity.. can use the menu, else the chat will say that he/she can't use the menu.. I tried out a few things but none of them was a succes.. Please can someone give me a tutorial about it?
Thanks in advance
Andriis is offline
Andriis
Member
Join Date: May 2019
Old 05-27-2019 , 14:29   Re: Admin only menu
Reply With Quote #2

Solved ^^
Andriis is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 05-27-2019 , 15:02   Re: Admin only menu
Reply With Quote #3

Post the code and solution.
redivcram is offline
Andriis
Member
Join Date: May 2019
Old 05-27-2019 , 15:53   Re: Admin only menu
Reply With Quote #4

You mean here?

At first I tried like this: read_flags(d)

This is the working one.

Code:
case 0: {
			if(get_user_flags(id) & ADMIN_BAN){
				PenaltyMenu(id)
			}else{
				ColorChat(id, NORMAL, "^4thS^1 | You have no access")
				menu_destroy(id);
			}
		}
Andriis is offline
Andriis
Member
Join Date: May 2019
Old 05-27-2019 , 16:06   Re: Admin only menu
Reply With Quote #5

Now I have another problem with this

I tried to do same here
Code:
if(get_user_flags(id) & ADMIN_BAN){
	menu_additem(AMenu,"\yPenalty Menu","0",0)
}else{
	menu_additem(AMenu,"\dPenalty Menu","0",0)
}
I want it like this because if someone can't use that specific menu item, than I want it to show them with grey color.. But it's not working :/
Andriis is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-27-2019 , 16:06   Re: Admin only menu
Reply With Quote #6

If you have a menu and you want to restrict specific options in that menu for certain players, you can use a menu callback to disable the selection. So, if you have 5 options in your menu and the player shouldn't have access item 2 then you'd use the callback to check if they have access, if they don't item 2 will show up as grey text and they will not be able to select it, all other options will be available (if they have access to those).

So, instead of someone choosing the option and getting a message saying that they don't have access, you can show them that they don't have access in the menu itself.

There is an example here.
__________________

Last edited by fysiks; 05-27-2019 at 16:08.
fysiks is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 05-27-2019 , 16:10   Re: Admin only menu
Reply With Quote #7

Quote:
Originally Posted by Andriis View Post
Now I have another problem with this

I tried to do same here
Code:
if(get_user_flags(id) & ADMIN_BAN){
	menu_additem(AMenu,"\yPenalty Menu","0",0)
}else{
	menu_additem(AMenu,"\dPenalty Menu","0",0)
}
I want it like this because if someone can't use that specific menu item, than I want it to show them with grey color.. But it's not working :/
Code:
	if (get_user_flags( id ) & ADMIN_BAN )
		menu_additem( AMenu, "\yPenalty Menu"); 
	else 
		menu_additem( AMenu, "\dPenalty Menu");
As for "0" it all depends on your Handler
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-27-2019 , 16:10   Re: Admin only menu
Reply With Quote #8

Quote:
Originally Posted by Andriis View Post
Now I have another problem with this

I tried to do same here
Code:
if(get_user_flags(id) & ADMIN_BAN){
	menu_additem(AMenu,"\yPenalty Menu","0",0)
}else{
	menu_additem(AMenu,"\dPenalty Menu","0",0)
}
I want it like this because if someone can't use that specific menu item, than I want it to show them with grey color.. But it's not working :/
This should be done with callbacks like I just described in my previous post.
__________________
fysiks is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 05-27-2019 , 16:12   Re: Admin only menu
Reply With Quote #9

Quote:
Originally Posted by Andriis View Post
You mean here?

At first I tried like this: read_flags(d)

This is the working one.

Code:
case 0: {
			if(get_user_flags(id) & ADMIN_BAN){
				PenaltyMenu(id)
			}else{
				ColorChat(id, NORMAL, "^4thS^1 | You have no access")
				menu_destroy(id);
			}
		}
I think you create a a wrong loops, no need for ELSE loop in your way

Last edited by Fuck For Fun; 05-27-2019 at 16:12.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Andriis
Member
Join Date: May 2019
Old 05-27-2019 , 16:21   Re: Admin only menu
Reply With Quote #10

Thank you guys, you helped a lot!
Andriis 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 06:19.


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