Player::vehicle: Difference between revisions

From RAGE Multiplayer Wiki
(Created page with "This property returns player vehicle or nil. '''Note: this property is read-only.''' == Example == <source lang="javascript"> if (player.vehicle) player.outputChatBox('You...")
 
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
This property returns player vehicle or nil.
{{SharedFunctionJS}}
Returns the vehicle object the player is currently sitting in.
 
==Getter==
* {{RageType|Object}} - Vehicle
 
 
{{JSContainer|
== Syntax ==
<pre>player.vehicle</pre>


'''Note: this property is read-only.'''
== Example ==
== Example ==
<source lang="javascript">
{{ServersideCode|
<pre>
if (player.vehicle)
if (player.vehicle)
   player.outputChatBox('You are in the vehicle right now!');
   player.outputChatBox('You are in the vehicle right now!');
else
else
   player.outputChatBox('You are not in the vehicle right now!');
   player.outputChatBox('You are not in the vehicle right now!');
</source>
</pre>
}}
}}
==See Also==
{{Player_block}}
 
[[Category:Player API]]
[[Category:Shared Property]]

Latest revision as of 22:27, 20 April 2020

Shared
Function

 JavaScript


Returns the vehicle object the player is currently sitting in.

Getter

  • Object - Vehicle


JavaScript Syntax

Syntax

player.vehicle

Example

Server-Side
if (player.vehicle)
  player.outputChatBox('You are in the vehicle right now!');
else
  player.outputChatBox('You are not in the vehicle right now!');


See Also