INI_Int --> filename putting problem
#1

I want to drag some players' stats directly from the .ini file without using their enum. This is what ****** says in his y_ini presentation thread:
Quote:
Originally Posted by ******
Посмотреть сообщение
pawn Код:
INI:filename[tag](name[], value[])
{
    INI_Int("LEVEL", gLevel);
}
But I still can't make it work, I don't know how to place the player's .ini file in the line INI:filename[tag](name[], value[]) and the problem is the filename[tag] thing. To get the players name.ini file I use the well known stock copied from Kush's y_ini reg/log tutorial:
pawn Код:
stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
This is what I did and I know is crap:
pawn Код:
CMD:ytest(playerid, params[])
{
    new sc, str[50], n[200]=UserPath(playerid);
    INI:n[tag](name[], value[]);
    {
    INI_Int("Score", sc);
    }
    format(str, sizeof(str), "sdafsgssgf-->{FF0000}%d", sc);
    SendClientMessage(playerid, -1, str);
    return 1;
}
Reply
#2

help
Reply
#3

pawn Код:
stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
The 'PATH' should be changed according to your script.
e.g /Accounts/%s.ini

Plus as far as I understood from ******'s tutorial, it should be:
pawn Код:
INI:filename[n](name[], value[])
EDIT: Another plus, I'm not so sure as I'm not familiar with YSI but I think you have to open the file first.
Reply
#4

The path is just fine to my needs, leeds directly to the .ini file, that's not my problem. The problem is I can't use the INI_Int function without using the public loaduser_data function which loads the enums with stats values.
Quote:
Originally Posted by zxc1
Посмотреть сообщение
pawn Код:
INI:filename[n](name[], value[])
And what do you mean with this? Try put a real example
Reply
#5

You are right about the UserPath, my mistake.
About the INI:filename the code I gave you is the code you should use according to YSI tutorial.
Reply
#6

help
Reply
#7

Vince help!
Reply
#8

help
Reply
#9

I don't use both. I just want to give directly to a variable the value from a line of .ini file. I use parsefile to full the enums with values but this has nothing to do with this. My problem is this line: INI:name[tag], I don't know what to put in name[tag].
Reply
#10

Believe me I 've spent countless minutes reading exactly these 2 topics. Not to mention I have even bookmarked them.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)