Client side player.Health always returns 100

ℛḝξ☂

  • Full Member
  • Posts: 107
Client side player.Health always returns 100
«  »Last edited
Description
When I get the health of other player (the local one works)it returns 100
Example:
me -  A
the other player - B
client side: Console.Print( World.FindPlayer( B.ID ).Health )
it always returns 100(returns 0 when the player is dying)

Reproducible
Always

What you were doing when the bug happened
Hitting the player B, B's health decreases, but client side still returns 100

What you think caused the bug
-
I may be a slow walker but I am always walking.

DizzasTeR

  • VC:MP Beta Tester
  • Infinite loops defy infinity by overflowing memory
  • Posts: 1,209
Re: Client side player.Health always returns 100
« Reply #1,  »
Things work different on client side, if the player is not streamed in then his health will return 0 regardless of his actual health. Client side health for other players will only report properly when the player is streamed in to the local player (He is close enough for his packets to be received by the local player)

ℛḝξ☂

  • Full Member
  • Posts: 107
Re: Client side player.Health always returns 100
« Reply #2,  »
Quote from DizzasTeR on September 8th, 2021, 08:44 AM
Things work different on client side, if the player is not streamed in then his health will return 0 regardless of his actual health. Client side health for other players will only report properly when the player is streamed in to the local player (He is close enough for his packets to be received by the local player)
Hi, thank you for helping. I think during my test the two players are close enough to be streamed by each other, because as soon as their health are changed to 0, it returns 0(which is correct)
However no matter how close the players are, it only returns 100 forever if their actual health is more than 0
I may be a slow walker but I am always walking.

DizzasTeR

  • VC:MP Beta Tester
  • Infinite loops defy infinity by overflowing memory
  • Posts: 1,209
Re: Client side player.Health always returns 100
« Reply #3,  »
Quote from ℛḝξ☂ on September 9th, 2021, 02:49 AM
Quote from DizzasTeR on September 8th, 2021, 08:44 AM
Things work different on client side, if the player is not streamed in then his health will return 0 regardless of his actual health. Client side health for other players will only report properly when the player is streamed in to the local player (He is close enough for his packets to be received by the local player)
Hi, thank you for helping. I think during my test the two players are close enough to be streamed by each other, because as soon as their health are changed to 0, it returns 0(which is correct)
However no matter how close the players are, it only returns 100 forever if their actual health is more than 0
Hmm, could you record a demonstration, that seems like a bug that I should've seen because my custom scoreboard in EG A/D relies on client-side .Health as I don't send sync packets from server to sync health of players.

ℛḝξ☂

  • Full Member
  • Posts: 107
Re: Client side player.Health always returns 100
« Reply #4,  »Last edited
Quote from DizzasTeR on September 10th, 2021, 07:29 AM
Hmm, could you record a demonstration
I'm sorry to say that it's inconvenient for me to upload a video to youtube. But you can try this code
Code: [Select]
function Script::ScriptProcess()
{
    local i, plr, name = "jack";
for( i = 0; i < 99; i ++ )
{
    plr = World.FindPlayer( i );
if( plr )
{
if ( plr.Name == name )
Console.Print( name + "'s Health: " + plr.Health );
}
}
}
And join with one random nick & one "jack" then change "jack"'s health
Quote from DizzasTeR on September 10th, 2021, 07:29 AM
that seems like a bug that I should've seen because my custom scoreboard in EG A/D relies on client-side .Health as I don't send sync packets from server to sync health of players.
Did <client-side .Health> work correctly on your server? I want to make one custom nicktags/healthbar and due to this bug I have to send sync packets(the exact health and the respective player) to client every 1 second(or less).
I may be a slow walker but I am always walking.

habi

  • Sr. Member
  • Posts: 389
Re: Client side player.Health always returns 100
« Reply #5,  »
Sorry for bumping. I would like to define
'close enough' or player stream in distance here.
Do you know the ammunation and police station in downtown?
One player is below the 'staircase' near ammunation in downtown district.( the staircase used to stunt jump pcj 600 into the roof of ammunation)
To be close enough the other player must be at a location upto the police station downtown.