-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vehicles/stats): update some natives for vehicles stats (#965)
* Update GetVehicleAcceleration * Update GetMakeNameFromVehicleModel * Update GetVehicleEstimatedMaxSpeed * Update/Rename GetVehicleModelMoveResistance
- Loading branch information
Showing
5 changed files
with
318 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
--- | ||
ns: VEHICLE | ||
aliases: ["0x5AA3F878A178C4FC", "_GET_VEHICLE_MODEL_MOVE_RESISTANCE"] | ||
--- | ||
## GET_BOAT_VEHICLE_MODEL_AGILITY | ||
|
||
```c | ||
// 0x5AA3F878A178C4FC 0x87C5D271 | ||
float GET_BOAT_VEHICLE_MODEL_AGILITY(Hash modelHash); | ||
``` | ||
Retrieves the agility for a specific boat model, including any vehicle mods. Unlike other vehicles where Rockstar Games typically assess performance based on traction, boats use agility as a measure. This static value is distinct from the traction metrics used for other vehicle types. | ||
``` | ||
NativeDB Introduced: v323 | ||
``` | ||
## Parameters | ||
* **modelHash**: The model hash of the boat. | ||
## Return value | ||
Returns the agility value of the specified boat as a float number. | ||
## Examples | ||
```lua | ||
-- This example prints the agility of the player's current boat. | ||
-- Retrieve the player ped. | ||
local playerPed = PlayerPedId() | ||
-- Retrieve the vehicle the player is currently in. | ||
local vehicle = GetVehiclePedIsIn(playerPed, false) | ||
-- Retrieve the model hash of the boat. | ||
local boatHash = GetEntityModel(vehicle) | ||
-- If the vehicle does not exist or is not a boat, end the execution of the code here. | ||
if not DoesEntityExist(vehicle) or not IsThisModelABoat(boatHash) then | ||
return | ||
end | ||
-- Retrieve the agility of the boat. | ||
local agility = GetBoatVehicleModelAgility(boatHash) | ||
-- Print the agility of the boat. | ||
print("Boat Agility: " .. agility) | ||
``` | ||
|
||
```js | ||
// This example prints the agility of the player's current boat. | ||
|
||
// Retrieve the player ped. | ||
const playerPed = PlayerPedId(); | ||
|
||
// Retrieve the vehicle the player is currently in. | ||
const vehicle = GetVehiclePedIsIn(playerPed, false); | ||
|
||
// Retrieve the model hash of the boat. | ||
const boatHash = GetEntityModel(vehicle); | ||
|
||
// If the vehicle does not exist or is not a boat, end the execution of the code here. | ||
if (!DoesEntityExist(vehicle) || !IsThisModelABoat(boatHash)) { | ||
return; | ||
} | ||
|
||
// Retrieve the agility of the boat. | ||
const agility = GetBoatVehicleModelAgility(boatHash); | ||
|
||
// Print the agility of the boat. | ||
console.log(`Boat Agility: ${agility}`); | ||
``` | ||
|
||
```cs | ||
// This example prints the agility of the player's current boat. | ||
using static CitizenFX.Core.Native.API; | ||
|
||
// Retrieve the player ped. | ||
Ped playerPed = PlayerPedId(); | ||
|
||
// Retrieve the vehicle the player is currently in. | ||
Vehicle vehicle = GetVehiclePedIsIn(playerPed, false); | ||
|
||
// Retrieve the model hash of the boat. | ||
uint boatHash = GetEntityModel(vehicle); | ||
|
||
// If the vehicle does not exist or is not a boat, end the execution of the code here. | ||
if (!DoesEntityExist(vehicle) || !IsThisModelABoat(boatHash)) { | ||
return; | ||
} | ||
|
||
// Retrieve the agility of the boat. | ||
const float agility = GetBoatVehicleModelAgility(boatHash); | ||
|
||
// Print the agility of the boat. | ||
Debug.WriteLine($"Boat Agility: {agility}"); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,96 @@ | ||
--- | ||
ns: VEHICLE | ||
aliases: ["_GET_MAKE_NAME_FROM_VEHICLE_MODEL"] | ||
--- | ||
## _GET_MAKE_NAME_FROM_VEHICLE_MODEL | ||
## GET_MAKE_NAME_FROM_VEHICLE_MODEL | ||
|
||
```c | ||
// 0xF7AF4F159FF99F97 | ||
char* _GET_MAKE_NAME_FROM_VEHICLE_MODEL(Hash modelHash); | ||
char* GET_MAKE_NAME_FROM_VEHICLE_MODEL(Hash modelHash); | ||
``` | ||
Will return a vehicle's manufacturer display label. | ||
Returns "CARNOTFOUND" if the hash doesn't match a vehicle hash. | ||
Retrieves the manufacturer's name for a specified vehicle. | ||
``` | ||
NativeDB Introduced: v1868 | ||
``` | ||
## Parameters | ||
* **modelHash**: | ||
* **modelHash**: The model hash of the vehicle. | ||
## Return value | ||
Returns the display label of the manufacturer if the vehicle model is recognized, or "CARNOTFOUND" if the hash does not correspond to any known vehicle model. | ||
## Examples | ||
```lua | ||
-- This example prints the manufacturer of the player's current vehicle. | ||
-- Retrieve the player ped. | ||
local playerPed = PlayerPedId() | ||
-- Retrieve the vehicle the player is currently in. | ||
local vehicle = GetVehiclePedIsIn(playerPed, false) | ||
-- If the vehicle does not exist, end the execution of the code here. | ||
if not DoesEntityExist(vehicle) then | ||
return | ||
end | ||
-- Retrieve the model hash of the vehicle. | ||
local vehicleHash = GetEntityModel(vehicle) | ||
-- Retrieve the manufacturer of the vehicle. | ||
local manufacturer = GetMakeNameFromVehicleModel(vehicleHash) | ||
-- Print the manufacturer of the vehicle. | ||
print("Vehicle Manufacturer: " .. manufacturer) | ||
``` | ||
|
||
```js | ||
// This example prints the manufacturer of the player's current vehicle. | ||
|
||
// Retrieve the player ped. | ||
const playerPed = PlayerPedId(); | ||
|
||
// Retrieve the vehicle the player is currently in. | ||
const vehicle = GetVehiclePedIsIn(playerPed, false); | ||
|
||
// If the vehicle does not exist, end the execution of the code here. | ||
if (!DoesEntityExist(vehicle)) { | ||
return; | ||
} | ||
|
||
// Retrieve the model hash of the vehicle. | ||
const vehicleHash = GetEntityModel(vehicle); | ||
|
||
// Retrieve the manufacturer of the vehicle. | ||
const manufacturer = GetMakeNameFromVehicleModel(vehicleHash); | ||
|
||
// Print the manufacturer of the vehicle. | ||
console.log(`Vehicle Manufacturer: ${manufacturer}`); | ||
``` | ||
|
||
```cs | ||
// This example prints the manufacturer of the player's current vehicle. | ||
using static CitizenFX.Core.Native.API; | ||
|
||
// Retrieve the player ped. | ||
Ped playerPed = PlayerPedId(); | ||
|
||
// Retrieve the vehicle the player is currently in. | ||
Vehicle vehicle = GetVehiclePedIsIn(playerPed, false); | ||
|
||
// If the vehicle does not exist, end the execution of the code here. | ||
if (!DoesEntityExist(vehicle)) { | ||
return; | ||
} | ||
|
||
// Retrieve the model hash of the vehicle. | ||
uint vehicleHash = (uint)GetEntityModel(vehicle); | ||
|
||
// Retrieve the manufacturer of the vehicle. | ||
string manufacturer = GetMakeNameFromVehicleModel(vehicleHash); | ||
|
||
// Print the manufacturer of the vehicle. | ||
Debug.WriteLine($"Vehicle Manufacturer: {manufacturer}"); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.