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 |
||
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|__EDIT_ME__}} | {{FuncReturnValue|__EDIT_ME__}} | ||
== 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}} |
Revision as of 16:40, 17 November 2019
Description
Check if player is in vehicle or not.
Syntax
IsPlayerInVehicle( [, player])
Parameters
- player (optional)
The player identifier
Return Value
- __EDIT_ME__
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