Another Y_Ini problem, lol
#1

SOLVED
Reply
#2

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

Edit: Not tested.
Reply
#3

Doesn't work, still the same
Reply
#4

Bump -.-
Reply
#5

Bump 2!
Anyone knows an answer?
Reply
#6

Bump 3!
I really need help with this!
Reply
#7

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);
}
Reply
#8

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

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]);
Reply
#10

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?
Reply
#11

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"?
Reply
#12

I know this bug and it's annoying.

You need to re-format right before usin INI_Parse.

something like

pawn Код:
format(...);
INI_ParseFile(...);
Reply
#13

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
Reply
#14

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

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

congratz!!!!!!!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)