SA-MP Forums Archive
Cannot get player health above 100 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Cannot get player health above 100 (/showthread.php?tid=478136)



Cannot get player health above 100 - SlonCHL - 28.11.2013

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


Re: Cannot get player health above 100 - ikbenremco - 28.11.2013

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.


Re: Cannot get player health above 100 - cessil - 28.11.2013

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


Re: Cannot get player health above 100 - SlonCHL - 28.11.2013

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


Re: Cannot get player health above 100 - SlonCHL - 28.11.2013

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


Re: Cannot get player health above 100 - DaRk_RaiN - 28.11.2013

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


Re: Cannot get player health above 100 - SlonCHL - 28.11.2013

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


Re: Cannot get player health above 100 - Loot - 28.11.2013

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



Re: Cannot get player health above 100 - cessil - 28.11.2013

@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


Re: Cannot get player health above 100 - Loot - 28.11.2013

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);