SA-MP Forums Archive
Infinity vehicle health bug (between players). - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: Infinity vehicle health bug (between players). (/showthread.php?tid=623285)



Infinity vehicle health bug (between players). - Swedky - 30.11.2016

So when I set my vehicle health to infinity (-0.0 or 0x7F800000), other player will see to me and my vehicle as dead.
And without matters if I'm moving or not, he will be seeing me like I'm just there in the same spot where I died.


Re: Infinity vehicle health bug (between players). - AmigaBlizzard - 30.11.2016

Infinity isn't -0.0.
-0.0 is exactly the same as 0.0. GTA will see anything at 0.0 or lower as dead (-0.0 could as well be -0.000000001 due to rounding errors).

If you draw a line and put numbers above it, ranging from -20.0 to +20.0, you'll see that -0.0 and 0.0 overlap.

... -5 -4 -3 -2 -1 0 1 2 3 4 5 ...

Like this.
Also, 0x7F800000 isn't the highest value and certainly isn't the same as -0.0.
The highest value for a 32-bit signed integer is 0x7FFFFFFF, which is the same as 2147483647.
If you add 1 to that value, it will flip negative to 0x80000000 (or -2147483648 ).

Just set it to some high value (like 1000000 or so), you can't reach infinity with binary values anyways.


Re: Infinity vehicle health bug (between players). - Vince - 30.11.2016

Quote:
Originally Posted by AmigaBlizzard
Посмотреть сообщение
Also, 0x7F800000 isn't the highest value and certainly isn't the same as -0.0.
The highest value for a 32-bit signed integer is 0x7FFFFFFF, which is the same as 2147483647.
If you add 1 to that value, it will flip negative to 0x80000000 (or -2147483648 ).

Just set it to some high value (like 1000000 or so), you can't reach infinity with binary values anyways.
If we would be talking about integers then you would be correct. But floating point values don't work like that. 0x7F800000 is actually defined as "infinity" in the IEEE 754 standard. See: https://www.h-schmidt.net/FloatConverter/IEEE754.html


Re: Infinity vehicle health bug (between players). - AmigaBlizzard - 30.11.2016

Oops, my mistake then.
Sorry.


Re: Infinity vehicle health bug (between players). - NaS - 04.12.2016

The infinity value seems too high for the vehicle health. Since infinity is never actually used in SAMP, you shouldn't assume it's working for vehicles.
Your value simply overflows the vehicle health, and 0.0 (or -0.0 - anything below 250.0) is actually dead.


Re: Infinity vehicle health bug (between players). - Swedky - 04.12.2016

But it works for my client (client who's driving the vehicle), test it and you will see that vehicle health is really infinity. Hit a gas station and your vehicle won't explode.

So I think this is a SA-MP sync bug, I'll be looking for antoher way to do this. Thanks!