Server info in file?
#8

Quote:
Originally Posted by M4D
Посмотреть сообщение
i explained code with comments ... read them

Код:
enum sAcc
{
    Announce,
	ReadPms,
	MaxPing,
	ReadCmds,
	AutoLog,
	sLocked,
	sPass[129],
	Chat,
	ReporterName[MAX_PLAYER_NAME],
	TargetName[MAX_PLAYER_NAME],
	Reason[128],
	Accountid,
	H,
	M,
	S
};

new YourVariable[sAcc]; //data will store in this variable

forward Load(name[], value[]); //>Loading Data function
public Load(name[], value[])
{
	INI_Int("Announce",YourVariable[Announce]); //Loading "Announce" value into "YourVariable[Announce]" as integer
	INI_Int("ReadPms",YourVariable[ReadPms]);
	INI_Int("MaxPing",YourVariable[MaxPing]);
	INI_Int("ReadCmds",YourVariable[ReadCmds]);
	INI_Int("AutoLog",YourVariable[AutoLog]);
	INI_Int("sLocked",YourVariable[sLocked]);
	INI_String("sPass",ServerInfo[sPass], 129);
	INI_Int("Chat",YourVariable[Chat]);
	INI_String("ReporterName",ServerInfo[ReporterName], 24);
	INI_String("TargetName",ServerInfo[TargetName], 24);
	INI_String("Reason",ServerInfo[Reason], 128);
	INI_Int("Accountid",YourVariable[Accountid]);
	INI_Int("H",YourVariable[H]);
	INI_Int("M",YourVariable[M]);
	INI_Int("S",YourVariable[S]);
    return 1;
}

//>When You Want load file data into variables, Use Following Function. for example, in OnGameModeInit

INI_ParseFile(/*Your File PATH Here*/, "Load", .bExtra = false, .extra = 0);

//>saving variables data into file is like player data saving...
//example:

new INI:File = INI_Open(/*Your PATH*/);
INI_SetTag(File, /*Your Tag*/);
INI_WriteInt(File,"Announce",ServerInfo[YourVariable[Announce]]);
//>and other things...
INI_Close(File);
it's like player data saving, just remove playerid parameter

i suggest you use MySQL to have an easier life
Thanks,i understood it easily by your help
Reply


Messages In This Thread
Server info in file? - by Mouiz - 11.07.2015, 15:44
Re: Server info in file? - by M4D - 11.07.2015, 15:49
Re: Server info in file? - by Mouiz - 11.07.2015, 15:50
Re: Server info in file? - by Mouiz - 11.07.2015, 15:53
Re: Server info in file? - by Threshold - 11.07.2015, 15:57
Re: Server info in file? - by M4D - 11.07.2015, 15:58
Re: Server info in file? - by M4D - 11.07.2015, 16:09
Re: Server info in file? - by Mouiz - 11.07.2015, 16:12

Forum Jump:


Users browsing this thread: 2 Guest(s)