Vice City: Multiplayer

VC:MP Discussion => Support => Bugs and Crashes => Topic started by: ℛḝξ☂ on Sep 08, 2021, 04:32 AM

Title: Client side player.Health always returns 100
Post by: ℛḝξ☂ on Sep 08, 2021, 04:32 AM
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
-
Title: Re: Client side player.Health always returns 100
Post by: DizzasTeR on Sep 08, 2021, 07: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)
Title: Re: Client side player.Health always returns 100
Post by: ℛḝξ☂ on Sep 09, 2021, 01:49 AM
Quote from: DizzasTeR on Sep 08, 2021, 07:44 AMThings 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
Title: Re: Client side player.Health always returns 100
Post by: DizzasTeR on Sep 10, 2021, 06:29 AM
Quote from: ℛḝξ☂ on Sep 09, 2021, 01:49 AM
Quote from: DizzasTeR on Sep 08, 2021, 07:44 AMThings 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.
Title: Re: Client side player.Health always returns 100
Post by: ℛḝξ☂ on Sep 10, 2021, 08:26 AM
Quote from: DizzasTeR on Sep 10, 2021, 06:29 AMHmm, 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
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 Sep 10, 2021, 06:29 AMthat 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).
Title: Re: Client side player.Health always returns 100
Post by: habi on Apr 09, 2022, 08:09 AM
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.