Vehicle::setDoorShut: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
doorIndex:<br>0 = Front Left Door<br>1 = Front Right Door<br>2 = Back Left Door<br>3 = Back Right Door<br>4 = Hood<br>5 = Trunk<br>6 = Trunk2
{{ClientsideJsFunction}}
 
Shuts the door of the vehicle.
 
doorIndex:
* 0 = Front Left Door
* 1 = Front Right Door
* 2 = Back Left Door
* 3 = Back Right Door
* 4 = Hood
* 5 = Trunk
* 6 = Back
* 7 = Back2
 
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">vehicle.setDoorShut(doorIndex, closeInstantly);</syntaxhighlight>
<pre>vehicle.setDoorShut(doorIndex, closeInstantly);</pre>
 
=== Required Arguments ===
=== Required Arguments ===
*'''doorIndex:''' int
*'''doorIndex:''' {{RageType|Int}}
*'''closeInstantly:''' Boolean
*'''closeInstantly:''' {{RageType|Boolean}}
 
===Return value===
===Return value===
*'''Undefined'''
*'''Undefined'''
==Example==
==Example==
<syntaxhighlight lang="javascript">
When in a vehicle, pressing the N key will open/close the hood
// todo
{{ClientsideCode|
</syntaxhighlight>
<pre>
mp.keys.bind(0x4E, true, function() {  // N Key
    if(mp.players.local.vehicle){
        if (mp.players.local.vehicle.hood){
            mp.players.local.vehicle.hood = false;
            mp.players.local.vehicle.setDoorShut(4, true);
        } else {
            mp.players.local.vehicle.hood = true;
            mp.players.local.vehicle.setDoorOpen(4, false, true);
        }
    }
});
</pre>
}}
 
==See also==
==See also==
{{Vehicle_function_c}}
{{Vehicle_definition_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]

Latest revision as of 00:24, 29 January 2019

Client-Side
Function

 JavaScript



Shuts the door of the vehicle.

doorIndex:

  • 0 = Front Left Door
  • 1 = Front Right Door
  • 2 = Back Left Door
  • 3 = Back Right Door
  • 4 = Hood
  • 5 = Trunk
  • 6 = Back
  • 7 = Back2

Syntax

vehicle.setDoorShut(doorIndex, closeInstantly);

Required Arguments

  • doorIndex: Int
  • closeInstantly: Boolean

Return value

  • Undefined

Example

When in a vehicle, pressing the N key will open/close the hood

Client-Side
mp.keys.bind(0x4E, true, function() {   // N Key
    if(mp.players.local.vehicle){
        if (mp.players.local.vehicle.hood){
            mp.players.local.vehicle.hood = false;
            mp.players.local.vehicle.setDoorShut(4, true);
        } else {
            mp.players.local.vehicle.hood = true;
            mp.players.local.vehicle.setDoorOpen(4, false, true);
        }
    }
});

See also