SA-MP Forums Archive
[Y_INI] Variable loading troubles - 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] Variable loading troubles (/showthread.php?tid=475748)



[Y_INI] Variable loading troubles - Riwerry - 14.11.2013

Hello guys, please how I can make line, which is saved by INI_WriteInt function to variable? Becouse I need to get variable for that, becouse I want to load from the .ini with function INI_Int. My current lines:

Here are my variables in enum for example:
pawn Код:
enum wWeaponInfo
{
    wCarSlot1Weapon, //VARIABLE FOR WEAPON
    wCarSlot1Ammo //VARIABLE fOR AMMO
}

new WeaponInfo[MAX_PLAYERS][wWeaponInfo];

{
new INI:File = INI_Open (Path (playerid));
INI_WriteInt (File, "Slot1Weapon", GetPlayerWeapon (playerid)); //I NEED TO MAKE VARIABLE LOAD THIS FUNCTION
INI_WriteInt (File, "Slot1Ammo", GetPlayerAmmo (playerid));  //I NEED TO MAKE VARIABLE LOAD THIS FUNCTION
INI_Close (File);
SendClientMessage (playerid, -1, "You have successfully saved your gun to slot 1!");
}



Re: [Y_INI] Variable loading troubles - Kimossab - 14.11.2013

https://sampwiki.blast.hk/wiki/YSI:INI#b...g_.3D_false.29

Basically you need to create a public function for loading from a file with y_ini. Then use INI_ParseFile for calling that function.

It's explained in that link above ^