Vehicle::getConvertibleRoofState: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
m (Replaced HTML with template)
Line 1: Line 1:
__TOC__
Gets the current state of the roof of the convertible.
Gets the current state of the roof of the convertible.


Line 8: Line 6:
*2 - Down
*2 - Down
*3 - Raising Up
*3 - Raising Up
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">vehicle.getConvertibleRoofState();</syntaxhighlight>
<pre>vehicle.getConvertibleRoofState();</pre>
 
===Return value===
===Return value===
*'''int'''
*'''int'''
==Example==
==Example==
Pressing the F2 key will raise/lower your convertable roof
Pressing the F2 key will raise/lower your convertable roof
<div class="header" style="background-color: #AE4040; color: #FFFFFF; border: 2px solid #AE4040;">
{{ClientsideCode|
<div style="margin: 10px 10px 10px 10px;"><b>Client-Side</b></div>
<pre>
<pre>
mp.keys.bind(0x71, true, function() {
mp.keys.bind(0x71, true, function() {
Line 28: Line 28:
});
});
</pre>
</pre>
</div>
}}
 
==See also==
==See also==
{{Vehicle_function_c}}
{{Vehicle_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]

Revision as of 13:28, 26 October 2018

Gets the current state of the roof of the convertible.

States

  • 0 - Up
  • 1 - Lowering Down
  • 2 - Down
  • 3 - Raising Up

Syntax

vehicle.getConvertibleRoofState();

Return value

  • int

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