SA-MP Forums Archive
Health saving (Dini) - 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: Health saving (Dini) (/showthread.php?tid=238228)



Health saving (Dini) - sim_sima - 11.03.2011

Hello everyone.
I made a gamemode with login/register system using Dini.
I want it to save the health of the player.
I did like this:
This is from the "OnPlayerDisconnect" -callback:
pawn Код:
if(dini_Exists(file))
        {
            PlayerInfo[playerid][pMoney] = GetPlayerMoney(playerid);
            PlayerInfo[playerid][pActivity] = GetPlayerScore(playerid);
            new Float:health;
            PlayerInfo[playerid][pHealth] = GetPlayerHealth(playerid,health);
            dini_IntSet(file, "Money",PlayerInfo[playerid][pMoney]);
            dini_IntSet(file, "Health",PlayerInfo[playerid][pHealth]);
            dini_IntSet(file, "Activity",PlayerInfo[playerid][pActivity]);
            dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
            dini_IntSet(file, "Banned",PlayerInfo[playerid][pBanned]);
        }
But it doesnt work.
When i disconnect, it just sets "Health=1" in the ini file.
Any ideas? Thanks.


Re: Health saving (Dini) - xir - 11.03.2011

Try using

pawn Код:
dini_FloatSet
Instead of dini_IntSet


Re: Health saving (Dini) - sim_sima - 11.03.2011

Ok. Ill try that


Re: Health saving (Dini) - sim_sima - 11.03.2011

Well, it changed something, but still doesnt work. Any other ideas?


Re: Health saving (Dini) - sim_sima - 11.03.2011

Now it just sets "Health=1.000000" the same as "Health=1".


Re: Health saving (Dini) - sim_sima - 11.03.2011

No other ideas?


Re: Health saving (Dini) - xir - 11.03.2011

Try this.

OnPlayerDisconnect

pawn Код:
dini_IntSet(file,"Health",floatround(GetPlayerHealth(playerid));
OnplayerSpawn

pawn Код:
SetPlayerHealth(playerid,dini_Int(file,"Health"));



Re: Health saving (Dini) - XFlawless - 11.03.2011

Quote:
Originally Posted by xir
Посмотреть сообщение
Try this.

OnPlayerDisconnect

pawn Код:
dini_IntSet(file,"Health",floatround(GetPlayerHealth(playerid));
OnplayerSpawn

pawn Код:
SetPlayerHealth(playerid,dini_Int(file,"Health"));
Health is a Float.


Re: Health saving (Dini) - sim_sima - 11.03.2011

ok, ill try that


Re: Health saving (Dini) - xir - 11.03.2011

yes sorry, replace it with dini_FloatSet as i said above