#1

How i should use this code because i want save some settings for my server but it doesn't do without have wanr/errors in the gamemode.


enum ServerData
{
MaxPing,
gpgang1,
gpgang3
};
new ServerInfo[ServerData];

public OnGameModeInit()
{
new file[256];
format(file,sizeof(file),"Config.ini");
dini_IntSet(file,"MaxPing", ServerInfo[MaxPing]);
dini_IntSet(file,"gpgang1", ServerInfo[gpgang1]);
dini_IntSet(file,"gpgang3", ServerInfo[gpgang3]);
return 1;
}

public OnGameModeExit()
{
UpdateConfig();
return 1;
}

stock UpdateConfig()
{
new file[256];
format(file,sizeof(file),"Config.ini");
if(!dini_Exists(file))
{
dini_Create(file);
print("\n >Configuration File Successfully Created");
}

if(!dini_Isset(file,"MaxPing")) dini_IntSet(file,"MaxPing",1200);
if(!dini_Isset(file,"gpgang1")) dini_IntSet(file,"gpgang1",0);
if(!dini_Isset(file,"gpgang3")) dini_IntSet(file,"gpgang3",0);
if(dini_Exists(file))
{
ServerInfo[MaxPing] = dini_Int(file,"MaxPing");
ServerInfo[gpgang1] = dini_Int(file,"gpgang1");
ServerInfo[gpgang3] = dini_Int(file,"gpgang3");
print("\n -Configuration Settings Loaded");
}
return 1;
}
Reply
#2

What is the exact problem of the given code plus please use [ php] code
Reply
#3

Quote:
Originally Posted by saffierr
Посмотреть сообщение
What is the exact problem of the given code plus please use [ php] code
It don't save i try set for example max ping but anything
Reply
#4

Looks like you're trying to save the settings when the gamemode is loaded. Shouldn't you be loading them?
Reply
#5

Quote:
Originally Posted by zPain
Посмотреть сообщение
Looks like you're trying to save the settings when the gamemode is loaded. Shouldn't you be loading them?
I want make this but i want make too save settings and load when server start and when stop save
Reply
#6

then?
Reply
#7

Код:
enum ServerData
{
MaxPing,
gpgang1,
gpgang3
};
new ServerInfo[ServerData];

public OnGameModeInit()
{
UpdateConfig();
return 1;
}

public OnGameModeExit()
{
new file[256];
format(file,sizeof(file),"Config.ini");
dini_IntSet(file,"MaxPing", ServerInfo[MaxPing]);
dini_IntSet(file,"gpgang1", ServerInfo[gpgang1]);
dini_IntSet(file,"gpgang3", ServerInfo[gpgang3]);
return 1;
}

stock UpdateConfig()
{
new file[256];
format(file,sizeof(file),"Config.ini");
if(!dini_Exists(file))
{
dini_Create(file);
print("\n >Configuration File Successfully Created");
}

if(!dini_Isset(file,"MaxPing")) dini_IntSet(file,"MaxPing",1200);
if(!dini_Isset(file,"gpgang1")) dini_IntSet(file,"gpgang1",0);
if(!dini_Isset(file,"gpgang3")) dini_IntSet(file,"gpgang3",0);
if(dini_Exists(file))
{
ServerInfo[MaxPing] = dini_Int(file,"MaxPing");
ServerInfo[gpgang1] = dini_Int(file,"gpgang1");
ServerInfo[gpgang3] = dini_Int(file,"gpgang3");
print("\n -Configuration Settings Loaded");
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)