Cannot get player health above 100
#1

I cannot get a player's health that is above 100, I tried getting a player's health that is 350 and it return as 94
Reply
#2

Just use
PHP код:
SetPlayerHealth(playerid50000); 
this should set the HP to 50000.

If this doens't work look in your scripts for any anti-cheats which could block this.
Reply
#3

if they had 350 health then it'd wrap around to 94 because the max it can return is 256, not sure why you'd want to have any player with 350 health
Reply
#4

I need to get a player's health that is more than 100 not setting it

pawn Код:
new Float:Test;
        SetPlayerHealth(playerid, 350);
        GetPlayerHealth(playerid, Test);
        printf("%f", Test);
Код:
Result:
[15:55:08] 94.000000
Edit
I do not use any anti cheats
Reply
#5

cessil, 256? Damnit, I'm making some kind of zm mode, need the health to be 350, why didn't SAMP make it higher
Reply
#6

Depending on what you're trying to do, I'm sure there are others ways to do it.
Reply
#7

Yes, but I'm not going to take the trouble for such small matter and the data might not be accurate too. Anyway, thanks for all the help, everyone, I finally solve the problem I had with SetPlayerHealth for almost a year
Reply
#8

Get his health before setting, else it won't work.
Quote:
Originally Posted by SlonCHL
Посмотреть сообщение
I need to get a player's health that is more than 100 not setting it

pawn Код:
new Float:Test;
    GetPlayerHealth(playerid, Test); // You must first get his health before setting it!
    SetPlayerHealth(playerid, 350);
    printf("%f", Test);
Код:
Result:
[15:55:08] 94.000000
Edit
I do not use any anti cheats
Reply
#9

@Loot you're wrong

pawn Код:
new Float:Test;
        SetPlayerHealth(playerid, 350);
        GetPlayerHealth(playerid, Test);
        printf("%f", Test);
this wouldn't work because SetPlayerHealth isn't instant, it has to sent a message to the client to update, and then the client sets the health, using GetPlayerHealth straight after SetPlayerHealth will just return the last health the client sent to the server
Reply
#10

Quote:
Originally Posted by cessil
Посмотреть сообщение
@Loot you're wrong

pawn Код:
new Float:Test;
        SetPlayerHealth(playerid, 350);
        GetPlayerHealth(playerid, Test);
        printf("%f", Test);
this wouldn't work because SetPlayerHealth isn't instant, it has to sent a message to the client to update, and then the client sets the health, using GetPlayerHealth straight after SetPlayerHealth will just return the last health the client sent to the server
I'm not sure if we are speaking about the same code cessil..
Mine:
pawn Код:
new Float:Test;
    GetPlayerHealth(playerid, Test); // You must first get his health before setting it!
    SetPlayerHealth(playerid, 350);
    printf("%f", Test);
SlonCHL's:
pawn Код:
new Float:Test;
        SetPlayerHealth(playerid, 350);
        GetPlayerHealth(playerid, Test);
        printf("%f", Test);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)