SA-MP Forums Archive
help in saving/loading player health - 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)
+--- Thread: help in saving/loading player health (/showthread.php?tid=561824)



help in saving/loading player health - danish007 - 05.02.2015

please tell me how can i save and load players health. with .ini file


Re: help in saving/loading player health - Ciarannn - 05.02.2015

Quote:
Originally Posted by danish007
Посмотреть сообщение
please tell me how can i save and load players health. with .ini file
You already have thread for this. There is absolutely no need to create another.


Re: help in saving/loading player health - danish007 - 05.02.2015

please help me


Re: help in saving/loading player health - JuzDoiT - 28.08.2016

try thissss

Quote:

enum PlayerInfo
{
Floatavehealth,
Floatavearmor,
}

new pInfo[MAX_PLAYERS][PlayerInfo];

Quote:

forward loadaccount_user(playerid, name[], value[]);
public loadaccount_user(playerid, name[], value[])
{
INI_Float("savehealth",pInfo[playerid][savehealth]);
INI_Float("savearmor",pInfo[playerid][savearmor]);
return 1;
}

Quote:

public OnPlayerDisconnect(playerid, reason)
{
GetPlayerHealth(playerid, pInfo[playerid][savehealth]);
GetPlayerArmour(playerid, pInfo[playerid][savearmor]);

new INI:file = INI_Open(Path(playerid));
INI_SetTag(file,"Player Information");
INI_WriteFloat(file,"savehealth",pInfo[playerid][savehealth]);
INI_WriteFloat(file,"savearmor",pInfo[playerid][savearmor]);
INI_Close(file);
return 1;
}
pInfo[playerid][savehealth]=0;
pInfo[playerid][savearmor]=0;