what the f*ck is wrong here!?!?
#1

So i save some stats with Y_Ini, it all works except for health saving, ( it saves some idiotic numbers like Health = 1112276992) ... here's that part in the script...


under #include <samp>

Код:
new Float:SaveHealth[MAX_PLAYERS];
under OnPlayerDisconnect
Код:
GetPlayerHealth(playerid, SaveHealth[playerid]);
INI_WriteFloat(File,"Health",GetPlayerHealth(playerid));
and under OnPlayerSpawn

Код:
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
what am i doing wrong here ?!?! maybe im doing something wrong with the float or something ?
heres my "enum"


Код:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pHealth,
    pDead,
   	pSkin,
   	pTeam,
	pPosx,
	pPosy,
	pPosz
}
also see:

Код:
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Float("Health",PlayerInfo[playerid][pHealth]);
    INI_Int("Skin",PlayerInfo[playerid][pSkin]);
    INI_Int("Team",PlayerInfo[playerid][pTeam]);
    INI_Int("X",PlayerInfo[playerid][pPosx]);
    INI_Int("Y",PlayerInfo[playerid][pPosy]);
    INI_Int("Z",PlayerInfo[playerid][pPosz]);


    return 1;
}
Reply
#2

For health saving u need to use Float: pHealth. witch means

pawn Код:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    Float: pHealth,
    pDead,
    pSkin,
    pTeam,
    pPosx,
    pPosy,
    pPosz
}
Reply
#3

pawn Код:
GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
INI_WriteFloat(File,"Health",PlayerInfo[playerid][pHealth]);
Reply
#4

That fixed it... thanks guys + reps
Reply
#5

nvm.
Reply
#6

Quote:
Originally Posted by [JnA]DukeNukem
Посмотреть сообщение
it all works except for health saving, ( it saves some idiotic numbers like Health = 1112276992)
Quote:
Originally Posted by [JnA]DukeNukem
Посмотреть сообщение
the problems i was having were loading it, but the saving was ok ( e.x. if i had 51 hp, in the .ini file was Health = 51.00000)
Which one is correct then?
Reply
#7

under #include <samp> delete
Код:
new Float:SaveHealth[MAX_PLAYERS];
under OnPlayerDisconnect

Код:
GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
INI_WriteFloat(File,"Health",PlayerInfo[playerid][pHealth]);
and under OnPlayerSpawn (After loading PlayerInfo Of course)

Код:
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
Код:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    Float: pHealth,
    pDead,
    pSkin,
    pTeam,
    pPosx,
    pPosy,
    pPosz
}
And nothing changes here.

Код:
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Float("Health",PlayerInfo[playerid][pHealth]);
    INI_Int("Skin",PlayerInfo[playerid][pSkin]);
    INI_Int("Team",PlayerInfo[playerid][pTeam]);
    INI_Int("X",PlayerInfo[playerid][pPosx]);
    INI_Int("Y",PlayerInfo[playerid][pPosy]);
    INI_Int("Z",PlayerInfo[playerid][pPosz]);


    return 1;
}
Reply


Forum Jump:


Users browsing this thread: