mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-17 05:56:01 +01:00
update: keyfob anim
This commit is contained in:
@@ -74,6 +74,9 @@ end)
|
||||
local function playKeyFob(veh)
|
||||
local keyFob
|
||||
local ped = cache.ped
|
||||
local coords = GetEntityCoords(ped)
|
||||
if #(coords-GetEntityCoords(veh)) > 25.0 then return end
|
||||
|
||||
if GetVehiclePedIsIn(ped) == 0 then
|
||||
ClearPedTasks(ped)
|
||||
lib.requestAnimDict("anim@mp_player_intmenu@key_fob@")
|
||||
@@ -94,13 +97,13 @@ local function playKeyFob(veh)
|
||||
return keyFob and DeleteEntity(keyFob)
|
||||
end
|
||||
|
||||
RegisterNetEvent("ND_Vehicles:keyFob", function(vehicleNetId)
|
||||
playKeyFob(NetToVeh(vehicleNetId))
|
||||
end)
|
||||
|
||||
AddStateBagChangeHandler("locked", nil, function(bagName, key, value, reserved, replicated)
|
||||
local entity = GetEntityFromStateBagName(bagName)
|
||||
if entity == 0 then return end
|
||||
|
||||
CreateThread(function()
|
||||
playKeyFob(entity)
|
||||
end)
|
||||
|
||||
if value then
|
||||
SetVehicleDoorsLocked(entity, 4)
|
||||
@@ -128,3 +131,9 @@ lib.callback.register("ND_Vehicles:getNearbyVehicleById", function(vehId)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
lib.callback.register("ND_Vehicles:getVehicleModelMakeLabel", function(model)
|
||||
local make = GetLabelText(GetMakeNameFromVehicleModel(model))
|
||||
local name = GetLabelText(GetDisplayNameFromVehicleModel(model))
|
||||
return ("%s %s"):format(make, name)
|
||||
end)
|
||||
|
||||
@@ -244,6 +244,7 @@ if Config.useInventoryForKeys then
|
||||
local state = Entity(veh).state
|
||||
local locked = not state.locked
|
||||
state.locked = locked
|
||||
player.triggerEvent("ND_Vehicles:keyFob", NetworkGetNetworkIdFromEntity(veh))
|
||||
if locked then
|
||||
player.notify({
|
||||
title = "LOCKED",
|
||||
|
||||
Reference in New Issue
Block a user