Thread: Backpack
View Single Post
Antithasys
Moderator
Join Date: Apr 2008
Old 11-05-2009 , 21:31   Re: Backpack
Reply With Quote #10

Quote:
Originally Posted by InstantDeath View Post
sure, that would only require me to make the console command into an admin command. I'll make a special version for you.
You are looking for this:
PHP Code:
new Handle:g_hCvar_AdminString INVALID_HANDLE;

public 
OnPluginStart()
{
    
g_hCvar_AdminString CreateConVar("sm_backpack_adminflag""z""Admin flag to use, blank for open access");
    
    
//rest of the code
}

public 
Action:Command_SwapPrimary(clientargs)
{
    new 
String:sAdminFlag[16];
    
GetConVarString(g_hCvar_AdminStringsAdminFlagsizeof(sAdminFlag));
    if (
strlen(sAdminFlag) > && !IsValidAdmin(clientsAdminFlag))
    {
        return 
Plugin_Handled;
    }
    
    
//rest of the code
}

stock IsValidAdmin(client, const String:flags)
{
    new 
ibFlags ReadFlagString(flags);
    if ((
GetUserFlagBits(client) & ibFlags) == ibFlags)
    {
        return 
true;
    }
    if (
GetUserFlagBits(client) & ADMFLAG_ROOT)
    {
        return 
true;
    }
    return 
false;

__________________
[my plugins]

When you think about asking a question... consider what have you tried?

Last edited by Antithasys; 11-05-2009 at 21:34.
Antithasys is offline