Modifying a value in .ini file using y_ini - 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: Modifying a value in .ini file using y_ini (
/showthread.php?tid=595176)
Modifying a value in .ini file using y_ini -
Sellize - 29.11.2015
So I'm trying to modify this value:
Quote:
[Player's Data]
HouseID = 1
|
to 0.
The code I'm currently using is wrong, the results are this: (in the .ini file)
Quote:
HouseID = 0
[Player's Data]
HouseID = 1
|
It just adds the same variable above the tag, which is not what I want. I want the current value to be adjusted.
How can I do this? Current code:
Код:
new INI:file = INI_Open(offpath); // Correct path for the file
INI_WriteInt(file,"HouseID", 0); // Write the value
INI_Close(file); // close file
FIXED. Check below for the fix
Re: Modifying a value in .ini file using y_ini -
Denying - 29.11.2015
I haven't used Y_INI but I think you need to choose the tag or "key". Which is "Player's Data" in this case.
Re: Modifying a value in .ini file using y_ini -
Sellize - 29.11.2015
Correct, it was an easy fix. Should've known... Thanks!
PHP код:
new INI:file = INI_Open(Path(owner));
INI_SetTag(file,"Player's Data");
INI_WriteInt(file,"HouseID",pInfo[playerid][HouseID]);
INI_Close(file);
Re: Modifying a value in .ini file using y_ini -
Denying - 29.11.2015
Glad I could help.