Help -
BlackEvils - 16.03.2016
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;
}
Re: Help -
saffierr - 17.03.2016
What is the exact problem of the given code plus please use [ php] code
Re: Help -
BlackEvils - 17.03.2016
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
Re: Help -
zPain - 17.03.2016
Looks like you're trying to
save the settings when the gamemode is loaded. Shouldn't you be
loading them?
Re: Help -
BlackEvils - 17.03.2016
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
Re: Help -
BlackEvils - 17.03.2016
then?
Re: Help -
introzen - 17.03.2016
Код:
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;
}