Vehicle::getModelMonetaryValue: Difference between revisions

From RAGE Multiplayer Wiki
(Created page with " {{ClientsideJsFunction}} {{JSContainer| ===Required Params=== *'''vehicleModel:''' {{RageType|number}} ===Return value=== *''' {{RageType|number}} ''' ==Syntax== <syntaxhighlight lang="javascript"> mp.game.vehicle.getModelMonetaryValue(vehicleModel) </syntaxhighlight> ==Example== <syntaxhighlight lang="javascript"> //todo </syntaxhighlight> }} ==See also== {{Vehicle_functions_c}} Category:Clientside API Category:TODO: Example")
 
No edit summary
 
Line 1: Line 1:
{{ClientsideJsFunction}}
{{ClientsideJsFunction}}
{{JSContainer|
{{JSContainer|


===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===
===Required Params===
*'''vehicleModel:''' {{RageType|number}}
*'''vehicleModel:''' {{RageType|number}} — The model hash of the vehicle.


===Return value===
===Return value===
*''' {{RageType|number}} '''
*'''{{RageType|number}}''' — The monetary value of the vehicle model.


==Syntax==
==Syntax==
Line 16: Line 17:


==Example==
==Example==
This example retrieves and displays the monetary value of a given vehicle model (e.g., `adder`).
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
//todo
// 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}`);
</syntaxhighlight>
</syntaxhighlight>
}}
}}

Latest revision as of 15:54, 9 November 2024

Client-Side
Function

 JavaScript



JavaScript Syntax


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}`);


See also