AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Admins loading function... (https://forums.alliedmods.net/showthread.php?t=163814)

Ashcan 08-03-2011 15:12

Admins loading function...
 
Hello
I downloaded nice plugin:
http://forums.alliedmods.net/showthread.php?t=130658

its very nice but its unapproved for now.
Im changing it little but i got a problem now...

The function of loading admins:
Code:

LoadTotalAdmins()
{
        new szUsersIni[48];
        get_configsdir(szUsersIni, 47);
        add(szUsersIni, 47, "/users.ini");
       
        if(!gAdmsNum)
                return 0;
       
        static Text[256], szAdmins[64], szFlags[10],
        RealName[48], Email[48], Status[48];
       
        new iFlags, f = fopen(szUsersIni, "rt");
       
        while(!feof(f) )
        {
                fgets(f, Text, 255);
               
                if(!strlen(Text) ) continue;
                if(Text[0] == ';') continue;
                if(Text[0] == '/' && Text[1] == '/') continue;
               
                parse(Text, szAdmins, 63, "", 0, "", 0, szFlags, 9, RealName, 47, Email, 47, Status, 47);
               
                iFlags = read_flags(szFlags);
               
                if(iFlags & FLAG_AUTHID) continue;
               
                ArrayPushString(TotalAdmins, szAdmins);
               
                ArrayPushString(RealNames, RealName);
                ArrayPushString(Emails, Email);
                ArrayPushString(AdmStatus, Status);
               
                gTotalAdms++;
        }
       
        fclose(f);
       
        return 1;
}

And i just wonder...
How can i change reading admins from file to reading admins from sql?

Just thinking...
i would do that this way:
Code:

queryAdmin = SQL_PrepareQuery(sql,"SELECT * FROM `%s` WHERE `admin_group_id` = '%s'", table, AdminGroup)
new qcolmember_sid = SQL_FieldNameToNum(queryAdmin, "member_sid");
SQL_ReadResult(queryAdmin, qcolmember_sid, szAdmins, sizeof(szAdmins)-1);

so now i would delete the lines above "parse" that are connected to reading admins from users.ini, and the next part would be like...
Code:

ArrayPushString(TotalAdmins, szAdmins);
but im not sure if it will work.
Can u tell me if i understand it correctly? and/or tell me what should i know ? :)


All times are GMT -4. The time now is 03:21.

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