Show HP more than 255 (format)
#1

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 Floathealthstr256+];
GetPlayerHealth(playeridhealth);
formatstrsizeofstr ), "%.0f"health/10);
TextDrawSetString(bla... bla... bla...); 
help me
Reply
#2

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
Reply
#3

It's SA:MP issue
Reply
#4

PHP код:
new Float:health[MAX_PLAYERS];
GetPlayerHealth(playeridhealth[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.
Reply
#5

https://sampwiki.blast.hk/wiki/GetPlayerHealth

lol I know about it, maybe some fix could be?
Reply
#6

Create your own health system?
Reply
#7

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)
Reply
#8

Quote:
Originally Posted by Adain
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/GetPlayerHealth

lol I know about it, maybe some fix could be?
Why would you need to set player health to 255?
Reply
#9

Because gamemode of my server is is not typical rp, rpg. This information enough )
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)