Raised This Month: $ Target: $400
 0% 

Admin to Admin Sql


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fmfs10
Senior Member
Join Date: Mar 2009
Location: Brasil
Old 03-27-2011 , 16:34   Admin to Admin Sql
Reply With Quote #1

Hello! I created a script to take all the admins from my servers that are in users.ini and add it to my sql db. It worked, the problem was that from a determined point of the file, the server just restarts. I just erase a part of the file that already was read, and it worked. But I want to know. Why the server restarts from a determined point?

Here is the script:

PHP Code:
#include <amxmodx>
#include <amxmisc>

public plugin_init() {
    
register_plugin("ADD ADMIN SQL""1.0""KoN")
    
}

public 
plugin_cfg() {
    
    new 
configs_dir[64]
    
get_configsdir(configs_dir,charsmax(configs_dir))
    
    new 
adminpath[100]
    
formatex(adminpath99"%s/users.ini"configs_dir)
    
    new 
File=fopen(adminpath,"r");
    
    if (
File)
    {
        new 
Text[512];
        new 
Flags[32];
        new 
Access[32]
        new 
AuthData[44];
        new 
Password[32];
        
        while (!
feof(File))
        {
            
fgets(File,Text,sizeof(Text)-1);
            
            
trim(Text);
            
            
// comment
            
if (Text[0]==';' || Text[0]=='/' || Text[0]==' '
            {
                continue;
            }
            
            
Flags[0]=0;
            
Access[0]=0;
            
AuthData[0]=0;
            
Password[0]=0;
            
            
// not enough parameters
            
if (parse(Text,AuthData,sizeof(AuthData)-1,Password,sizeof(Password)-1,Access,sizeof(Access)-1,Flags,sizeof(Flags)-1) < 2)
            {
                continue;
            }
            
            
server_cmd("amx_addadmin ^"%s^" ^"%s^" ^"%s^" name"AuthDataAccessPassword)
            
//server_cmd("amx_addadmin ^"%s^" ^"%s^" ^"%s^" steamid", AuthData, Access, Password)
        
}
        
        
fclose(File);
    }


Last edited by fmfs10; 03-28-2011 at 12:21.
fmfs10 is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 03-27-2011 , 23:26   Re: Admin to Admin Sql
Reply With Quote #2

The plugin doesn't have sence , you open a ini , and you never uses it.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
fmfs10
Senior Member
Join Date: Mar 2009
Location: Brasil
Old 03-28-2011 , 12:20   Re: Admin to Admin Sql
Reply With Quote #3

It's has a sense, and it worked for me... lol
The only problem was that from a determined line, it was restarting server.

As I'm migrating from normal Admin style to Admin SQL style, I did this plugin to read from the users.ini and automatically add admin so it is a lot faster for me, as I have a lot of admins from my server and I don't want to add one per one in my SQL database
fmfs10 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:30.


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