SA-MP Forums Archive
GetVehicleDamageStatus value ranges? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: GetVehicleDamageStatus value ranges? (/showthread.php?tid=149388)



GetVehicleDamageStatus value ranges? - cAMo - 22.05.2010

What are the value ranges for GetVehicleDamageStatus?


panels =
doors =
lights =
tires = 0000 - 1111





Re: GetVehicleDamageStatus value ranges? - shady91 - 22.05.2010

Quote:
Originally Posted by cAMo
What are the value ranges for GetVehicleDamageStatus?


panels =
doors =
lights =
tires = 0000 - 1111


Why not test, make it print the vehicle panel,door,light,tire etc.. that's how I found out.


Re: GetVehicleDamageStatus value ranges? - [NYRP]Mike. - 22.05.2010

Parameters:
(vehicleid, &panels, &doors, &lights, &tires)
vehicleid The ID of the vehicle you want to get the damage of.
panels The integer to store the panel damage data in, passed by reference.
doors The integer to store the door damage data in, passed by reference.
lights The integer to store the light damage data in, passed by reference.
tires The integer to store the tire damage data in, passed by reference.

Код:
new panels,doors,lights,tires;
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
printf("Vehicle Status : [Panels] : %d - [Doors] : %d - [Lights] : %d - [Tires] : %d",panels,doors,lights,tires);
Panels, Doors and Lights are both 0 - 1.


Re: GetVehicleDamageStatus value ranges? - cAMo - 22.05.2010

I am storing the vehicle's damage into a MySQL database. I need the ranges to know how big to make the fields.

The wiki, which I have read, doesn't have that info. It should... but it only has it for the tires.

Tires = 0 - 1111 (Len: 4)

What about the rest?


Re: GetVehicleDamageStatus value ranges? - shady91 - 22.05.2010

Quote:
Originally Posted by cAMo
I am storing the vehicle's damage into a MySQL database. I need the ranges to know how big to make the fields.

The wiki, which I have read, doesn't have that info. It should... but it only has it for the tires.

Tires = 0 - 1111 (Len: 4)

What about the rest?
I've already done that idea


Re: GetVehicleDamageStatus value ranges? - cAMo - 22.05.2010

Congratulations. Do you want to help me?


Re: GetVehicleDamageStatus value ranges? - shady91 - 22.05.2010

Quote:
Originally Posted by cAMo
Congratulations. Do you want to help me?
Sure, what's your problem.


Re: GetVehicleDamageStatus value ranges? - Kyosaur - 22.05.2010

Quote:
Originally Posted by Shady91
Quote:
Originally Posted by cAMo
I am storing the vehicle's damage into a MySQL database. I need the ranges to know how big to make the fields.

The wiki, which I have read, doesn't have that info. It should... but it only has it for the tires.

Tires = 0 - 1111 (Len: 4)

What about the rest?
I've already done that idea
lmao, and the most useless post of the day goes to.... Shady91 *the crowd goes wild*.


lol back on topic, i'd either put 6 or 11 charaacters. 6 is an educated guess, as i highly doubt any value will pass that; The 11 characters is just incase your extremely paranoid, as thats the longest integer you can obtain in pawn (-2147483647).


Re: GetVehicleDamageStatus value ranges? - shady91 - 22.05.2010

Quote:
Originally Posted by Kyosaur!!
Quote:
Originally Posted by Shady91
Quote:
Originally Posted by cAMo
I am storing the vehicle's damage into a MySQL database. I need the ranges to know how big to make the fields.

The wiki, which I have read, doesn't have that info. It should... but it only has it for the tires.

Tires = 0 - 1111 (Len: 4)

What about the rest?
I've already done that idea
lmao, and the most useless post of the day goes to.... Shady91 *the crowd goes wild*.


lol back on topic, i'd either put 6 or 11 charaacters. 6 is an educated guess, as i highly doubt any value will pass that; The 11 characters is just incase your extremely paranoid, as thats the longest integer you can obtain in pawn (-2147483647).
Well thank you, lol.


Re: GetVehicleDamageStatus value ranges? - ¤Adas¤ - 22.05.2010

pawn Код:
stock GetVehiclePanelsDamageStatus(vehicleid, &FrontLeft, &FrontRight, &RearLeft, &RearRight, &WindShield, &FrontBumper, &RearBumper)
{
new Panels, Doors, Lights, Tires;
GetVehicleDamageStatus(vehicleid, Panels, Doors, Lights, Tires);
FrontLeft = Panels & 15;
FrontRight = Panels >> 4 & 15;
RearLeft = Panels >> 8 & 15;
RearRight = Panels >> 12 & 15;
WindShield = Panels >> 16 & 15;
FrontBumper = Panels >> 20 & 15;
RearBumper = Panels >> 24 & 15;
return true;
}

stock GetVehicleDoorsDamageStatus(vehicleid, &Bonnet, &Boot, &FrontLeft, &FrontRight, &RearLeft, &RearRight)
{
new Panels, Doors, Lights, Tires;
GetVehicleDamageStatus(vehicleid, Panels, Doors, Lights, Tires);
Bonnet = Doors & 7;
Boot = Doors >> 8 & 7;
FrontLeft = Doors >> 16 & 7;
FrontRight = Doors >> 24 & 7;
RearLeft = Doors >> 32 & 7;
RearRight = Doors >> 40 & 7;
return true;
}

stock GetVehicleLightsDamageStatus(vehicleid, &First, &Second, &Third, &Fourth)
{
new Panels, Doors, Lights, Tires;
GetVehicleDamageStatus(vehicleid, Panels, Doors, Lights, Tires);
First = Lights & 1;
Second = Lights >> 1 & 1;
Third = Lights >> 2 & 1;
Fourth = Lights >> 3 & 1;
return true;
}

stock GetVehicleTiresDamageStatus(vehicleid, &FrontLeft, &FrontRight, &RearLeft, &RearRight)
{
new Panels, Doors, Lights, Tires;
GetVehicleDamageStatus(vehicleid, Panels, Doors, Lights, Tires);
if(GetVehicleType(vehicleid) == MOTORBIKE || GetVehicleType(vehicleid) == BIKE) FrontLeft = Tires >> 1 & 1, FrontRight = Tires & 1;
else
{
RearRight = Tires & 1;
FrontRight = Tires >> 1 & 1;
RearLeft = Tires >> 2 & 1;
FrontLeft = Tires >> 3 & 1;
}
return true;
}

stock UpdateVehiclePanelsDamageStatus(vehicleid, FrontLeft, FrontRight, RearLeft, RearRight, WindShield, FrontBumper, RearBumper)
{
new Panels, Doors, Lights, Tires;
GetVehicleDamageStatus(vehicleid, Panels, Doors, Lights, Tires);
return UpdateVehicleDamageStatus(vehicleid, FrontLeft | (FrontRight << 4) | (RearLeft << 8) | (RearRight << 12) | (WindShield << 16) | (FrontBumper << 20) | (RearBumper << 24), Doors, Lights, Tires);
}

stock UpdateVehicleDoorsDamageStatus(vehicleid, Bonnet, Boot, FrontLeft, FrontRight, RearLeft, RearRight)
{
new Panels, Doors, Lights, Tires;
GetVehicleDamageStatus(vehicleid, Panels, Doors, Lights, Tires);
return UpdateVehicleDamageStatus(vehicleid, Panels, Bonnet | (Boot << 8) | (FrontLeft << 16) | (FrontRight << 24) | (RearLeft << 32) | (RearRight << 40), Lights, Tires);
}

stock UpdateVehicleLightsDamageStatus(vehicleid, First, Second, Third, Fourth)
{
new Panels, Doors, Lights, Tires;
GetVehicleDamageStatus(vehicleid, Panels, Doors, Lights, Tires);
return UpdateVehicleDamageStatus(vehicleid, Panels, Doors, First | (Second << 1) | (Third << 2) | (Fourth << 3), Tires);
}

#define CAR 0
#define BIKE 1
#define MOTORBIKE 2
#define BOAT 3
#define PLANE 4
#define RC 5
#define TRAIN 6
#define TRAILER 7
#define HELICOPTER 8


stock GetVehicleType(vehicleid)
{
switch(GetVehicleModel(vehicleid))
{
case 400 .. 416, 418 .. 424, 426 .. 429, 431 .. 434, 436 .. 440, 442 .. 445, 451, 455 .. 459, 466, 467, 470, 471, 474, 475, 477 .. 480, 482, 483, 485, 486, 489 .. 492, 494 .. 496, 498 .. 500, 502 .. 508, 514 .. 518, 524 .. 536, 539 .. 547, 549 .. 552, 554 .. 562, 565 .. 568, 571 .. 576, 578 .. 580, 582, 583, 585, 587 .. 589, 596 .. 605, 609: return CAR;
case 481, 509, 510: return BIKE;
case 448, 461 .. 463, 468, 521 .. 523, 581, 586: return MOTORBIKE;
case 430, 446, 452 .. 454, 472, 473, 484, 493, 595: return BOAT;
case 460, 476, 511 .. 513, 519, 520, 553, 577, 592, 593: return PLANE;
case 441, 464, 465, 501, 564, 594: return RC;
case 449, 537, 538, 569, 570, 590: return TRAIN;
case 435, 450, 584, 591, 606 .. 608, 610, 611: return TRAILER;
case 417, 425, 447, 469, 487, 488, 497, 548, 563: return HELICOPTER;
}
return -1;
}

stock UpdateVehicleTiresDamageStatus(vehicleid, FrontLeft, FrontRight, RearLeft, RearRight)
{
new Panels, Doors, Lights, Tires;
GetVehicleDamageStatus(vehicleid, Panels, Doors, Lights, Tires);
if(GetVehicleType(vehicleid) == MOTORBIKE || GetVehicleType(vehicleid) == BIKE) return UpdateVehicleDamageStatus(vehicleid, Panels, Doors, Lights, FrontRight | (FrontLeft << 1));
else return UpdateVehicleDamageStatus(vehicleid, Panels, Doors, Lights, RearRight | (FrontRight << 1) | (RearLeft << 2) | (FrontLeft << 3));
}