View Single Post
stephen473
Senior Member
Join Date: Jan 2017
Location: somewhere on earth
Old 03-18-2021 , 15:12   Re: Checking for flag in script
Reply With Quote #3

Quote:
Originally Posted by LiveAndLetDie View Post
Code:
#include <sourcemod>

public void OnPluginStart()
{
	RegConsoleCmd("sm_test", Test);
}

public Action Test(int client, int args)
{
	ClientHasFlag(client) ? PrintToChat(client, "Yea") : PrintToChat(client, "Nope");
	
	return Plugin_Handled;
}

bool ClientHasFlag(int client)
{
	return(CheckCommandAccess(client, "", ADMFLAG_CUSTOM1, true));
}
Adapt it to your own needs. List of flags: https://wiki.alliedmods.net/Checking...dmin_Flag_Bits
would be better. also never left command string empty

PHP Code:
bool bFlagStatus ClientHasFlag(clientADMFLAG_BAN);

public 
bool ClientHasFlag(int clientint flag)
{
    return (
CheckCommandAccess(client"sm_test"flagtrue));

or just
PHP Code:
if(CheckCommandAccess(client"sm_test"ADMFLAG_BANtrue)) 
__________________
Also known as Hardy`.

Feel free to contact me if you have a private plugin request!

My Steam Profile | Discord: Hardy`#3792

Last edited by stephen473; 03-18-2021 at 15:20.
stephen473 is offline