SA-MP Forums

Go Back   SA-MP Forums > SA-MP > Bug Reports

Reply
 
Thread Tools Display Modes
Old 30/11/2016, 03:27 AM   #1
Swedky
Banned
 
Join Date: Jun 2013
Location: Argentina.
Posts: 2,102
Reputation: 827
Default Infinity vehicle health bug (between players).

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.
Swedky is offline   Reply With Quote
Old 30/11/2016, 10:36 AM   #2
AmigaBlizzard
Huge Clucker
 
Join Date: Jul 2012
Posts: 269
Reputation: 49
Default Re: Infinity vehicle health bug (between players).

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.
AmigaBlizzard is offline   Reply With Quote
Old 30/11/2016, 02:51 PM   #3
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,903
Reputation: 2581
Default Re: Infinity vehicle health bug (between players).

Quote:
Originally Posted by AmigaBlizzard View Post
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
__________________
Vince is offline   Reply With Quote
Old 30/11/2016, 09:30 PM   #4
AmigaBlizzard
Huge Clucker
 
Join Date: Jul 2012
Posts: 269
Reputation: 49
Default Re: Infinity vehicle health bug (between players).

Oops, my mistake then.
Sorry.
AmigaBlizzard is offline   Reply With Quote
Old 04/12/2016, 05:19 PM   #5
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Location: Germany
Posts: 1,106
Reputation: 273
Default Re: Infinity vehicle health bug (between players).

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.
NaS is offline   Reply With Quote
Old 04/12/2016, 10:43 PM   #6
Swedky
Banned
 
Join Date: Jun 2013
Location: Argentina.
Posts: 2,102
Reputation: 827
Default Re: Infinity vehicle health bug (between players).

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!
Swedky is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
infinity health variable issue HeLiOn_PrImE Scripting Help 7 24/08/2014 06:54 PM
How to make infinity health ? Yaszine Scripting Help 16 23/06/2013 05:06 PM
[Include] OWN3D Anticheat - Health/Armour/Money/Weapons/Vehicle Health (W.I.P) MW2_OWN3D Includes 8 14/11/2011 07:05 PM
Infinity health cmd ! pls help xLw Scripting Help 1 15/09/2011 07:12 PM
does anyone know how to put the vehicle's health shopwn as the player's health ? AlbanianGuy Help Archive 9 16/01/2010 10:08 PM


All times are GMT. The time now is 06:03 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.