Skip to main content

Vehicle::getModelMonetaryValue

Client-side function

JavaScript​

Explanation​

The getModelMonetaryValue function retrieves the in-game monetary value of a specified vehicle model, identified by its model hash. This value can be used for various purposes, such as checking the cost of a vehicle or implementing custom pricing logic.

Required Params​

  • vehicleModel: number — The model hash of the vehicle.

Return value​

  • 'number' — The monetary value of the vehicle model.

Syntax​

mp.game.vehicle.getModelMonetaryValue(vehicleModel)

Example​

This example retrieves and displays the monetary value of a given vehicle model (e.g., adder).

// Define the vehicle model by its hash
const adderModelHash = mp.game.joaat("adder");

// Get the monetary value of the vehicle model
const monetaryValue = mp.game.vehicle.getModelMonetaryValue(adderModelHash);

// Display the monetary value in chat
mp.gui.chat.push(`Monetary Value of Adder: $${monetaryValue}`);