AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Solved flag validations (https://forums.alliedmods.net/showthread.php?t=339054)

weffer 08-12-2022 14:11

flag validations
 
hello,i am trying to do a flag validation currently, the client executing the !test command has the "b" flag assigned but it prints as if the client has the "a" flag what could be the problem.

Code:

RegConsoleCmd("sm_test", cmdTest);
public Action cmdTest(int client, int args) {
        if(CheckCommandAccess(client, "", ADMFLAG_GENERIC) ||
      CheckCommandAccess(client, "", ADMFLAG_RESERVATION))
    {   
      if(CheckCommandAccess(client, "", ADMFLAG_RESERVATION)) {
        CPrintToChatAll("flag a");   
      } else if(CheckCommandAccess(client, "", ADMFLAG_GENERIC)) {       
        CPrintToChatAll("flag b");
      }
    }
}


Devvii 08-12-2022 15:03

Re: flag validations
 
#include <multicolors>
public void OnPluginStart()
{
RegConsoleCmd("sm_test", cmdTest);
}
public Action cmdTest(int client, int args) {
if(CheckCommandAccess(client, "", ADMFLAG_GENERIC) ||
CheckCommandAccess(client, "", ADMFLAG_RESERVATION))
{
if(CheckCommandAccess(client, "a", ADMFLAG_RESERVATION)) {
CPrintToChatAll("flag a");
} else if(CheckCommandAccess(client, "b", ADMFLAG_GENERIC)) {
CPrintToChatAll("flag b");
}
}
}


// Here :>

Grey83 08-12-2022 16:36

Re: flag validations
 
PHP Code:

public void OnPluginStart()
{
    
RegConsoleCmd("sm_test"cmdTest);
}

public 
Action cmdTest(int clientint args)
{
    if(!
client || !IsClientInGame(client) || IsFakeClient(client))
        return 
Plugin_Handled;

    
int flags GetUserFlagBits(client);
    if(
flags ADMFLAG_GENERIC)
        
PrintToChatAll("flag b");
    else if(
flags ADMFLAG_RESERVATION)
        
PrintToChatAll("flag a");

    return 
Plugin_Handled;




All times are GMT -4. The time now is 08:53.

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