Vehicle::getConvertibleRoofState: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
0 -&gt; up<br>1 -&gt; lowering down<br>2 -&gt; down<br>3 -&gt; raising up
__NOTOC__
 
Gets the current state of the roof of the convertible.
 
'''States'''
*0 - Up
*1 - Lowering Down
*2 - Down
*3 - Raising Up
 
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">vehicle.getConvertibleRoofState();</syntaxhighlight>
<pre>vehicle.getConvertibleRoofState();</pre>
=== Required Arguments ===
 
===Return value===
===Return value===
*'''int'''
*'''int'''
==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_definition_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]

Latest revision as of 11:33, 9 May 2024


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