Raised This Month: $32 Target: $400
 8% 

Problem with flags (RegAdminCmd)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KeidaS
Junior Member
Join Date: Jan 2018
Old 03-02-2018 , 05:19   Problem with flags (RegAdminCmd)
Reply With Quote #1

Hi, I'm having some problem assigning a cmd to differents flags:

I want to assign a command to someone that has the Admin flag custom 1 and 5 or someone that has the Admin flag changemap. I tryed something like this:

RegAdminCmd("asd", asd, (ADMFLAG_CUSTOM1 | ADMFLAG_CUSTOM5) || ADMFLAG_CHANGEMAP);

The command only works for the user with the flag changemap and not for the others who have the custom flags.

There is a way to make this?

There is a shitty solution making this but i don't want to do that:
RegAdminCmd("asd", asd, ADMFLAG_CUSTOM1 | ADMFLAG_CUSTOM5);
RegAdminCmd("asd", asd, ADMFLAG_CHANGEMAP);

Thanks for your time
KeidaS is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 03-02-2018 , 07:39   Re: Problem with flags (RegAdminCmd)
Reply With Quote #2

Code:
RegAdminCmd("asd", asd, (ADMFLAG_CUSTOM1|ADMFLAG_CUSTOM5|ADMFLAG_CHANGEMAP));
cravenge is offline
KeidaS
Junior Member
Join Date: Jan 2018
Old 03-02-2018 , 08:10   Re: Problem with flags (RegAdminCmd)
Reply With Quote #3

Quote:
Originally Posted by cravenge View Post
Code:
RegAdminCmd("asd", asd, (ADMFLAG_CUSTOM1|ADMFLAG_CUSTOM5|ADMFLAG_CHANGEMAP));
It doesn't work, if I use this if i only have the ADMFLAG_CHANGEMAP it doesn't work, and if I only have ADMFLAG_CUSTOM1 and ADMFLAG_CUSTOM5 it doesn't work too.

What i need is the comand for people having (ADMFLAG_CUSTOM1 and ADMFLAG_CUSTOM5) or having ADMFLAG_CHANGEMAP
KeidaS is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 03-02-2018 , 09:58   Re: Problem with flags (RegAdminCmd)
Reply With Quote #4

When you set flags for a command, only users who have ALL the specified flags can use it.

Edit: Using RegAdminCmd that is. See Visual77's post for a workaround.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 03-02-2018 at 16:34.
Powerlord is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 03-02-2018 , 10:43   Re: Problem with flags (RegAdminCmd)
Reply With Quote #5

Quote:
Originally Posted by KeidaS View Post
It doesn't work, if I use this if i only have the ADMFLAG_CHANGEMAP it doesn't work, and if I only have ADMFLAG_CUSTOM1 and ADMFLAG_CUSTOM5 it doesn't work too.

What i need is the comand for people having (ADMFLAG_CUSTOM1 and ADMFLAG_CUSTOM5) or having ADMFLAG_CHANGEMAP
You want to do CheckCommandAccess in the callback.

Code:
RegConsoleCmd("asd", CMD_ASD);

public Action CMD_ASD(int client, int args)
{
	if (client < 1 || client > MaxClients || !IsClientInGame(client)) return Plugin_Handled;

	if ((CheckCommandAccess(client, "sm_asd", ADMFLAG_CUSTOM1) 
	&& CheckCommandAccess(client, "sm_asd", ADMFLAG_CUSTOM5))
	|| CheckCommandAccess(client, "sm_asd", ADMFLAG_CHANGEMAP))
	{
		PrintToChat(client, "admin powah!");
	}
	else PrintToChat(client, "no admin powah for u wicked man.");
	
	return Plugin_Handled;
}
Visual77 is offline
KeidaS
Junior Member
Join Date: Jan 2018
Old 03-02-2018 , 11:12   Re: Problem with flags (RegAdminCmd)
Reply With Quote #6

Quote:
Originally Posted by Visual77 View Post
You want to do CheckCommandAccess in the callback.

Code:
RegConsoleCmd("asd", CMD_ASD);

public Action CMD_ASD(int client, int args)
{
	if (client < 1 || client > MaxClients || !IsClientInGame(client)) return Plugin_Handled;

	if ((CheckCommandAccess(client, "sm_asd", ADMFLAG_CUSTOM1) 
	&& CheckCommandAccess(client, "sm_asd", ADMFLAG_CUSTOM5))
	|| CheckCommandAccess(client, "sm_asd", ADMFLAG_CHANGEMAP))
	{
		PrintToChat(client, "admin powah!");
	}
	else PrintToChat(client, "no admin powah for u wicked man.");
	
	return Plugin_Handled;
}
Thanks man! I dind't thought about that It works.
KeidaS is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 03-03-2018 , 10:21   Re: Problem with flags (RegAdminCmd)
Reply With Quote #7

Quote:
Originally Posted by KeidaS View Post
Thanks man! I dind't thought about that It works.
Before you keep this, try

(ADMFLAG_CUSTOM1&ADMFLAG_CUSTOM5)|ADMFLAG_CHA NGEMAP
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 03-03-2018 , 13:11   Re: Problem with flags (RegAdminCmd)
Reply With Quote #8

Quote:
Originally Posted by eyal282 View Post
Before you keep this, try

(ADMFLAG_CUSTOM1&ADMFLAG_CUSTOM5)|ADMFLAG_CHA NGEMAP
That would just result in ADMFLAG_CHANGEMAP.
__________________
asherkin is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 03-03-2018 , 13:30   Re: Problem with flags (RegAdminCmd)
Reply With Quote #9

Quote:
Originally Posted by asherkin View Post
That would just result in ADMFLAG_CHANGEMAP.
Then what's the workaround?
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 03-03-2018 , 18:34   Re: Problem with flags (RegAdminCmd)
Reply With Quote #10

Quote:
Originally Posted by eyal282 View Post
Then what's the workaround?
sm_spawn brain.
Visual77 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 21:35.


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