SA-MP Forums Archive
Another Y_Ini problem, lol - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Another Y_Ini problem, lol (/showthread.php?tid=215980)



[SOLVED]Y_Ini problem, stats are not loading, help - Mean - 24.01.2011

SOLVED


Re: Another Y_Ini problem, lol - HyperZ - 24.01.2011

Try this: http://pawn.pastebin.com/avXbXdcr

Edit: Not tested.


Re: Another Y_Ini problem, lol - Mean - 24.01.2011

Doesn't work, still the same


Re: Another Y_Ini problem, lol - Mean - 25.01.2011

Bump -.-


Re: Another Y_Ini problem, lol - Mean - 26.01.2011

Bump 2!
Anyone knows an answer?


Re: Another Y_Ini problem, lol - Mean - 26.01.2011

Bump 3!
I really need help with this!


Re: Another Y_Ini problem, lol - Finn - 26.01.2011

How does that even compile without warnings?

pawn Code:
stock LoadStats(playerid, name[], value[])
{
    if(!strcmp(name, "Cash")) GivePlayerMoney(playerid, strval(value));
    if(!strcmp(name, "Score")) SetPlayerScore(playerid, strval(value));
    if(!strcmp(name, "Level")) PInfo[playerid][Level] = strval(value);
    if(!strcmp(name, "Kills")) PInfo[playerid][Kills] = strval(value);
    if(!strcmp(name, "Deaths")) PInfo[playerid][Deaths] = strval(value);
}



Re: Another Y_Ini problem, lol - Mean - 26.01.2011

Doesn't work, maybe I need to use a public instead of stock ?


Re: Another Y_Ini problem, lol - randomkid88 - 26.01.2011

Replace the contents of your LoadStats with this. You probably will have to add Cash and Score to your PInfo enum:
pawn Code:
INI_Int("Cash", PInfo[playerid][Cash]);
GivePlayerMoney(playerid, PInfo[playerid][Cash]);
INI_Int("Score", PInfo[playerid][Score]);
SetPlayerScore(playerid, PInfo[playerid][Score]);
INI_Int("Level", PInfo[playerid][Level]);
INI_Int("Kills", PInfo[playerid][Kills]);
INI_Int("Deaths", PInfo[playerid][Deaths]);



Re: Another Y_Ini problem, lol - Mean - 27.01.2011

Quote:
Originally Posted by randomkid88
View Post
Replace the contents of your LoadStats with this. You probably will have to add Cash and Score to your PInfo enum:
pawn Code:
INI_Int("Cash", PInfo[playerid][Cash]);
GivePlayerMoney(playerid, PInfo[playerid][Cash]);
INI_Int("Score", PInfo[playerid][Score]);
SetPlayerScore(playerid, PInfo[playerid][Score]);
INI_Int("Level", PInfo[playerid][Level]);
INI_Int("Kills", PInfo[playerid][Kills]);
INI_Int("Deaths", PInfo[playerid][Deaths]);
Doesn't work, and I don't think INI_Int function is made for loading, didn't work either as public or stock, I will now test something else..

EDIT: Now I got:
pawn Code:
public LoadStats(playerid, name[], value[])
{
    if(!strcmp(name, "Cash"))
    {
        PInfo[playerid][Cash] = strval(value);
        ResetPlayerMoney(playerid);
        GivePlayerMoney(playerid, PInfo[playerid][Cash]);
    }
    if(!strcmp(name, "Score"))
    {
        PInfo[playerid][Score] = strval(value);
        SetPlayerScore(playerid, PInfo[playerid][Score]);
    }
    if(!strcmp(name, "Level"))
    {
        PInfo[playerid][Level] = strval(value);
    }
    if(!strcmp(name, "Kills"))
    {
        PInfo[playerid][Kills] = strval(value);
    }
    if(!strcmp(name, "Deaths"))
    {
        PInfo[playerid][Deaths] = strval(value);
    }
    return 1;
}
This is loading it:
pawn Code:
INI_ParseFile(file, "LoadStats", false, true, playerid);
What's the problem?


Re: Another Y_Ini problem, lol - randomkid88 - 27.01.2011

INI_Int is made for loading, and its how the system is designed to load things, its the function used to load. And how does it "not work"?


Re: Another Y_Ini problem, lol - Zh3r0 - 27.01.2011

I know this bug and it's annoying.

You need to re-format right before usin INI_Parse.

something like

pawn Код:
format(...);
INI_ParseFile(...);



Re: Another Y_Ini problem, lol - Mean - 28.01.2011

Quote:
Originally Posted by randomkid88
Посмотреть сообщение
INI_Int is made for loading, and its how the system is designed to load things, its the function used to load. And how does it "not work"?
Check Y_Ini topic

@Zh3r0 will try, can't now on my phone


Re: Another Y_Ini problem, lol - Mean - 28.01.2011

Zh3r0, I just found it out, acutally you don't need to use format before parsing, but you can't parse twice somehow.


Re: Another Y_Ini problem, lol - Mean - 28.01.2011

Sorry for the AWFUL double post, I just added some stuff to my enum, used only 1 parse, and it works now!


Re: Another Y_Ini problem, lol - Steven Paul - 28.01.2011

congratz!!!!!!!!!