From f2138473ea754d1576438e88e7f353f18e7ada3b Mon Sep 17 00:00:00 2001 From: Nathan Falvey Date: Mon, 19 Jan 2026 22:00:54 +0000 Subject: [PATCH] Add function to return player's current vehicle if available --- effect_template.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/effect_template.lua b/effect_template.lua index 404b32e..a8cc209 100644 --- a/effect_template.lua +++ b/effect_template.lua @@ -55,6 +55,15 @@ function GET_PLAYER_PED_OFFSET(offset_x, offset_y, offset_z) return GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(player_ped, offset_x, offset_y, offset_z) end +function RETURN_PLAYER_VEHICLE() + local player_ped = PLAYER_PED_ID() + if IS_PED_IN_ANY_VEHICLE(player_ped, false) then + local vehicle = GET_VEHICLE_PED_IS_IN(player_ped, false) + return vehicle + end + return nil +end + function GET_PLAYER_PED_HEADING() local player_ped = PLAYER_PED_ID() return GET_ENTITY_HEADING(player_ped)