Raised This Month: $ Target: $400
 0% 

Help with setting admin flags


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
waylaidwanderer
SourceMod Donor
Join Date: Aug 2012
Old 09-22-2014 , 02:03   Help with setting admin flags
Reply With Quote #1

I'm trying to set flags for both admins/non-admins if they've donated to the gaming group I'm writing the plugin for. This allows them to open a VIP-only menu where they can access VIP-only commands.

However, it seems to be overwriting the flags that admins already have - meaning that while the admin-player can access the menu, they lose their admin privileges. Quote from the admin:
Quote:
As for the admin issue it seems to happen randomly. On occasion both will work and other times only the perks work and the admin wont.
Here's the relevant code:
Code:
SetFlags(client)
{
    if (g_VipRank[client] == 2)
    {
        // check if user is admin already
        new AdminId:id = GetUserAdmin(client);
        if (id == INVALID_ADMIN_ID)
        {
            new AdminId:admin = CreateAdmin("VIP2");
            SetAdminFlag(admin, Admin_Reservation, true);
            SetUserAdmin(client, admin);
        }
        else
        {
            SetAdminFlag(id, Admin_Reservation, true);
        }
    }
    else if (g_VipRank[client] == 1)
    {
        // check if user is admin already
        new AdminId:id = GetUserAdmin(client);
        if (id == INVALID_ADMIN_ID)
        {
            new AdminId:admin = CreateAdmin("VIP1");
            SetAdminFlag(admin, Admin_Custom1, true);
            SetUserAdmin(client, admin);
        }
        else
        {
            SetAdminFlag(id, Admin_Custom1, true);
        }
    }
}
Any ideas?
waylaidwanderer is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 09-22-2014 , 06:10   Re: Help with setting admin flags
Reply With Quote #2

Where is that code being called from?
__________________
asherkin is offline
waylaidwanderer
SourceMod Donor
Join Date: Aug 2012
Old 09-22-2014 , 16:50   Re: Help with setting admin flags
Reply With Quote #3

"OnClientAuthorized" calls "CheckUser", which checks the database for the SteamID, and if not present, checks if the user is a member of the Steam group, then calls "SetFlags".

Now that you ask though... Should I change it to "OnClientPostAdminCheck" instead?

Last edited by waylaidwanderer; 09-22-2014 at 16:50.
waylaidwanderer is offline
DJ Data
SourceMod Donor
Join Date: Dec 2012
Location: Switzerland
Old 09-23-2014 , 08:46   Re: Help with setting admin flags
Reply With Quote #4

Quote:
Originally Posted by waylaidwanderer View Post
"OnClientAuthorized" calls "CheckUser", which checks the database for the SteamID, and if not present, checks if the user is a member of the Steam group, then calls "SetFlags".

Now that you ask though... Should I change it to "OnClientPostAdminCheck" instead?
Totally off topic, but arent you that famous SteamBot coder?
__________________
SourcePawn Coding Level: Novice
DJ Data is offline
waylaidwanderer
SourceMod Donor
Join Date: Aug 2012
Old 09-24-2014 , 23:50   Re: Help with setting admin flags
Reply With Quote #5

Quote:
Originally Posted by DJ Data View Post
Totally off topic, but arent you that famous SteamBot coder?
I may be one of them. I'm the owner and developer of http://scrapbank.me.
waylaidwanderer 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 19:35.


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