SA-MP Forums Archive
How To Load Ini File { 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: How To Load Ini File { Y_INI } (/showthread.php?tid=601232)



How To Load Ini File { Y_INI } - ratxrat - 18.02.2016

i have problem again , always problem hahahaha.

i create load file ini . this my code
PHP код:
forward  LoadInventory(playeridname[], value[]);
public 
LoadInventory(playeridname[], value[])
{
    
INI_Int("invSlot",pInventory[playerid][invSlot]);
    
INI_Int("invSelectedSlot"pInventory[playerid][invSelectedSlot]);
    
INI_Int("invSlotAmount"pInventory[playerid][invSlotAmount]);
    
INI_Float("invArmourStatus",pInventory[playerid][invArmourStatus]);
    
INI_Int("slot1"pCharacter[playerid][charSlot][0]);
    
INI_Int("slot2"pCharacter[playerid][charSlot][1]);
    
INI_Int("slot3"pCharacter[playerid][charSlot][2]);
    
INI_Int("slot4"pCharacter[playerid][charSlot][3]);
    
INI_Int("slot5"pCharacter[playerid][charSlot][4]);
    
INI_Int("slot6"pCharacter[playerid][charSlot][5]);
    
INI_Int("slot7"pCharacter[playerid][charSlot][6]);
    
INI_Int("charSelectedSlot"pCharacter[playerid][charSelectedSlot]);
    
INI_Float("charArmourStatus",pCharacter[playerid][charArmourStatus]);
    
INI_Int("s1",pInventory[playerid][invSlotAmount][0]);
    
INI_Int("s2",pInventory[playerid][invSlotAmount][1]);
    
INI_Int("s3",pInventory[playerid][invSlotAmount][2]);
    
INI_Int("s4",pInventory[playerid][invSlotAmount][3]);
    
INI_Int("s5",pInventory[playerid][invSlotAmount][4]);
    
INI_Int("s6",pInventory[playerid][invSlotAmount][5]);
    
INI_Int("s7",pInventory[playerid][invSlotAmount][6]);
    
INI_Int("s8",pInventory[playerid][invSlotAmount][7]);
    
INI_Int("s9",pInventory[playerid][invSlotAmount][8]);
    
INI_Int("s10",pInventory[playerid][invSlotAmount][9]);
    
INI_Int("s11",pInventory[playerid][invSlotAmount][10]);
    
INI_Int("s12",pInventory[playerid][invSlotAmount][11]);
    
INI_Int("s13",pInventory[playerid][invSlotAmount][12]);
    
INI_Int("s14",pInventory[playerid][invSlotAmount][13]);
    
INI_Int("s15",pInventory[playerid][invSlotAmount][14]);
    print (
"data iventory berhasil di load");
    return 
1;

im try use timer not work , "data iventory berhasil di load" not show on console . then im use this metode

onplayerconnect
PHP код:
new str[40];
    
format(strsizeof(str), korong); // korong #define dir .ini fle on top
    
INI_ParseFile(str"LoadInventory", .bExtra true); 
but still cannot load file. any one can help me ??


Re: How To Load Ini File { Y_INI } - zPain - 18.02.2016

This might solve your problem.

PHP код:
INI_ParseFile(str"LoadInventory", .bExtra true, .extra playerid); 
I've never used y_ini but I believe it's the correct usage.


Re: How To Load Ini File { Y_INI } - ratxrat - 18.02.2016

i will try this code dude


Re: How To Load Ini File { Y_INI } - ratxrat - 18.02.2016

still not load dude


Re: How To Load Ini File { Y_INI } - Joron - 18.02.2016

Quote:
Originally Posted by zPain
Посмотреть сообщение
This might solve your problem.

PHP код:
INI_ParseFile(str"LoadInventory", .bExtra true, .extra playerid); 
I've never used y_ini but I believe it's the correct usage.
But this is right the way you did it
Quote:

INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);

Example.

So am guessing try..
Quote:

INI_ParseFile(UserPath(playerid), "LoadInventory_%s", .bExtra = true, .extra = playerid);

Or
Quote:

INI_ParseFile(UserPath(playerid), "LoadInventory", .bExtra = true, .extra = playerid);




Re: How To Load Ini File { Y_INI } - ratxrat - 18.02.2016

i will try .
PHP код:
INI_ParseFile(UserPath(playerid), "LoadInventory_%s", .bExtra true, .extra playerid); 
oh if use "UserPath" i cange
Код:
#define korong inidir/%s.ini
to
Код:
 #define PATH INIdir/%s.ini



Re: How To Load Ini File { Y_INI } - zPain - 18.02.2016

This should settle things up.

PHP код:
#define korong "inidir/%s.ini"
// OnPlayerConnect
new str[64];
GetPlayerName(playeridstrMAX_PLAYER_NAME);
format(strsizeof(str), korongstr); // korong #define dir .ini fle on top 
INI_ParseFile(str"LoadInventory", .bExtra true, .extra playerid); 



Re: How To Load Ini File { Y_INI } - Joron - 18.02.2016

Edit:Admin,feel free to delete this.


Re: How To Load Ini File { Y_INI } - Joron - 18.02.2016

Quote:
Originally Posted by ratxrat
Посмотреть сообщение
i will try .
PHP код:
INI_ParseFile(UserPath(playerid), "LoadInventory_%s", .bExtra true, .extra playerid); 
oh if use "UserPath" i cange
Код:
#define korong inidir/%s.ini
to
Код:
 #define PATH INIdir/%s.ini
Sorry for double post didnt see this edit..
But yeah..


Re: How To Load Ini File { Y_INI } - zPain - 18.02.2016

PHP код:
#define korong inidir/%s.ini 
By doing

PHP код:
format(strsizeof(str), korong); // korong #define dir .ini fle on top 
INI_ParseFile(str"LoadInventory", .bExtra true); 
he is actually trying to parse an inexistent file, since he never specifies what the placeholder %s is. I believe my previous post will settle things up.