Vehicle::lowerConvertibleRoof: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
(Added example)
Line 1: Line 1:
 
Lowers the roof of a convertable, can be done instantly or with the animation.
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">vehicle.lowerConvertibleRoof(instantlyLower);</syntaxhighlight>
<syntaxhighlight lang="javascript">vehicle.lowerConvertibleRoof(instantlyLower);</syntaxhighlight>
Line 7: Line 7:
*'''Undefined'''
*'''Undefined'''
==Example==
==Example==
<syntaxhighlight lang="javascript">
Pressing the F2 key will raise/lower your convertable roof
// todo
<div class="header" style="background-color: #AE4040; color: #FFFFFF; border: 2px solid #AE4040;">
</syntaxhighlight>
<div style="margin: 10px 10px 10px 10px;"><b>Client-Side</b></div>
<pre>
mp.keys.bind(0x71, true, function() {
    let roofState =  mp.players.local.vehicle.getConvertibleRoofState();
    if(roofState === 0){
        mp.players.local.vehicle.lowerConvertibleRoof(false);
    } else if (roofState === 2){
        mp.players.local.vehicle.raiseConvertibleRoof(false);
    } else {
        mp.gui.chat.push("Please wait for the roof to stop changing.");
    }
});
</pre>
</div>
==See also==
==See also==
{{Vehicle_function_c}}
{{Vehicle_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]

Revision as of 10:12, 13 October 2018

Lowers the roof of a convertable, can be done instantly or with the animation.

Syntax

vehicle.lowerConvertibleRoof(instantlyLower);

Required Arguments

  • instantlyLower: Boolean

Return value

  • Undefined

Example

Pressing the F2 key will raise/lower your convertable roof

Client-Side
mp.keys.bind(0x71, true, function() {
    let roofState =  mp.players.local.vehicle.getConvertibleRoofState();
    if(roofState === 0){
        mp.players.local.vehicle.lowerConvertibleRoof(false);
    } else if (roofState === 2){
        mp.players.local.vehicle.raiseConvertibleRoof(false);
    } else {
        mp.gui.chat.push("Please wait for the roof to stop changing.");
    }
});

See also