IsPlayerInVehicle: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Function|Client|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|IsPlayerInVehicle( [, player])}} {{FuncParameters}} {{FuncParam||__EDIT_ME__}} {{FuncParamOptional..." |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Client|1.0}} | {{Info|Function|Client|1.0}} | ||
{{FuncDescription| | {{FuncDescription|Check if player is in vehicle or not.}} | ||
{{FuncSyntax|IsPlayerInVehicle( [, player])}} | {{FuncSyntax|IsPlayerInVehicle( [, player])}} | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParamOptional|player|The player identifier}} | |||
{{FuncParamOptional|player| | |||
{{FuncReturnValue| | {{FuncReturnValue|Returns '''true''' on success.}} | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua"> | |||
AddEvent("OnKeyPress", function(key) | |||
if not IsPlayerInVehicle() then | |||
return | |||
end | |||
AddPlayerChat(player, "You are in a vehicle.") | |||
end) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
{{VehicleFunctions}} |
Latest revision as of 16:42, 17 November 2019
Description
Check if player is in vehicle or not.
Syntax
IsPlayerInVehicle( [, player])
Parameters
- player (optional)
The player identifier
Return Value
- Returns true on success.
Example
AddEvent("OnKeyPress", function(key)
if not IsPlayerInVehicle() then
return
end
AddPlayerChat(player, "You are in a vehicle.")
end)
See also
- CreateVehicle
- DestroyVehicle
- IsValidVehicle
- GetVehicleCount
- GetAllVehicles
- GetVehicleModel
- GetVehicleModelName
- SetVehicleRespawnParams
- IsVehicleStreamedIn
- GetStreamedVehiclesForPlayer
- GetStreamedVehicles
- SetVehicleLocation
- GetVehicleLocation
- SetVehicleRotation
- GetVehicleRotation
- SetVehicleHeading
- GetVehicleHeading
- SetVehicleHealth
- GetVehicleHealth
- SetVehicleLicensePlate
- GetVehicleVelocity
- GetVehicleDriver
- GetVehiclePassenger
- GetVehicleNumberOfSeats
- SetVehicleColor
- GetVehicleColor
- SetVehicleLinearVelocity
- SetVehicleAngularVelocity
- GetVehicleGear
- SetVehicleHoodRatio
- GetVehicleHoodRatio
- SetVehicleTrunkRatio
- GetVehicleTrunkRatio
- StartVehicleEngine
- StopVehicleEngine
- GetVehicleEngineState
- SetVehicleLightEnabled
- GetVehicleLightState
- SetVehicleDamage
- GetVehicleDamage
- AttachVehicleNitro