Raised This Month: $51 Target: $400
 12% 

Admin Cache and AdminId


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pavelas
Junior Member
Join Date: Oct 2016
Old 11-07-2020 , 06:54   Admin Cache and AdminId
Reply With Quote #1

Good day,

I have a question related to Admin Cache and AdminId, I was looking into admin-sql-threaded plugin and other similar plugins, I found that all those plugins are using Admin Cache (OnRebuildAdminCache, OnClientPreAdminCheck and other functions).

However, I found some other functions which provide you ability to grant admin access for players.

PHP Code:
public void OnClientAuthorized(int client, const char[] auth)
{
    if (
IsFakeClient(client)) {
        return;
    }

    
char flags[32];
    
strcopy(flagssizeof(flags), "abcdefghjklmn");

    
int immunity 99;

    
AdminId Admin CreateAdmin();
    
AdminFlag Flag;

    
SetAdminImmunityLevel(Adminimmunity);

    for (
int i 0strlen(flags); i++) {
        if (!
FindFlagByChar(flags[i], Flag)) {
            continue;
        }

        
Admin.SetFlag(Flagtrue);
    }

    
SetUserAdmin(clientAdmintrue);

As you can see this method is really simple, I want to use this method because I want to build my own plugin to connect all players and admins in the same database and identify them by ID.

Questions:
  1. What kind of problems I may face while using this method?
  2. In terms of performance, this method is the same, worse, better?
  3. What if we make an assumption that we have 200, 500 or 1000 admins in the database? How performance changes?

If you have any comments or suggestions, feel free to share it.

Thank you guys.

Last edited by Pavelas; 11-07-2020 at 06:54.
Pavelas is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 11-07-2020 , 08:30   Re: Admin Cache and AdminId
Reply With Quote #2

Instead, reinvent wheel, why you not just use admin-sql-threaded.smx ?
Just connect into your MySQL

https://wiki.alliedmods.net/SQL_Admins_(SourceMod)
Bacardi is offline
Pavelas
Junior Member
Join Date: Oct 2016
Old 11-07-2020 , 15:04   Re: Admin Cache and AdminId
Reply With Quote #3

Yes, I understand your point and it's pretty logical, but for learning purposes and just because I really love to code, I have like a challenge for myself to build everything from scratch, I want to connect players, admins, groups in a single relational database.
Personally for me, it's really exciting that I can write almost the same functionality in 20 lines and it works. I just don't have enough experience in SourcePawn, so I was thinking that maybe I am missing something.
Pavelas 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 14:51.


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