GetVehicleOccupant: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
[[Category:Incomplete]]
[[Category:Needs Checking]]


__NOTOC__  
__NOTOC__  
This fake function is for use with blah & blah and does blahblahblabhalbhl
This function gets the player sitting in the specified vehicle.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
player getVehicleOccupant ( vehicle vehicle, [ int seat=0 ] )             
player getVehicleOccupant ( vehicle theVehicle, [ int seat=0 ] )             
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
*'''argumentName:''' description
*'''theVehicle:''' The vehicle from which you wish to retrive the player.


===Optional Arguments===  
===Optional Arguments===  
{{OptionalArg}}  
{{OptionalArg}}  
*'''argumentName2:''' descriptiona
*'''seat:''' The seat where the player is sitting (0 for driver, 1+ for passengers).
*'''argumentName3:''' description


===Returns===
===Returns===
Returns ''true'' if blah, ''false'' otherwise.
Returns the [[player]] sitting in the vehicle, or ''false'' if the seat is unoccupied or doesn't exist.


==Example==  
==Example==  
This example does...
This example announces the driver of a certain vehicle whenever it is damaged:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
addEventHandler ( "onVehicleDamage", stolenVehicle, "onStolenVehicleDamage" )
blabhalbalhb --abababa
function onStolenVehicleDamage ( loss )
--This line does this...
  driver = getVehicleOccupant ( source ) -- get the player sitting in seat 0
mooo
  if ( driver ) then -- if the driver exists, display a message
    outputChatBox ( getClientName ( driver ) .. " is wrecking the vehicle he stole!" )
  end
end
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{FunctionArea_Functions}}
{{FunctionArea_Functions}}

Revision as of 20:25, 28 August 2006


This function gets the player sitting in the specified vehicle.

Syntax

player getVehicleOccupant ( vehicle theVehicle, [ int seat=0 ] )            

Required Arguments

  • theVehicle: The vehicle from which you wish to retrive the player.

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • seat: The seat where the player is sitting (0 for driver, 1+ for passengers).

Returns

Returns the player sitting in the vehicle, or false if the seat is unoccupied or doesn't exist.

Example

This example announces the driver of a certain vehicle whenever it is damaged:

addEventHandler ( "onVehicleDamage", stolenVehicle, "onStolenVehicleDamage" )
function onStolenVehicleDamage ( loss )
  driver = getVehicleOccupant ( source ) -- get the player sitting in seat 0
  if ( driver ) then -- if the driver exists, display a message
    outputChatBox ( getClientName ( driver ) .. " is wrecking the vehicle he stole!" )
  end
end

See Also

Template:FunctionArea Functions