Extended Vehicle Information -
Vince - 21.05.2013
Extended Vehicle Information (EVI)
Version 1.0.1
This script allows you to retrieve all vehicle related information. All information that is present in the handling.cfg data file has been converted - with the necessary difficulty - into an SQLite database. You are now able to retrieve a vehicle's top speed, its mass, its cost, its gears, its acceleration and much, much more.
Even more interesting is that you can also read a vehicle's model and handling flags. Apart from being able to tell its type, you can also tell if a vehicle is a low rider or a street racer, you can tell if the vehicle has a normal exhaust, double exhausts or no exhausts at all. There are 60 flags that you can check!
Please note: all values use the metric system. This is how they appear in the data file. It is not my choice (although I prefer metric over imperial any time).
Note 2: No input escaping is done whatsoever! I tried to implement it, but crashdetect went mad and everything broke. Then again, these functions aren't meant to be used with end user input.
Example Usage
pawn Код:
new vehicle_cost = GetVehicleModelInfoAsInt(411, "nMonetaryValue"); // infernus
printf("model 411 costs $%d", vehicle_cost);
new Float:vehicle_weight = GetVehicleModelInfoAsFloat(402, "fMass"); // buffalo
printf("model 402 weighs %f kilograms", vehicle_weight);
if(GetVehicleModelFlag(425, MFLAG_IS_HELI)) // hunter
{
printf("model 425 is a helicopter");
}
else
{
printf("model 425 is not a helicopter");
}
if(GetVehicleHandlingFlag(567, HFLAG_LOW_RIDER)) // savanna
{
printf("model 567 is a lowrider");
}
else
{
printf("model 567 is not a lowrider");
}
Installation Instructions
Download the zip file from
the GitHub repository. Extract the contents in your server directory. All files should automatically go to their respective directories. If that doesn't work: manually place
handling.db into the /scriptfiles folder and
evi.inc into the /pawno/include folder.
Use this in any script in which you'd like to use these functions:
Technical Information
To be used with
GetVehicleModelInfoAsInt and
GetVehicleModelInfoAsFloat. DriveType and EngineType should also be retrieved with the integer function. However, they return characters. These can be validated as follows:
pawn Код:
if(GetVehicleModelInfoAsInt(400, "TransmissionData_nEngineType") == 'P') { /* ... */ }
Код:
> UNITS <
---------
Vehicle identifier 14 characters max
Dimensions in metres
Mass in Kg
Velocity in Km/h
Acceleration/deceleration in ms-2
Multipliers x1.0 is default
Angles in degrees
Levels :- (L)ow, (M)edium, (H)igh
Buoyancy = percent submerged (> 100% vehicle sinks)
Engine type :- (P)etrol, (D)iesel, (E)lectric
Engine drive :- (F)ront, ®ear, (4)-wheel drive
> FIELD DESCRIPTIONS <
----------------------
[id] int NOT NULL,
[name] VARCHAR(14) NOT NULL,
[fMass] float NOT NULL,
[fTurnMass] float NOT NULL,
[fDragMult] float NOT NULL,
[fCentreOfMass_x] float NOT NULL,
[fCentreOfMass_y] float NOT NULL,
[fCentreOfMass_z] float NOT NULL,
[nPercentSubmerged] int NOT NULL,
[fTractionMultiplier] float NOT NULL,
[fTractionLoss] float NOT NULL,
[fTractionBias] float NOT NULL,
[TransmissionData_nNumberOfGears] int NOT NULL,
[TransmissionData_fMaxVelocity] float NOT NULL,
[TransmissionData_fEngineAcceleration] float NOT NULL,
[TransmissionData_fEngineInertia] float NOT NULL,
[TransmissionData_nDriveType] VARCHAR(2) NOT NULL,
[TransmissionData_nEngineType] VARCHAR(2) NOT NULL,
[fBrakeDeceleration] float NOT NULL,
[fBrakeBias] float NOT NULL,
[bABS] boolean NOT NULL,
[fSteeringLock] float NOT NULL,
[fSuspensionForceLevel] float NOT NULL,
[fSuspensionDampingLevel] float NOT NULL,
[fSuspensionHighSpdComDamp] float NOT NULL,
[fSuspensionUpperLimit] float NOT NULL,
[fSuspensionLowerLimit] float NOT NULL,
[fSuspensionBias] float NOT NULL,
[fSuspensionMult] float NOT NULL,
[fSeatOffsetDistance] float NOT NULL,
[fCollisionDamageMultiplier] float NOT NULL,
[nMonetaryValue] int NOT NULL,
[nModelFlags] int NOT NULL,
[nHandlingFlags] int NOT NULL,
[nFrontLights] int NOT NULL,
[nRearLights] int NOT NULL,
[nVehicleAnimGroup] int NOT NULL
To be used with
GetVehicleModelFlag.
pawn Код:
enum modelFlags (<<= 1)
{
MFLAG_IS_VAN = 1,
MFLAG_IS_BUS,
MFLAG_IS_LOW,
MFLAG_IS_BIG,
MFLAG_REVERSE_BONNET,
MFLAG_HANGING_BOOT,
MFLAG_TAILGATE_BOOT,
MFLAG_NOSWING_BOOT,
MFLAG_NO_DOORS,
MFLAG_TANDEM_SEATS,
MFLAG_SIT_IN_BOAT,
MFLAG_CONVERTIBLE,
MFLAG_NO_EXHAUST,
MFLAG_DOUBLE_EXHAUST,
MFLAG_NO1FPS_LOOK_BEHIND,
MFLAG_FORCE_DOOR_CHECK,
MFLAG_AXLE_F_NOTILT,
MFLAG_AXLE_F_SOLID,
MFLAG_AXLE_F_MCPHERSON,
MFLAG_AXLE_F_REVERSE,
MFLAG_AXLE_R_NOTILT,
MFLAG_AXLE_R_SOLID,
MFLAG_AXLE_R_MCPHERSON,
MFLAG_AXLE_R_REVERSE,
MFLAG_IS_BIKE,
MFLAG_IS_HELI,
MFLAG_IS_PLANE,
MFLAG_IS_BOAT,
MFLAG_BOUNCE_PANELS,
MFLAG_DOUBLE_RWHEELS,
MFLAG_FORCE_GROUND_CLEARANCE,
MFLAG_IS_HATCHBACK
};
To be used with
GetVehicleHandlingFlag.
pawn Код:
enum handlingFlags (<<= 1)
{
HFLAG_1G_BOOST = 1,
HFLAG_2G_BOOST,
HFLAG_NPC_ANTI_ROLL,
HFLAG_NPC_NEUTRAL_HANDL,
HFLAG_NO_HANDBRAKE,
HFLAG_STEER_REARWHEELS,
HFLAG_HB_REARWHEEL_STEER,
HFLAG_ALT_STEER_OPT,
HFLAG_WHEEL_F_NARROW2,
HFLAG_WHEEL_F_NARROW,
HFLAG_WHEEL_F_WIDE,
HFLAG_WHEEL_F_WIDE2,
HFLAG_WHEEL_R_NARROW2,
HFLAG_WHEEL_R_NARROW,
HFLAG_WHEEL_R_WIDE,
HFLAG_WHEEL_R_WIDE2,
HFLAG_HYDRAULIC_GEOM,
HFLAG_HYDRAULIC_INST,
HFLAG_HYDRAULIC_NONE,
HFLAG_NOS_INST,
HFLAG_OFFROAD_ABILITY,
HFLAG_OFFROAD_ABILITY2,
HFLAG_HALOGEN_LIGHTS,
HFLAG_PROC_REARWHEEL_1ST,
HFLAG_USE_MAXSP_LIMIT,
HFLAG_LOW_RIDER,
HFLAG_STREET_RACER,
HFLAG_UNUSED_FLAG, // Unused in data files. Required for continuity. Do not remove.
HFLAG_SWINGING_CHASSIS
}
Re: Extended Vehicle Information -
Kyle - 21.05.2013
perfect.
Was waiting for another one of your releases or tutorials!
Re: Extended Vehicle Information -
RajatPawar - 21.05.2013
Huge, a lot of work, really nice. Personally, I hate working with SQLite. However, you said costs - what kind of vehicle costs? If you mean the 'money' cost, shouldn't that be dependent on personal opinion? Or is it another kind of 'cost'?
Re: Extended Vehicle Information -
Littlehelper - 21.05.2013
Very nice!
Re: Extended Vehicle Information -
DaRk_RaiN - 21.05.2013
I love it, good job!
Re: Extended Vehicle Information -
Vince - 21.05.2013
Quote:
Originally Posted by Rajat_Pawar
Huge, a lot of work, really nice. Personally, I hate working with SQLite. However, you said costs - what kind of vehicle costs? If you mean the 'money' cost, shouldn't that be dependent on personal opinion? Or is it another kind of 'cost'?
|
Those are the prices that the game uses internally for the export mission in single player. They were in that file so I figured I might as well add them.
Re: Extended Vehicle Information -
Kreatyve - 21.05.2013
Useful, thank you very much =]
Re: Extended Vehicle Information -
MP2 - 21.05.2013
Not sure how most of this is beneficial tbh. When would one need the handling information of a vehicle? The only data I can see a partial use for is the monetary values (the value of the vehicles) - though they aren't great ($95,000 for an Infernus and $45,000 for a Hydra..?).
Good work all the same.
Re: Extended Vehicle Information -
Maxips2 - 22.05.2013
Nice release, looks very useful.
Re: Extended Vehicle Information -
Alex Magaсa - 22.05.2013
good job
)!
Re: Extended Vehicle Information -
Jay_ - 22.05.2013
Quote:
Originally Posted by MP2
($95,000 for an Infernus and $45,000 for a Hydra..?)..
|
I wouldn't rely on the
nMonetaryValue flag for anything other than cars or maybe motorbikes. IIRC it's the default value of the vehicle which then varies depending on the damage inflicted to it. The official description of the flag is "Used to calculate the Value of property damaged statistic.".
I'm not sure where this flag is used in the game because it was also present in GTAVC's handling file, but as Vince already mentioned, the most likely use for it is the export minigame - something that doesn't make use of planes and boats.
Re: Extended Vehicle Information -
Kar - 23.05.2013
You. Are. The. Best. Person. I've. Ever. Met.
fMass <3
fCollisionDamageMultiplier <3
fBrakeBias <3
TransmissionData_fEngineAcceleration <3
TransmissionData_fMaxVelocity <3
Re: Extended Vehicle Information -
Yiin - 23.05.2013
Quote:
Originally Posted by Kar
Help?
|
pawn Код:
stock PrintMass()
{
new Float:vehicle_weight;
vehicle_weight = GetVehicleModelInfoAsFloat(Junkyard_Dog, "fMass");
printf("Junkyard_Dog weighs %f Newtons", vehicle_weight);
// or
printf("Junkyard_Dog weighs %f Newtons", GetVehicleModelInfoAsFloat(Junkyard_Dog, "fMass"));
/* ...
... */
return 1;
}
Re: Extended Vehicle Information -
MP2 - 23.05.2013
Quote:
Originally Posted by Jay_
I wouldn't rely on the nMonetaryValue flag for anything other than cars or maybe motorbikes. IIRC it's the default value of the vehicle which then varies depending on the damage inflicted to it. The official description of the flag is "Used to calculate the Value of property damaged statistic."
|
I see. I was planning on making a list of realistic prices soon anyway, shame this isn't realistic.
Off-topic:
Quote:
Originally Posted by Kar
pawn Код:
new Float:vehicle_weight; GetVehicleModelInfoAsFloat(Junkyard_Dog, "fMass"); printf("Junkyard_Dog weighs %f Newtons", vehicle_weight);
|
You do realise Newtons is the unit for measuring
force? The unit for mass is Kilograms (KG). This is also at the top of handling.cfg:
; > UNITS <
; ---------
; vehicle identifier 14 characters max
; dimensions in metres
; mass in Kg
; velocity in Km/h
; acceleration/deceleration in ms-2
; multipliers x1.0 is default
; angles in degrees
; Levels :- (L)ow, (M)edium, (H)igh
; buoyancy = percent submerged (> 100% vehicle sinks)
; engine type :- (P)etrol, (D)iesel, (E)lectric
; engine drive :- (F)ront, ®ear, (4)-wheel drive
Re: Extended Vehicle Information -
TheArcher - 23.05.2013
Very nice, everything is included in the database. Awesome, gonna use it
Re: Extended Vehicle Information -
Kar - 23.05.2013
Thanks Yiin, I didn't notice that.
Quote:
Originally Posted by MP2
You do realise Newtons is the unit for measuring force? The unit for mass is Kilograms (KG). This is also at the top of handling.cfg:
; > UNITS <
; ---------
; vehicle identifier 14 characters max
; dimensions in metres
; mass in Kg
; velocity in Km/h
; acceleration/deceleration in ms-2
; multipliers x1.0 is default
; angles in degrees
; Levels :- (L)ow, (M)edium, (H)igh
; buoyancy = percent submerged (> 100% vehicle sinks)
; engine type :- (P)etrol, (D)iesel, (E)lectric
; engine drive :- (F)ront, ®ear, (4)-wheel drive
|
Yes, newtons is for weight, i'm going to convert the values to newtons, why are you guys even studying that? the mass will be converted to weight after i get the values.
Re: Extended Vehicle Information -
startserv - 01.10.2014
Sorry for the translation (******.ru) did not find it useful to this file, the idea haroshaya but I have not earned is not on my server is not on a pure server 0 effect it is nothing but the determinant of the mass does not work. If I'm doing something wrong popravte pravidite least some examples where both so that navernika, were only interested in setting physics povideniya car flags alas not even about
Re: Extended Vehicle Information -
Pottus - 01.10.2014
It would appear Russian and English do not mix.
Re: Extended Vehicle Information -
Luis- - 04.05.2015
1 year bump.
I was wondering, can I use
TransmissionData_fMaxVelocity to work out a vehicles real speed?
Re: Extended Vehicle Information -
Luis- - 19.05.2015
Anyone know if I can do the above post?