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

Command available only for ADMIN_IMMUNITY


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
brlight
Senior Member
Join Date: Jun 2011
Old 03-23-2014 , 12:08   Command available only for ADMIN_IMMUNITY
Reply With Quote #1

I´m trying to make some commands available only to ADMIN_IMMUNITY.
I´ve changed this:
register_clcmd("say /ball", "ShowMainMenu")
register_clcmd("say /reset", "UpdateBall")
register_clcmd("say /resetgoal", "ResetGoalMarker")
register_concmd("findball", "FindBall")

to this:

register_clcmd("say /ball", "ShowMainMenu", ADMIN_IMMUNITY)
register_clcmd("say /reset", "UpdateBall", ADMIN_IMMUNITY)
register_clcmd("say /resetgoal", "ResetGoalMarker", ADMIN_IMMUNITY)
register_concmd("findball", "FindBall", ADMIN_IMMUNITY)

But normal players can still have access to that command and menu, what do I have to do?
Thanks in advance

P.S.- I already went here but I don´t understand what I´m doing wrong
http://www.amxmodx.org/doc/index.htm...ster_clcmd.htm

Last edited by brlight; 03-23-2014 at 12:10.
brlight is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 03-23-2014 , 15:07   Re: Command available only for ADMIN_IMMUNITY
Reply With Quote #2

That doesn't actually change anything unless the function contains cmd_access()

Like this:
Code:
public ShowMainMenu(id, level, cid) {     if ( ! cmd_access(id, level, cid, 0) )         return PLUGIN_CONTINUE; }

level is ADMIN_IMMUNITY that you've set.
cid is the command id, used to retrieve the information string if number of arguments is less than the fourth parameter. That's why I used 0.

If you want to be efficient, you can use access(id, level) instead.
Another way is to use ( get_user_flags(id) & level ).

cmd_access() is the only one that takes into account the host computer, dedicated or not.
__________________

Last edited by Black Rose; 03-23-2014 at 15:18.
Black Rose is offline
brlight
Senior Member
Join Date: Jun 2011
Old 03-23-2014 , 18:12   Re: Command available only for ADMIN_IMMUNITY
Reply With Quote #3

Thank you very much!
brlight 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 22:41.


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