05.02.2015, 11:11
please tell me how can i save and load players health. with .ini file
enum PlayerInfo { Floatavehealth, Floatavearmor, } 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; |