Reading integer from file with Dini returns wrong or null value
#1

Hello, I have made a gamemode, it's basically completed but I have this bug. When the player logins, his data is supposed to load off a file and send a message saying his stastistics.

pawn Код:
// We set the PVar.
SetPVarInt(playerid, "Hunts", dini_Int(szRoot, "Hunts"));
SetPVarInt(playerid, "Hunted", dini_Int(szRoot, "Hunted"));
SetPVarInt(playerid, "Admin", dini_Int(szRoot, "Admin"));
SetPVarInt(playerid, "Money", dini_Int(szRoot, "Money"));
SetPVarInt(playerid, "Score", dini_Int(szRoot, "Score"));
SetPVarInt(playerid, "Skin", dini_Int(szRoot, "Skin"));
SetPVarInt(playerid, "Premium", dini_Int(szRoot, "Premium"));
SetPVarInt(playerid, "Muted", dini_Int(szRoot, "Muted"));
SetPVarInt(playerid, "Locked", dini_Int(szRoot, "Locked"));
pawn Код:
// But when it shows the message:
Welcome, Admantis, your admin level is 0, your money is $73, and your score is 0.
Where 73 is totally random value that is irrevelant.

Any help? Thanks !
Reply
#2

Try IntSet because where dini_Int is, there should be a value there (meaning that you are setting the var to the value). If IntSet does not work try the GetPVar thingy (the one that you would use to get the PVar); I am not good at PVars, but why not use regular vars?

With normal vars it would look like:

pawn Код:
PlayerData[playerid][Hunts] = dini_Int(szRoot,"Hunts");
Assuming 'PlayerData' would be the variable that the enum is stored in.
Reply
#3

Whats my code meant to do is to set the PVar.I already have wroten it all with PVars, to make it with a enum would require to re-write the whole script and to probably not even work.
Reply
#4

It would work because that is how my script is written, and it's how I save and load files.

Look if you formatted the direction correctly because according to this (Click here), your code seems ok.
Reply
#5

I will give it a try..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)