Health and Armour? (Y_INI) -
Reklez - 04.04.2012
when i saving players health and armour i keep getting these
code
pawn Код:
enum PlayerInfo
{
Float:Health,
Float:Armour
};
new pInfo[MAX_PLAYERS][pInfo];
new Float:hp, Float:armour;
pInfo[playerid][Health] = GetPlayerHealth(playerid, hp);
pInfo[playerid][Armour] = GetPlayerArmour(playerid, armour);
INI_WriteFloat(iFile, "Health", pInfo[playerid][Health]);
INI_WriteFloat(iFile, "Armour", pInfo[playerid][Armour]);
and one question should this work?
pawn Код:
//OnPlayerSpawn
SetPlayerHealth(playerid, pInfo[playerid][Health]);
SetPlayerArmour(playerid, pInfo[playerid][Armour]);
Re: Health and Armour? (Y_INI) -
eesh - 04.04.2012
pawn Код:
enum PlayerInfo
{
Float:Health,
Float:Armour
};
new pInfo[MAX_PLAYERS][pInfo];
new Float:hp, Float:armour;
GetPlayerHealth(playerid, hp)
pInfo[playerid][Health] = hp;
GetPlayerArmour(playerid, armour);
pInfo[playerid][Armour] = armour;
INI_WriteFloat(iFile, "Health", pInfo[playerid][Health]);
INI_WriteFloat(iFile, "Armour", pInfo[playerid][Armour]);
Re: Health and Armour? (Y_INI) -
Reklez - 04.04.2012
now here is the result
is this normal or not? and why when i spawn i died (Seriously i don't know what i'm doing with my Health and Armour Saving func)
Re: Health and Armour? (Y_INI) -
eesh - 04.04.2012
I guess thats because your health was 0 since it wasnt saved. Change the value to 100 in the save data
Re: Health and Armour? (Y_INI) -
Reklez - 04.04.2012
well actually i did 100.0000 but still it keeps repeating onplayerspawn
Re: Health and Armour? (Y_INI) -
Harish - 04.04.2012
dude you made mistake
pawn Код:
enum PlayerInfo
{
Float:Health,
Float:Armour
};
new pInfo[MAX_PLAYERS][PlayerInfo];//check this line you placed as "new pInfo[MAX_PLAYERS][pInfo];"
Re: Health and Armour? (Y_INI) -
Reklez - 04.04.2012
Totally i just type the code with my hands instead of copying and pasting here.
the original one is
pawn Код:
new pInfo[MAX_PLAYERS][PlayerInfo];
its just a typo
Re: Health and Armour? (Y_INI) -
Harish - 04.04.2012
try finding the solution by placing
pawn Код:
//OnPlayerDisconnect
printf("Player Health :%f",GetPlayerHealth(playerid));
printf("Saved Health :%f",pInfo[playerid][Health]);
Re: Health and Armour? (Y_INI) -
[ABK]Antonio - 04.04.2012
Quote:
Originally Posted by eesh
pawn Код:
enum PlayerInfo { Float:Health, Float:Armour }; new pInfo[MAX_PLAYERS][pInfo];
new Float:hp, Float:armour; GetPlayerHealth(playerid, hp) pInfo[playerid][Health] = hp; GetPlayerArmour(playerid, armour); pInfo[playerid][Armour] = armour; INI_WriteFloat(iFile, "Health", pInfo[playerid][Health]); INI_WriteFloat(iFile, "Armour", pInfo[playerid][Armour]);
|
pawn Код:
GetPlayerHealth(playerid, pInfo[playerid][Health]); //don't know why both of you created useless vars...
GetPlayerArmour(playerid, pInfo[playerid][Armour]);
INI_WriteFloat(iFile, "Health", pInfo[playerid][Health]);
INI_WriteFloat(iFile, "Armour", pInfo[playerid][Armour]);
Re: Health and Armour? (Y_INI) -
Hayden_Almeida - 04.11.2015
Quote:
Originally Posted by eesh
pawn Код:
enum PlayerInfo { Float:Health, Float:Armour }; new pInfo[MAX_PLAYERS][pInfo];
new Float:hp, Float:armour; GetPlayerHealth(playerid, hp) pInfo[playerid][Health] = hp; GetPlayerArmour(playerid, armour); pInfo[playerid][Armour] = armour; INI_WriteFloat(iFile, "Health", pInfo[playerid][Health]); INI_WriteFloat(iFile, "Armour", pInfo[playerid][Armour]);
|
It works for me! Thanks