This wiki is using an old backup from 2020
Some information may be old/missing
0.4 version offers scripters the posibility to change a vehicles handling !
|
|
- Several functions for changing vehicle handling data have been added for plugins and scripts to use. Handling can be set separately for a model index and a specific vehicle. Handling is managed as a set of rules, each of which replace the default value of some handling parameter for some model index or a specific vehicle. If both apply for some vehicle, then the rules for that specific vehicle are used. Superior grip, flying and driving on water can also be set with these functions. Next comes the list of functions. I will shortly explain what each of these functions does.
int ResetAllVehicleHandlings(void);
unsigned int ExistsHandlingRule(int nModelIndex, int nRuleIndex);
int SetHandlingRule(int nModelIndex, int nRuleIndex, double fValue);
double GetHandlingRule(int nModelIndex, int nRuleIndex);
int ResetHandlingRule(int nModelIndex, int nRuleIndex);
int ResetHandling(int nModelIndex);
unsigned int ExistsInstHandlingRule(int nVehicleId, int nRuleIndex);
int SetInstHandlingRule(int nVehicleId, int nRuleIndex, double fValue);
double GetInstHandlingRule(int nVehicleId, int nRuleIndex);
int ResetInstHandlingRule(int nVehicleId, int nRuleIndex);
int ResetInstHandling(int nVehicleId);
- ResetAllVehicleHandlings resets all handling rules in the server. ResetHandling resets all handling rules that were set for a model index using SetHandlingRule. *ResetInstHandling resets the rules that had been set for a vehicle using SetInstHandlingRule. ResetHandlingRule and ResetInstHandlingRule can be used to reset specific handling settings for a specific model index or vehicle.
- ExistsHandlingRule will tell you if a specific handling setting has changed for this model using SetHandlingRule. ExistsInstHandlingRule does the same for specific vehicle instances.
- GetHandlingRule will return the value that was set using SetHandlingRule or if hadn’t been changed, the default value for that model index. GetInstHandlingRule returns the value that was set for that specific vehicle or otherwise it simply calls GetHandlingRule internally. These functions always return the value that is currently effective for that model or vehicle index.
- SetHandlingRule and SetInstHandlingRule are the functions that are used to actually apply new handling settings to vehicles. Note that only changed values are sent to clients, therefore it is best to keep changes as low as possible if you want to minimize bandwidth usage. Whenever you want to set a value to its original value, use the Reset* functions instead of using Set* functions with default value, since then those changes are basically deleted, causing the bandwidth usage to decrease.
- These are the rule indices that can be used with those functions:
1 Mass
2 DimensionsX
3 DimensionsY
4 DimensionsZ
5 CentreOfMassX
6 CentreOfMassY
7 CentreOfMassZ
8 PercentSubmerged
9 TractionMultiplier
10 TractionLoss
11 TractionBias
12 NumberOfGears
13 MaxSpeed
14 Acceleration
15 DriveType
16 EngineType
17 BrakeDeceleration
18 BrakeBias
19 SteeringLock
20 SuspensionForceLevel
21 SuspensionDampening
22 SeatOffset
23 DamageMultiplier
24 SuspensionUpperLimit
25 SuspensionLowerLimit
26 SuspensionBias
27 SuspensionAntiDive
28 Flags
29 LightsFront
30 LightsRear
31 SuperiorGrip
32 FlyingMode
33 DriveOnWater
- Flying/boat/bike specific handling rules cannot be changed yet, but will likely be implemented as well.
|
|