SA-MP Forums Archive
INI Parse File help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: INI Parse File help (/showthread.php?tid=474602)



INI Parse File help - erminpr0 - 08.11.2013

Hello I need someone to explain me INI ParseFile, I need following:

pawn Код:
new
   IntVar,
   StringVar[24],
   Float:FloatVar;
I need someone to explain me how to load those variables from file

Saving:

pawn Код:
stock saveVars();
{
   new INI:File = INI_Open("/Variables/vars.ini");
   INI_WriteInt(File, "IntVar", IntVar);
   INI_WriteString(File, "StringVar", StringVar);
   INI_WriteFloat(File, "FloatVar", FloatVar);
   INI_Close(File);
   return 1;
}



Re: INI Parse File help - AlonzoTorres - 09.11.2013

pawn Код:
INI_ParseFile("/Variables/vars.ini", "getVar_Stats", .bExtra = true, .extra = playerid);
// This will load everything below + allow you to use playerid. Use this when you want
// to load the players data for the first time. It has to be under a function which has
// playerid as a parameter.

forward getVar_Stats(playerid,name[],value[]);
public getVar_Stats(playerid,name[],value[])
// This will return the information wanted (value[]) for the playerid. Through
// Y_INI.
{
    INI_Int("IntVar", IntVar);
    INI_String("StringVar", StringVar, 24);
    INI_Float("FloatVar", FloatVar);
    return 1;
}