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

Two flags on one command ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 06-27-2012 , 13:14   Two flags on one command ?
Reply With Quote #1

Hi

Is there anyway two flags on one command from cmdaccess.ini ?

I searched and i didn't find a way but from sma file

Last edited by Moody92; 06-27-2012 at 13:24.
Moody92 is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 06-27-2012 , 17:58   Re: Two flags on one command ?
Reply With Quote #2

I don't think that is possible but maybe (it may work try it) you can make a define and put 2 access flags on it

Try this if it works:
Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "Test" #define VERSION "1.0" #define AUTHOR "Khalid" #define ACCESS_FLAG (ADMIN_BAN | ADMIN_MENU) public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /test", "test_cmd", ACCESS_FLAG) } public test_cmd(id, level, cid) {     if(!cmd_access(id, level, cid)     {         client_print(id, print_chat, "Access failed")         return PLUGIN_HANDLED     }         else     {         client_print(id, print_chat, "Access success")         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED }
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.

Last edited by pokemonmaster; 06-27-2012 at 20:41.
pokemonmaster is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-27-2012 , 23:09   Re: Two flags on one command ?
Reply With Quote #3

Quote:
Originally Posted by Moody92 View Post
Hi

Is there anyway two flags on one command from cmdaccess.ini ?

I searched and i didn't find a way but from sma file
Yes! You can. E.g. "ch", etc. But, you have to realize that when you do put two flags it will allow access to the command if you only have one OR both of those flags.

If you need to require BOTH flags always then you will need to modify the plugin which contains the command in question. OR, you can modify /include/amxmisc.inc and recompile all your plugins locally.

Also, FYI, pokemonmaster's response is wrong and his code does exactly the same thing that it already does when you supply two flags for a command as I stated above.
__________________

Last edited by fysiks; 06-27-2012 at 23:10.
fysiks is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-27-2012 , 23:29   Re: Two flags on one command ?
Reply With Quote #4

While I can't test this right now, if the cmdaccess.ini is anything like SourceMod's admin_overrides.cfg file, it requires ALL of the flags you set in order to use it. I've never found much use assigning multiple flags to a command
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-28-2012 , 00:03   Re: Two flags on one command ?
Reply With Quote #5

Quote:
Originally Posted by YamiKaitou View Post
While I can't test this right now, if the cmdaccess.ini is anything like SourceMod's admin_overrides.cfg file, it requires ALL of the flags you set in order to use it. I've never found much use assigning multiple flags to a command
amxmisc.inc line 50.
__________________
fysiks is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-28-2012 , 00:08   Re: Two flags on one command ?
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
amxmisc.inc line 50.
That is telling me that if you enter multiple flags, the user requires all flags to use the command. But I could not be thinking right.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-28-2012 , 00:30   Re: Two flags on one command ?
Reply With Quote #7

Quote:
Originally Posted by YamiKaitou View Post
That is telling me that if you enter multiple flags, the user requires all flags to use the command. But I could not be thinking right.
It's bitwise AND so if you have either one the result will be non-zero (true).

Code:
	1011 0001 (get_user_flags(id))
AND	0000 1001 (two flags aka "level")
=	0000 0001 (true)
To require both, you need to do this:

PHP Code:
    else if ( (get_user_flags(id) & level) == level )
    {
        
has_access 1;
    } 
__________________

Last edited by fysiks; 06-28-2012 at 00:33.
fysiks is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 06-28-2012 , 07:20   Re: Two flags on one command ?
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
Yes! You can. E.g. "ch", etc. But, you have to realize that when you do put two flags it will allow access to the command if you only have one OR both of those flags.
There is no difference at all, as the command will always work...

Quote:
Originally Posted by fysiks View Post
Also, FYI, pokemonmaster's response is wrong and his code does exactly the same thing that it already does when you supply two flags for a command as I stated above.
Hey! I'm still a beginner in this thing.
Atleast I tried.
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.
pokemonmaster is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-28-2012 , 18:31   Re: Two flags on one command ?
Reply With Quote #9

Quote:
Originally Posted by pokemonmaster View Post
There is no difference at all, as the command will always work...
This response doesn't make sense. What are you saying?
__________________
fysiks is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 06-28-2012 , 19:54   Re: Two flags on one command ?
Reply With Quote #10

Thanks everybody for helping.
Moody92 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 07:49.


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