GetPlayerOccupiedVehicleSeat: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (Changed "DeprecatedWithAlt" template to "Deprecated")
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server function}}
{{Server function}}
{{Deprecated|getPedOccupiedVehicleSeat|}}
This function gets the seat that a specific player is sitting in in a vehicle.
This function gets the seat that a specific player is sitting in in a vehicle.


Line 10: Line 12:


===Returns===
===Returns===
Returns an integer containing the number of the seat that the player is currently in, if any. Returns false if the player is on foot, or the player doesn't exist.
Returns an integer containing the number of the seat that the player is currently in, if any. Returns ''false'' if the player is on foot, or the player doesn't exist.


==Example==
==Example==
This example finds what seat the player called ''someguy'' is sitting in and outputs it to the chat box.
This example finds what seat the player called 'someguy' is sitting in and outputs it to the chat box.
<syntaxhighlight lang="lua">if ( vehicle = getPlayerOccupiedVehicle ( findPlayer ( "someguy" ) ) )
<syntaxhighlight lang="lua">
  outputChatBox ( "someguy is in a vehicle in seat number " .. getPlayerOccupiedVehicleSeat ( findPlayer ( "Someguy" ) ) .. "." )
thePlayer = getPlayerFromNick ( "someguy" )
theVehicle = getPlayerOccupiedVehicle ( thePlayer )
if ( theVehicle ) then
    outputChatBox ( "someguy is in a vehicle in seat number " .. getPlayerOccupiedVehicleSeat ( thePlayer ) .. "." )
else
else
  outputChatBox ( "someguy is not in a vehicle." )
    outputChatBox ( "someguy is not in a vehicle." )
end</syntaxhighlight>
end
</syntaxhighlight>


==See Also==
==See Also==
{{Player functions}}
{{Player functions}}

Latest revision as of 16:13, 13 February 2015

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use getPedOccupiedVehicleSeat instead.


This function gets the seat that a specific player is sitting in in a vehicle.

Syntax

int getPlayerOccupiedVehicleSeat ( player thePlayer )

Required Arguments

  • thePlayer: The player whose vehicle seat you're looking up.

Returns

Returns an integer containing the number of the seat that the player is currently in, if any. Returns false if the player is on foot, or the player doesn't exist.

Example

This example finds what seat the player called 'someguy' is sitting in and outputs it to the chat box.

thePlayer = getPlayerFromNick ( "someguy" )
theVehicle = getPlayerOccupiedVehicle ( thePlayer )
if ( theVehicle ) then
    outputChatBox ( "someguy is in a vehicle in seat number " .. getPlayerOccupiedVehicleSeat ( thePlayer ) .. "." )
else
    outputChatBox ( "someguy is not in a vehicle." )
end

See Also