SA-MP Forums Archive
Y_Ini - Can I do it?! - 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: Y_Ini - Can I do it?! (/showthread.php?tid=303503)



Y_Ini - Can I do it?! - SuperChock - 13.12.2011

Hello, how I read a value from a simple file using Y_Ini? I tried this:

pawn Код:
new sLastVal;
new INI:sCELLUS = INI_Open("Stats.ini");
INI_Int("Cellus", sLastVal);
INI_Close(sCELLUS);
printf("Value: %d", sLastVal);
Does it work? Or... what is the correct way?


Re: Y_Ini - Can I do it?! - SuperChock - 13.12.2011

I didn't understand the "[examples"] or "[more_examples"]... are they sessions or "classes" of a specific file? Can I use the code below, for example?

pawn Код:
new sValue;

main()
{
    INI_Load("Stats.ini");
}

INI:Stats[ServerStats](name[], value[])
{
    INI_Int("sCELLUS", sValue);
}

// Debug

printf("Value of var: %d", sValue);

EDIT: and if my file doesn't have "sessions"? If I did not create ... ?

Thank you very much


Re: Y_Ini - Can I do it?! - SuperChock - 14.12.2011

Can anyone answer?


Re: Y_Ini - Can I do it?! - SuperChock - 14.12.2011

Quote:

They are sections, they divide the file up so that you can have multilpe pieces of data associated with each other.

Yeah... I understand. But I'm referring to this:


INI:mine[examples](name[], value[])
{
}

If my file doesn't have "sections"? If I did not create... ? Example:

Код:
Test1 = 1
Test2 = 2
Test3 = 3
sCELLUS = 10
How would the code? Could you give me an example?

Thanks


Re: Y_Ini - Can I do it?! - SuperChock - 14.12.2011

Ok, thank you ******