Health above 256
#1

Hello,
Is there a way to know if the player has a health of like 4000? GetPlayerHealth gives me like health mod 256. =/
Reply
#2

Why you don't make the max. amount of health is 100?

Like
Код:
new Float:health;
if(GetPlayerHealth(playerid,health) > 100
{
// kick or whatever
}
Reply
#3

The health needs to be 2000-9000, the question is if it's possible to read the current health.
My idea is to check whenever the health goes up and remove 256 from the display value (well sorta, you get what I mean). But that will prolly not be accurate.
Reply
#4

Код:
if(strcmp("/health", cmd, true) == 0)
{
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_MAIN, "Type /health <ID>");
if(IsPlayerConnected(strval(tmp)) == 0) return SendClientMessage(playerid, COLOR_MAIN, "Enter a valid player ID!");
new player = strval(tmp);
new pname[MAX_PLAYER_NAME];
GetPlayerName(player, pname, sizeof(pname));
new string[256];
format(string, sizeof(string), "%s's health amount is %d!", pname, GetPlayerHealth(playerid));
SendClientMessage(playerid, COLOR_GREEN, string);
return 1;
}
Reply
#5

If you use that command when the health is 1523 for example, then it shows 243. THAT'S my problem.
Reply
#6

Quote:
Originally Posted by Oscar4Life
If you use that command when the health is 1523 for example, then it shows 243. THAT'S my problem.
Ahh ok, now I understood.
Hmm, then I can't help you.
But why do you need to check a health above 200 for example?
Reply
#7

It's maxxed to 255..And you can do nothing against that.
Reply
#8

First I'm setting it to 4000, then checking until it reaches 0. Well that's how it's supposed to work.
Reply
#9

Quote:
Originally Posted by Seif_
Quote:
Originally Posted by Serbish
Код:
if(strcmp("/health", cmd, true) == 0)
{
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_MAIN, "Type /health <ID>");
if(IsPlayerConnected(strval(tmp)) == 0) return SendClientMessage(playerid, COLOR_MAIN, "Enter a valid player ID!");
new player = strval(tmp);
new pname[MAX_PLAYER_NAME];
GetPlayerName(player, pname, sizeof(pname));
new string[256];
format(string, sizeof(string), "%s's health amount is %d!", pname, GetPlayerHealth(playerid));
SendClientMessage(playerid, COLOR_GREEN, string);
return 1;
}
You should at least give him a working code... indented.

Are you just doing that for a check or are you setting it to 4000 and then checking using GetPlayerHealth? If so, just store the value of the health you set in a variable.
You need glasses or why this code isn't working?
Reply
#10

tried this.
pawn Код:
new Float:health[MAX_PLAYERS];

stock SetPlayerHealthEx(playerid, Float:amount)
{
  health[playerid] = amount;
  SetPlayerHealth(playerid,health[playerid]);
  return health[playerid];
}
and this
pawn Код:
stock GetPlayerHealthEx(playerid, &Float:amount)
{
      return health[playerid];
}
but GetPlayerHealthEx always returns 0.00 and there are tag mismatch warnings after compile

what's wrong here?

i've done some SetPlayerHealthEx-s before GetPlayerHealthEx...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)