Health saving (Dini)
#1

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.
Reply
#2

Try using

pawn Код:
dini_FloatSet
Instead of dini_IntSet
Reply
#3

Ok. Ill try that
Reply
#4

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

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

No other ideas?
Reply
#7

Try this.

OnPlayerDisconnect

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

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

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.
Reply
#9

ok, ill try that
Reply
#10

yes sorry, replace it with dini_FloatSet as i said above
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)