SA-MP Forums

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

Closed Thread
 
Thread Tools Display Modes
Old 06/02/2011, 10:57 PM   #1
Miguel
High-roller
 
Miguel's Avatar
 
Join Date: Dec 2009
Posts: 1,581
Reputation: 23
Default GetVehicleHealth isn't returning the correct value

If I use GetVehicleHealth just after SetVehicleHealth, it won't return the corrent value. I wanted to know if the health of the vehicle changed after I set it to more than 1000 but it doesn't return the value I just set.

pawn Code:
SetVehicleHealth(vehicleid, 1000.5);
GetVehicleHealth(vehicleid, current_health);
if(current_health <= 1000.25)
{
    // Do something here.
}
else
{
    // Do something else here.
}

I printed current_health and it was not 1000.5 but something else (probably the old vehicle health).
Miguel is offline  
Old 06/02/2011, 11:10 PM   #2
Jay_
Beta Tester
 
Jay_'s Avatar
 
Join Date: Jul 2009
Posts: 610
Reputation: 126
Default Re: GetVehicleHealth isn't returning the correct value

The maximum vehicle health, afaik, is 1000.0.
Jay_ is offline  
Old 06/02/2011, 11:21 PM   #3
Krx17
Huge Clucker
 
Krx17's Avatar
 
Join Date: Jul 2010
Posts: 470
Reputation: 22
Default Re: GetVehicleHealth isn't returning the correct value

Right after you set a vehicle's health, it won't be set in the core server values. You have to wait a little bit before you can get it. It's just how SA:MP works.
Krx17 is offline  
Old 07/02/2011, 12:07 AM   #4
Miguel
High-roller
 
Miguel's Avatar
 
Join Date: Dec 2009
Posts: 1,581
Reputation: 23
Default Re: GetVehicleHealth isn't returning the correct value

Quote:
Originally Posted by Jay_ View Post
The maximum vehicle health, afaik, is 1000.0.
No it is not.

I also tried using a timer, getting the health 75 milliseconds after the health was set; it didn't work so well, it didn't always return the correct value. Using a 100 milliseconds timer is not an option... This should be synced properly!
Miguel is offline  
Old 07/02/2011, 12:31 AM   #5
Face9000
High-roller
 
Face9000's Avatar
 
Join Date: Jan 2010
Location: Pigland
Posts: 3,259
Reputation: 185
Default Re: GetVehicleHealth isn't returning the correct value

The max Vehicle Health is 1000.0 so it's normal if you dont get the correct value.
__________________
Quote:
But you won't break me, you'll just make me stronger than i was.
My Pastebin: click me
Face9000 is offline  
Old 07/02/2011, 12:32 AM   #6
Mauzen
High-roller
 
Mauzen's Avatar
 
Join Date: Jun 2007
Location: Western Germany
Posts: 3,982
Reputation: 969
Default Re: GetVehicleHealth isn't returning the correct value

The decimal stuff after the comma is something strange for player and vehicle healths. For player health it is just not used, damage will always be 1.0 or 55.0 but never 1.65. Dont know for sure, but maybe it is the same for vehicles. Try setting it to 1001.0 and 999.0.
Mauzen is offline  
Old 07/02/2011, 02:58 AM   #7
Miguel
High-roller
 
Miguel's Avatar
 
Join Date: Dec 2009
Posts: 1,581
Reputation: 23
Default Re: GetVehicleHealth isn't returning the correct value



Once again, 1000.0 is not the max vehicle health! You can set it to whatever you want, you can even make it invulnerable if you set it high enough. I'm saying this because I've tried it, unlike some people who like to post even when they have no idea of what are they talking about...

No, it has nothing to do with the commans and decimal stuff, you can set the player/vehicle health to 99.9/999.9 and it will still work, and yes, I tried using integers (1001.0). It seems that GetPlayerHealth gets the old health, instead of the new health that has just been set; or maybe SetVehicleHealth sets it after GetVehicleHealth is called?

As I said, this should be synced:
pawn Code:
health_set();
value_updated();
get_health(); // Working with the new value.

It was tested on a localhost so if anyone asks, the bug has nothing to do with a bad internet. It doesn't happen when GetVehicleHealth wasn't called just after SetVehicleHealth.
Miguel is offline  
Old 07/02/2011, 04:56 AM   #8
iFriSki
Huge Clucker
 
iFriSki's Avatar
 
Join Date: Jan 2010
Location: USA, Michigan
Posts: 315
Reputation: 1
Default Re: GetVehicleHealth isn't returning the correct value

I'm not able to produce your problem.

Code:
[23:51:42] Current Health: 419.000000		Vehicle ID: 1		By: 419.000000
[23:51:42] Current Health: 1400.000000		Vehicle ID: 1		By: 981.000000
[23:51:42] Current Health: 2688.000000		Vehicle ID: 1		By: 1288.000000
[23:51:42] Current Health: 3872.000000		Vehicle ID: 1		By: 1184.000000
[23:51:42] Current Health: 4031.000000		Vehicle ID: 1		By: 159.000000
[23:51:42] Current Health: 4058.000000		Vehicle ID: 1		By: 27.000000
[23:51:42] Current Health: 4687.000000		Vehicle ID: 1		By: 629.000000
[23:51:42] Current Health: 5805.000000		Vehicle ID: 1		By: 1118.000000
[23:51:42] Current Health: 6496.000000		Vehicle ID: 1		By: 691.000000
[23:51:42] Current Health: 7413.000000		Vehicle ID: 1		By: 917.000000
[23:51:42] Current Health: 8885.000000		Vehicle ID: 1		By: 1472.000000
[23:51:42] Current Health: 9923.000000		Vehicle ID: 1		By: 1038.000000
[23:51:42] Current Health: 10121.000000		Vehicle ID: 1		By: 198.000000
[23:51:43] Current Health: 11141.000000		Vehicle ID: 1		By: 1020.000000
[23:51:43] Current Health: 11423.000000		Vehicle ID: 1		By: 282.000000
[23:51:43] Current Health: 12868.000000		Vehicle ID: 1		By: 1445.000000
[23:51:43] Current Health: 14326.000000		Vehicle ID: 1		By: 1458.000000
[23:51:43] Current Health: 14364.000000		Vehicle ID: 1		By: 38.000000
[23:51:43] Current Health: 14580.000000		Vehicle ID: 1		By: 216.000000
[23:51:43] Current Health: 14697.000000		Vehicle ID: 1		By: 117.000000
[23:51:43] Current Health: 16011.000000		Vehicle ID: 1		By: 1314.000000
[23:51:43] Current Health: 16246.000000		Vehicle ID: 1		By: 235.000000
[23:51:43] Current Health: 16405.000000		Vehicle ID: 1		By: 159.000000
[23:51:43] Current Health: 17202.000000		Vehicle ID: 1		By: 797.000000
[23:51:43] Current Health: 18210.000000		Vehicle ID: 1		By: 1008.000000
[23:51:43] Current Health: 18750.000000		Vehicle ID: 1		By: 540.000000
[23:51:43] Current Health: 19028.000000		Vehicle ID: 1		By: 278.000000
[23:51:43] Current Health: 19084.000000		Vehicle ID: 1		By: 56.000000
[23:51:43] Current Health: 19976.000000		Vehicle ID: 1		By: 892.000000
[23:51:43] Current Health: 20494.000000		Vehicle ID: 1		By: 518.000000
[23:51:43] Current Health: 21480.000000		Vehicle ID: 1		By: 986.000000
[23:51:44] Current Health: 22907.000000		Vehicle ID: 1		By: 1427.000000
[23:51:44] Current Health: 23052.000000		Vehicle ID: 1		By: 145.000000
[23:51:44] Current Health: 24315.000000		Vehicle ID: 1		By: 1263.000000
[23:51:44] Current Health: 25570.000000		Vehicle ID: 1		By: 1255.000000
[23:51:44] Current Health: 26321.000000		Vehicle ID: 1		By: 751.000000
[23:51:44] Current Health: 27324.000000		Vehicle ID: 1		By: 1003.000000
[23:51:44] Current Health: 28407.000000		Vehicle ID: 1		By: 1083.000000
[23:51:44] Current Health: 29766.000000		Vehicle ID: 1		By: 1359.000000
[23:51:44] Current Health: 30647.000000		Vehicle ID: 1		By: 881.000000
[23:51:44] Current Health: 30943.000000		Vehicle ID: 1		By: 296.000000
[23:51:44] Current Health: 31236.000000		Vehicle ID: 1		By: 293.000000
[23:51:44] Current Health: 31811.000000		Vehicle ID: 1		By: 575.000000
[23:51:44] Current Health: 32508.000000		Vehicle ID: 1		By: 697.000000
[23:51:44] Current Health: 33003.000000		Vehicle ID: 1		By: 495.000000
[23:51:44] Current Health: 33657.000000		Vehicle ID: 1		By: 654.000000
[23:51:44] Current Health: 34437.000000		Vehicle ID: 1		By: 780.000000
[23:51:44] Current Health: 34810.000000		Vehicle ID: 1		By: 373.000000
[23:51:45] Current Health: 35884.000000		Vehicle ID: 1		By: 1074.000000
[23:51:45] Current Health: 36321.000000		Vehicle ID: 1		By: 437.000000
[23:51:45] Current Health: 36876.000000		Vehicle ID: 1		By: 555.000000
[23:51:45] Current Health: 37698.000000		Vehicle ID: 1		By: 822.000000
[23:51:45] Current Health: 37982.000000		Vehicle ID: 1		By: 284.000000
[23:51:45] Current Health: 39093.000000		Vehicle ID: 1		By: 1111.000000
[23:51:45] Current Health: 39134.000000		Vehicle ID: 1		By: 41.000000
[23:51:45] Current Health: 39757.000000		Vehicle ID: 1		By: 623.000000
[23:51:45] Current Health: 40487.000000		Vehicle ID: 1		By: 730.000000
[23:51:45] Current Health: 41892.000000		Vehicle ID: 1		By: 1405.000000
[23:51:45] Current Health: 42561.000000		Vehicle ID: 1		By: 669.000000
[23:51:45] Current Health: 43989.000000		Vehicle ID: 1		By: 1428.000000
[23:51:45] Current Health: 44563.000000		Vehicle ID: 1		By: 574.000000
[23:51:45] Current Health: 44641.000000		Vehicle ID: 1		By: 78.000000
[23:51:45] Current Health: 44673.000000		Vehicle ID: 1		By: 32.000000
[23:51:45] Current Health: 45294.000000		Vehicle ID: 1		By: 621.000000
[23:51:45] Current Health: 45683.000000		Vehicle ID: 1		By: 389.000000
[23:51:46] Current Health: 46218.000000		Vehicle ID: 1		By: 535.000000
[23:51:46] Current Health: 47607.000000		Vehicle ID: 1		By: 1389.000000
[23:51:46] Current Health: 48519.000000		Vehicle ID: 1		By: 912.000000
[23:51:46] Current Health: 49320.000000		Vehicle ID: 1		By: 801.000000
[23:51:46] Current Health: 49357.000000		Vehicle ID: 1		By: 37.000000
[23:51:46] Current Health: 50713.000000		Vehicle ID: 1		By: 1356.000000
[23:51:46] Current Health: 51814.000000		Vehicle ID: 1		By: 1101.000000
[23:51:46] Current Health: 52583.000000		Vehicle ID: 1		By: 769.000000
[23:51:46] Current Health: 52920.000000		Vehicle ID: 1		By: 337.000000
[23:51:46] Current Health: 53480.000000		Vehicle ID: 1		By: 560.000000
[23:51:46] Current Health: 54880.000000		Vehicle ID: 1		By: 1400.000000
[23:51:46] Current Health: 55456.000000		Vehicle ID: 1		By: 576.000000
[23:51:46] Current Health: 56706.000000		Vehicle ID: 1		By: 1250.000000
[23:51:46] Current Health: 58198.000000		Vehicle ID: 1		By: 1492.000000
[23:51:46] Current Health: 59561.000000		Vehicle ID: 1		By: 1363.000000
[23:51:46] Current Health: 59821.000000		Vehicle ID: 1		By: 260.000000
[23:51:46] Current Health: 60396.000000		Vehicle ID: 1		By: 575.000000
[23:51:47] Current Health: 61706.000000		Vehicle ID: 1		By: 1310.000000
[23:51:47] Current Health: 61986.000000		Vehicle ID: 1		By: 280.000000
[23:51:47] Current Health: 62550.000000		Vehicle ID: 1		By: 564.000000
[23:51:47] Current Health: 63966.000000		Vehicle ID: 1		By: 1416.000000
[23:51:47] Current Health: 64629.000000		Vehicle ID: 1		By: 663.000000
[23:51:47] Current Health: 65859.000000		Vehicle ID: 1		By: 1230.000000
[23:51:47] Current Health: 65999.000000		Vehicle ID: 1		By: 140.000000
[23:51:47] Current Health: 66996.000000		Vehicle ID: 1		By: 997.000000
[23:51:47] Current Health: 67358.000000		Vehicle ID: 1		By: 362.000000
[23:51:47] Current Health: 67389.000000		Vehicle ID: 1		By: 31.000000
[23:51:47] Current Health: 67813.000000		Vehicle ID: 1		By: 424.000000
[23:51:47] Current Health: 67898.000000		Vehicle ID: 1		By: 85.000000
[23:51:47] Current Health: 67993.000000		Vehicle ID: 1		By: 95.000000
[23:51:47] Current Health: 69419.000000		Vehicle ID: 1		By: 1426.000000
[23:51:47] Current Health: 70830.000000		Vehicle ID: 1		By: 1411.000000
[23:51:47] Current Health: 71470.000000		Vehicle ID: 1		By: 640.000000
[23:51:47] Current Health: 72637.000000		Vehicle ID: 1		By: 1167.000000
[23:51:48] Current Health: 73210.000000		Vehicle ID: 1		By: 573.000000
[23:51:48] Current Health: 74278.000000		Vehicle ID: 1		By: 1068.000000
[23:51:48] Current Health: 75529.000000		Vehicle ID: 1		By: 1251.000000
[23:51:48] Current Health: 76549.000000		Vehicle ID: 1		By: 1020.000000
[23:51:48] Current Health: 77557.000000		Vehicle ID: 1		By: 1008.000000
[23:51:48] Current Health: 79016.000000		Vehicle ID: 1		By: 1459.000000
[23:51:48] Current Health: 80240.000000		Vehicle ID: 1		By: 1224.000000
[23:51:48] Current Health: 80459.000000		Vehicle ID: 1		By: 219.000000
[23:51:48] Current Health: 81572.000000		Vehicle ID: 1		By: 1113.000000
[23:51:48] Current Health: 82508.000000		Vehicle ID: 1		By: 936.000000
[23:51:48] Current Health: 82853.000000		Vehicle ID: 1		By: 345.000000
[23:51:48] Current Health: 83066.000000		Vehicle ID: 1		By: 213.000000
[23:51:48] Current Health: 84394.000000		Vehicle ID: 1		By: 1328.000000
[23:51:48] Current Health: 85519.000000		Vehicle ID: 1		By: 1125.000000
[23:51:48] Current Health: 86133.000000		Vehicle ID: 1		By: 614.000000
[23:51:48] Current Health: 86650.000000		Vehicle ID: 1		By: 517.000000
[23:51:48] Current Health: 86893.000000		Vehicle ID: 1		By: 243.000000
[23:51:49] Current Health: 87745.000000		Vehicle ID: 1		By: 852.000000
[23:51:49] Current Health: 88519.000000		Vehicle ID: 1		By: 774.000000
[23:51:49] Current Health: 89762.000000		Vehicle ID: 1		By: 1243.000000
[23:51:49] Current Health: 90198.000000		Vehicle ID: 1		By: 436.000000
[23:51:49] Current Health: 90393.000000		Vehicle ID: 1		By: 195.000000
[23:51:49] Current Health: 91787.000000		Vehicle ID: 1		By: 1394.000000
[23:51:49] Current Health: 92500.000000		Vehicle ID: 1		By: 713.000000
[23:51:49] Current Health: 93153.000000		Vehicle ID: 1		By: 653.000000
[23:51:49] Current Health: 94502.000000		Vehicle ID: 1		By: 1349.000000
[23:51:49] Current Health: 95916.000000		Vehicle ID: 1		By: 1414.000000
[23:51:49] Current Health: 96159.000000		Vehicle ID: 1		By: 243.000000
[23:51:49] Current Health: 96499.000000		Vehicle ID: 1		By: 340.000000
[23:51:49] Current Health: 97239.000000		Vehicle ID: 1		By: 740.000000
[23:51:49] Current Health: 98530.000000		Vehicle ID: 1		By: 1291.000000
[23:51:49] Current Health: 98751.000000		Vehicle ID: 1		By: 221.000000
[23:51:49] Current Health: 100134.000000		Vehicle ID: 1		By: 1383.000000
[23:51:49] Current Health: 101582.000000		Vehicle ID: 1		By: 1448.000000
[23:51:50] Current Health: 103056.000000		Vehicle ID: 1		By: 1474.000000
[23:51:50] Current Health: 103751.000000		Vehicle ID: 1		By: 695.000000
[23:51:50] Current Health: 104215.000000		Vehicle ID: 1		By: 464.000000
[23:51:50] Current Health: 104988.000000		Vehicle ID: 1		By: 773.000000
[23:51:50] Current Health: 105584.000000		Vehicle ID: 1		By: 596.000000
[23:51:50] Current Health: 106395.000000		Vehicle ID: 1		By: 811.000000
[23:51:50] Current Health: 106885.000000		Vehicle ID: 1		By: 490.000000
[23:51:50] Current Health: 107169.000000		Vehicle ID: 1		By: 284.000000
[23:51:50] Current Health: 107836.000000		Vehicle ID: 1		By: 667.000000
[23:51:50] Current Health: 109322.000000		Vehicle ID: 1		By: 1486.000000
[23:51:50] Current Health: 109368.000000		Vehicle ID: 1		By: 46.000000
[23:51:50] Current Health: 110824.000000		Vehicle ID: 1		By: 1456.000000
[23:51:50] Current Health: 112131.000000		Vehicle ID: 1		By: 1307.000000
[23:51:50] Current Health: 113448.000000		Vehicle ID: 1		By: 1317.000000
[23:51:50] Current Health: 114455.000000		Vehicle ID: 1		By: 1007.000000
[23:51:50] Current Health: 115106.000000		Vehicle ID: 1		By: 651.000000
[23:51:50] Current Health: 116446.000000		Vehicle ID: 1		By: 1340.000000
[23:51:51] Current Health: 117129.000000		Vehicle ID: 1		By: 683.000000
[23:51:51] Current Health: 117236.000000		Vehicle ID: 1		By: 107.000000
[23:51:51] Current Health: 118267.000000		Vehicle ID: 1		By: 1031.000000
[23:51:51] Current Health: 119697.000000		Vehicle ID: 1		By: 1430.000000
[23:51:51] Current Health: 119943.000000		Vehicle ID: 1		By: 246.000000
[23:51:51] Current Health: 120469.000000		Vehicle ID: 1		By: 526.000000
[23:51:51] Current Health: 121106.000000		Vehicle ID: 1		By: 637.000000
[23:51:51] Current Health: 122241.000000		Vehicle ID: 1		By: 1135.000000
[23:51:51] Current Health: 122933.000000		Vehicle ID: 1		By: 692.000000
[23:51:51] Current Health: 124074.000000		Vehicle ID: 1		By: 1141.000000
[23:51:51] Current Health: 124697.000000		Vehicle ID: 1		By: 623.000000
[23:51:51] Current Health: 125941.000000		Vehicle ID: 1		By: 1244.000000
[23:51:51] Current Health: 126272.000000		Vehicle ID: 1		By: 331.000000
[23:51:51] Current Health: 126699.000000		Vehicle ID: 1		By: 427.000000
[23:51:51] Current Health: 127701.000000		Vehicle ID: 1		By: 1002.000000
[23:51:51] Current Health: 128879.000000		Vehicle ID: 1		By: 1178.000000
[23:51:51] Current Health: 128888.000000		Vehicle ID: 1		By: 9.000000
[23:51:52] Current Health: 129192.000000		Vehicle ID: 1		By: 304.000000
[23:51:52] Current Health: 130456.000000		Vehicle ID: 1		By: 1264.000000
[23:51:52] Current Health: 131926.000000		Vehicle ID: 1		By: 1470.000000
[23:51:52] Current Health: 132712.000000		Vehicle ID: 1		By: 786.000000
[23:51:52] Current Health: 133213.000000		Vehicle ID: 1		By: 501.000000
[23:51:52] Current Health: 133268.000000		Vehicle ID: 1		By: 55.000000
[23:51:52] Current Health: 134752.000000		Vehicle ID: 1		By: 1484.000000
[23:51:52] Current Health: 135589.000000		Vehicle ID: 1		By: 837.000000
[23:51:52] Current Health: 136108.000000		Vehicle ID: 1		By: 519.000000
[23:51:52] Current Health: 137002.000000		Vehicle ID: 1		By: 894.000000
[23:51:52] Current Health: 137151.000000		Vehicle ID: 1		By: 149.000000
[23:51:52] Current Health: 137779.000000		Vehicle ID: 1		By: 628.000000
[23:51:52] Current Health: 138799.000000		Vehicle ID: 1		By: 1020.000000
[23:51:52] Current Health: 139570.000000		Vehicle ID: 1		By: 771.000000
[23:51:52] Current Health: 140357.000000		Vehicle ID: 1		By: 787.000000
[23:51:52] Current Health: 140806.000000		Vehicle ID: 1		By: 449.000000
[23:51:52] Current Health: 141201.000000		Vehicle ID: 1		By: 395.000000
[23:51:53] Current Health: 142336.000000		Vehicle ID: 1		By: 1135.000000
[23:51:53] Current Health: 142809.000000		Vehicle ID: 1		By: 473.000000
[23:51:53] Current Health: 143861.000000		Vehicle ID: 1		By: 1052.000000
[23:51:53] Current Health: 144951.000000		Vehicle ID: 1		By: 1090.000000
[23:51:53] Current Health: 145068.000000		Vehicle ID: 1		By: 117.000000
[23:51:53] Current Health: 146169.000000		Vehicle ID: 1		By: 1101.000000
[23:51:53] Current Health: 147099.000000		Vehicle ID: 1		By: 930.000000
[23:51:53] Current Health: 147135.000000		Vehicle ID: 1		By: 36.000000
[23:51:53] Current Health: 148528.000000		Vehicle ID: 1		By: 1393.000000
[23:51:53] Current Health: 148982.000000		Vehicle ID: 1		By: 454.000000
[23:51:53] Current Health: 150407.000000		Vehicle ID: 1		By: 1425.000000
[23:51:53] Current Health: 150935.000000		Vehicle ID: 1		By: 528.000000
[23:51:53] Current Health: 152353.000000		Vehicle ID: 1		By: 1418.000000
[23:51:53] Current Health: 153511.000000		Vehicle ID: 1		By: 1158.000000
[23:51:53] Current Health: 154293.000000		Vehicle ID: 1		By: 782.000000
[23:51:53] Current Health: 155494.000000		Vehicle ID: 1		By: 1201.000000
[23:51:53] Current Health: 155513.000000		Vehicle ID: 1		By: 19.000000
[23:51:54] Current Health: 156142.000000		Vehicle ID: 1		By: 629.000000
[23:51:54] Current Health: 156713.000000		Vehicle ID: 1		By: 571.000000
[23:51:54] Current Health: 156713.000000		Vehicle ID: 1		By: 0.000000
[23:51:54] Current Health: 157759.000000		Vehicle ID: 1		By: 1046.000000
[23:51:54] Current Health: 158286.000000		Vehicle ID: 1		By: 527.000000
[23:51:54] Current Health: 159570.000000		Vehicle ID: 1		By: 1284.000000
[23:51:54] Current Health: 160256.000000		Vehicle ID: 1		By: 686.000000
[23:51:54] Current Health: 161434.000000		Vehicle ID: 1		By: 1178.000000
[23:51:54] Current Health: 161776.000000		Vehicle ID: 1		By: 342.000000
[23:51:54] Current Health: 162559.000000		Vehicle ID: 1		By: 783.000000
[23:51:54] Current Health: 162861.000000		Vehicle ID: 1		By: 302.000000
[23:51:54] Current Health: 163717.000000		Vehicle ID: 1		By: 856.000000
[23:51:54] Current Health: 163743.000000		Vehicle ID: 1		By: 26.000000
[23:51:54] Current Health: 164618.000000		Vehicle ID: 1		By: 875.000000
[23:51:54] Current Health: 165616.000000		Vehicle ID: 1		By: 998.000000
[23:51:54] Current Health: 166347.000000		Vehicle ID: 1		By: 731.000000
[23:51:54] Current Health: 167324.000000		Vehicle ID: 1		By: 977.000000
pawn Code:
#include <a_samp>
main(){}
new veh; // Global as I'd like the Veh ID to be used elsewhere
forward Health();
public OnGameModeInit()
{
    veh = CreateVehicle(400, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 0, 60); // Create a vehicle for test purposes
    SetTimer("Health", 50, 1); // Start the timer up
    return 1;
}

new Float:GetHealth; // Global variable to simulate as if I'm passing it through the function
public Health()
{
    new Float:rand = random(1500); // Random increment to health
    SetVehicleHealth(veh, GetHealth+rand); // Set that bad boy up with some new health
    GetVehicleHealth(veh, GetHealth); // Let's get that puppies health & store it in GetHealth
    printf("Current Health: %f      Vehicle ID: %i      By: %f",GetHealth, veh, rand); // Print it to the console
    return 1;
}
iFriSki is offline  
Old 07/02/2011, 06:45 AM   #9
DVDK
Gangsta
 
DVDK's Avatar
 
Join Date: Oct 2010
Posts: 508
Reputation: 0
Default Re: GetVehicleHealth isn't returning the correct value

Quote:
Originally Posted by Miguel View Post

Once again, 1000.0 is not the max vehicle health! You can set it to whatever you want, you can even make it invulnerable if you set it high enough. I'm saying this because I've tried it, unlike some people who like to post even when they have no idea of what are they talking about...
Okay then, if you know it better, why don't you fix it yourself?
DVDK is offline  
Old 07/02/2011, 07:13 AM   #10
Miguel
High-roller
 
Miguel's Avatar
 
Join Date: Dec 2009
Posts: 1,581
Reputation: 23
Default Re: GetVehicleHealth isn't returning the correct value

Quote:
Originally Posted by iFriSki View Post
I'm not able to produce your problem.
Thanks for posting some feedback. I realised GetVehicleHealth wasn't returning a wrong value after the health was set. I was planning to check if the health of the vehicle changed after the server set it to x, but using GetVehicleHealth would not work since it does work too fast. I also tried using a 100 milliseconds timer, but GetVehicleHealth, once again, wouldn't return the correct value. It sometimes returns 1000.0 instead of the real vehicle health.

@DVDK: If you're reporting a bug and someone else comes saying that there's no bug because <insert invalid reason here>, and you know they're wrong, what would you do? People should not post about stuff they don't know about. It had nothing to do with commas and it had nothing to do with the health being set over 1000.0...
Miguel is offline  
Closed Thread

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
[AYUDA]GetVehicleHealth y Floatround [M]xFire Espa˝ol/Spanish 10 22/12/2010 06:32 PM
GetVehicleHealth iRana Help Archive 3 08/12/2010 11:41 AM
GetVehicleHealth Help RichyB Help Archive 6 09/07/2010 09:05 AM
Problem.. GetVehicleHealth Fedee! Help Archive 5 07/03/2010 11:34 PM
GetVehicleHealth error and other errors. Martin_White Help Archive 12 09/08/2009 03:44 PM


All times are GMT. The time now is 02:36 AM.


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