Difference between revisions of "GetCurrentVehicleEntityId"
From Nomad DB
(Created page with "Returns the EntityId of the Vehicle, that a Player/NPC is sitting in. == Syntax == <pre> GetCurrentVehicleEntityId(EntityId) </pre> * '''EntityId''' of target Player/...") |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | Returns the [[EntityId]] of the | + | Returns the [[EntityId|Entity ID]] of the vehicle that the specified [[pawn]] is currently sitting in. |
== Syntax == | == Syntax == | ||
Line 5: | Line 5: | ||
GetCurrentVehicleEntityId(EntityId) | GetCurrentVehicleEntityId(EntityId) | ||
</pre> | </pre> | ||
− | * '''[[EntityId]] | + | * '''EntityId''': [[EntityId|Entity ID]] of the target [[pawn]] |
− | * '''Returns: [[EntityId]] | + | * '''Returns''': [[EntityId|Entity ID]] of the vehicle |
== Example == | == Example == | ||
This function checks if the local player is sitting in a vehicle. | This function checks if the local player is sitting in a vehicle. | ||
− | < | + | <syntaxhighlight lang="lua"> |
local function IsPlayerInVehicle() | local function IsPlayerInVehicle() | ||
local plyId = GetLocalPlayerEntityId() | local plyId = GetLocalPlayerEntityId() | ||
Line 18: | Line 18: | ||
return GetCurrentVehicleEntityId(plyId) ~= GetInvalidEntityId() | return GetCurrentVehicleEntityId(plyId) ~= GetInvalidEntityId() | ||
end | end | ||
− | </ | + | </syntaxhighlight > |
== Related Pages == | == Related Pages == |
Latest revision as of 19:59, 14 April 2020
Returns the Entity ID of the vehicle that the specified pawn is currently sitting in.
Syntax
GetCurrentVehicleEntityId(EntityId)
Example
This function checks if the local player is sitting in a vehicle.
local function IsPlayerInVehicle()
local plyId = GetLocalPlayerEntityId()
if plyId == GetInvalidEntityId() then
return false
end
return GetCurrentVehicleEntityId(plyId) ~= GetInvalidEntityId()
end