Show HP more than 255 (format) -
Adain - 27.11.2017
Beforehand sorry for my eng.
Hello everybody!
I need your help! So I've created for example new textdraw, and if I set up player health 255 it shows me 255, but when I set up 256 it shows me 1 (2 means - 257, 3 - 258 etc.) How can I get this more hp by using format? Maybe smth. like that
PHP код:
new Float: health, str[ 256+1 ];
GetPlayerHealth(playerid, health);
format( str, sizeof( str ), "%.0f", health/10);
TextDrawSetString(bla... bla... bla...);
help me
Re: Show HP more than 255 (format) -
Meller - 27.11.2017
Quote:
Even though the health can be set to near infinite values on the server side, the individual clients will only report values up to 255. Anything higher will wrap around; 256 becomes 0, 257 becomes 1, etc.
|
https://sampwiki.blast.hk/wiki/GetPlayerHealth
Re: Show HP more than 255 (format) -
Lucases - 27.11.2017
It's SA:MP issue
Re: Show HP more than 255 (format) -
rfr - 27.11.2017
PHP код:
new Float:health[MAX_PLAYERS];
GetPlayerHealth(playerid, health[playerid]);
//format
//textdraw
Quote:
*Even though the health can be set to near infinite values on the server side, the individual clients will only report values up to 255. Anything higher will wrap around; 256 becomes 0, 257 becomes 1, etc.
|
Refer to the SA-MP Wiki:
https://sampwiki.blast.hk/wiki/GetPlayerHealth
There's a large red box, you should read that.
Re: Show HP more than 255 (format) -
Adain - 27.11.2017
https://sampwiki.blast.hk/wiki/GetPlayerHealth
lol I know about it, maybe some fix could be?
Re: Show HP more than 255 (format) -
rfr - 27.11.2017
Create your own health system?
Re: Show HP more than 255 (format) -
Adain - 27.11.2017
No just get player health and put it in textdraw, but i can't (for instance I want 1000 hp, but it cant be shown, because of samp issue with 256 and more)
Re: Show HP more than 255 (format) -
Lucases - 27.11.2017
Quote:
Originally Posted by Adain
|
Why would you need to set player health to 255?
Re: Show HP more than 255 (format) -
Adain - 27.11.2017
Because gamemode of my server is is not typical rp, rpg. This information enough )
Re: Show HP more than 255 (format) -
Lucases - 27.11.2017
Use server sided health then.
pawn Код:
new PlayerHealth[MAX_PLAYERS];
stock SetPlayerHealthAdv(playerid, Float:health)
{
SetPlayerHealth(playerid, health);
PlayerHealth[playerid] = health;
}
Under OnPlayerConnect
pawn Код:
PlayerHealth[playerid] = 0;
Under OnPlayerTakeDamage
pawn Код:
PlayerHealth[playerid] -= amount;
Finish it, I know you can script