PDA

View Full Version : help in saving/loading player health


danish007
05/02/2015, 11:11 AM
please tell me how can i save and load players health. with .ini file

Ciarannn
05/02/2015, 11:20 AM
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.

danish007
05/02/2015, 12:14 PM
please help me

JuzDoiT
28/08/2016, 07:29 AM
try thissss

enum PlayerInfo
{
Float:savehealth,
Float:savearmor,
}

new pInfo[MAX_PLAYERS][PlayerInfo];


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


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;