2 Issues after Logging -
Mobtiesgangsa - 17.04.2018
The problem to this Bug is i register perfect it stores my HP 100 when /relog HP is saved but there is 1 problem if i fell in ground trying to relog again HP loads as 0HP not as
Exaplme my hp was 100.0 and decressed to 94.6 lets say it doesnt saves 94.6HP it hits 0
Quote:
[PlayerData]
IP = 192.168.2.3
Password = 87080FA830CE1AB39F51A78DCE5D0F325300C6E77CB42A3D61 D38E049CF650E0D37B72B6C292D6072ECF944860646F1A4206 7E1FD1872056F738AC67689FDDE6
Armour = 0.000000
Health = 0.000000
Angle = 0.000000
Z = 63.564025
Y = -2018.722900
X = 1228.179931
Money = 15000
Skin = 47
|
here is my ini file
Re: 2 Issues after Logging -
ProScripter - 17.04.2018
Quote:
Originally Posted by Mobtiesgangsa
The problem to this Bug is i register perfect it stores my HP 100 when /relog HP is saved but there is 1 problem if i fell in ground trying to relog again HP loads as 0HP not as
Exaplme my hp was 100.0 and decressed to 94.6 lets say it doesnt saves 94.6HP it hits 0
here is my ini file
|
make timer which will check health after few seconds and save it in your ini file ok.
Re: 2 Issues after Logging -
JesterlJoker - 17.04.2018
Quote:
Originally Posted by ProScripter
make timer which will check health after few seconds and save it in your ini file ok.
|
He already said that it saves to 0, doing that would just do the same thing. look at his ini file.
First of all too answer your vague problem, a small snippet would have been good
PHP код:
GetPlayerHP(playerid){
new Float: hp;
GetPlayerHealth(playerid, hp); //fixed mistype
return hp;
}
I use this small snippet when getting HP, after getting HP, I do a save such as
PHP код:
SaveData(playerid){
new string[15+MAX_USERNAME];
format(string, sizeof string, "Accounts/%s.ini", PlayerData[playerid][username]);
new INI:File = INI_Open(string);
INI_SetTag(File, "Information");
INI_WriteFloat(File, "Health", GetPlayerHP(playerid));
INI_Close(File);
return 1;
}
Then that's a small snippet when I saved, assuming that you are doing it that way... Which is actually wrong.
The Player's HP is an integer and not a float, if you are saving an integer into a float then it will go into an error by saving 0.000
PHP код:
SaveData(playerid){
new string[15+MAX_USERNAME];
format(string, sizeof string, "Accounts/%s.ini", PlayerData[playerid][username]);
new INI:File = INI_Open(string);
INI_SetTag(File, "Information");
INI_WriteFloat(File, "Health", float(GetPlayerHP(playerid))); // Which is slow but I'll use this for education purposes
INI_Close(File);
return 1;
}
that snippet above would do the job, if it doesn't then there should be something wrong in your code somewhere. Like you empty a data accidently and save it along the others.
EDIT: Sorry there was a mistype, Thanks @StrikerZ
Re: 2 Issues after Logging -
StrikerZ - 17.04.2018
PHP код:
GetPlayerHP(playerid){
new Float: hp;
GetPlayerHP(playerid, hp); // This
return hp;
}
The line I marked should be
GetPlayerHealth(playerid, hp);
Re: 2 Issues after Logging -
Mobtiesgangsa - 18.04.2018
Well i humbly apologize i try'd your methods it didn't work all i went wrong is my enumerator and a native func
called GetPlayerHealth
i tought it was just GetPlayerHealth(playerid, /* i forgot to sign the enumerator here */ PlayerInfo[playerid][pHealth]); on playerdisconnect that is all
Re: 2 Issues after Logging -
JesterlJoker - 18.04.2018
Quote:
Originally Posted by Mobtiesgangsa
Well i humbly apologize i try'd your methods it didn't work all i went wrong is my enumerator and a native func
called GetPlayerHealth
i tought it was just GetPlayerHealth(playerid, /* i forgot to sign the enumerator here */ PlayerInfo[playerid][pHealth]); on playerdisconnect that is all
|
Good to know that you solved it
Just next time though, show us a little code snippet, just a small one to show us how your code works and so most of us can sort it out, that's only two of us tried to help since no one would help you if you don't show us any information on how things work on your server.
Best wishes bruh.