Vehicle::raiseConvertibleRoof: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
m (Fixed a typographical error in the listed example.)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Raises the roof of a convertable, can be done instantly or with the animation.


==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">vehicle.raiseConvertibleRoof(instantlyRaise);</syntaxhighlight>
<pre>vehicle.raiseConvertibleRoof(instantlyRaise);</pre>
 
=== Required Arguments ===
=== Required Arguments ===
*'''instantlyRaise:''' Boolean
*'''instantlyRaise:''' Boolean
===Return value===
===Return value===
*'''Undefined'''
*'''Undefined'''
==Example==
==Example==
<syntaxhighlight lang="javascript">
Pressing the F2 key will raise/lower your convertable roof
// todo
{{ClientsideCode|
</syntaxhighlight>
<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>
}}
 
==See also==
==See also==
{{Vehicle_function_c}}
{{Vehicle_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]

Latest revision as of 12:36, 19 October 2020

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

Syntax

vehicle.raiseConvertibleRoof(instantlyRaise);

Required Arguments

  • instantlyRaise: 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