Vehicle::getVehicleModelMaxSpeed: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
Line 7: Line 7:
*'''float'''
*'''float'''
==Example==
==Example==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript" highlight='2'>
// todo
mp.events.add('render', () => {
let maxs = mp.game.vehicle.getVehicleModelMaxSpeed(localPlayer.vehicle.model); //max speed of vehicle
    let currents = localPlayer.vehicle.getSpeed(); // Current Speed
    mp.game.graphics.drawText(`Speed: ${(currents * 3.6).toFixed(0)}/ ${((maxs * 3.6).toFixed(0))} km/h`, [0.5, 0.005], { 
        font: 7,
        color: [255, 255, 255, 185],
        scale: [0.5, 0.5],
        outline: false
    }); // Displays on the top of the screen Speed: CurrentSpeed/Max speed in km/h
</syntaxhighlight>
</syntaxhighlight>
==See also==
==See also==
{{Vehicle_s_function_c}}
{{Vehicle_s_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Revision as of 10:49, 30 December 2017

Returns max speed (without mods) of the specified vehicle model in m/s.

For a full list, see here: pastebin.com/AUuHHK06

GET_VEHICLE_MODEL_*

Syntax

mp.game.vehicle.getVehicleModelMaxSpeed(modelHash);

Required Arguments

  • modelHash: Model hash or name

Return value

  • float

Example

mp.events.add('render', () => {
let maxs = mp.game.vehicle.getVehicleModelMaxSpeed(localPlayer.vehicle.model); //max speed of vehicle 
    let currents = localPlayer.vehicle.getSpeed(); // Current Speed
    mp.game.graphics.drawText(`Speed: ${(currents * 3.6).toFixed(0)}/ ${((maxs * 3.6).toFixed(0))} km/h`, [0.5, 0.005], {  
        font: 7, 
        color: [255, 255, 255, 185], 
        scale: [0.5, 0.5], 
        outline: false
    }); // Displays on the top of the screen Speed: CurrentSpeed/Max speed in km/h

See also