Raised This Month: $ Target: $400
 0% 

Admin to Admin Sql


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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