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(adminpath, 99, "%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", AuthData, Access, Password)
//server_cmd("amx_addadmin ^"%s^" ^"%s^" ^"%s^" steamid", AuthData, Access, Password)
}
fclose(File);
}
}