SA-MP Forums Archive
what the f*ck is wrong here!?!? - 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: what the f*ck is wrong here!?!? (/showthread.php?tid=275486)



what the f*ck is wrong here!?!? - [JnA]DukeNukem - 09.08.2011

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;
}



Re : what the f*ck is wrong here!?!? - Soumi - 09.08.2011

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
}



Re: what the f*ck is wrong here!?!? - MadeMan - 09.08.2011

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



Re: Re : what the f*ck is wrong here!?!? - [JnA]DukeNukem - 09.08.2011

That fixed it... thanks guys + reps


Re : Re: what the f*ck is wrong here!?!? - Soumi - 09.08.2011

nvm.


Re: what the f*ck is wrong here!?!? - MadeMan - 09.08.2011

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?


Re : what the f*ck is wrong here!?!? - Soumi - 09.08.2011

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;
}