65 lines
2.5 KiB
Lua
65 lines
2.5 KiB
Lua
-- ======= DO NOT EDIT THIS FILE ======= --
|
|
|
|
if TLS.Vest.Enable then
|
|
local oldVest, oldTexture = 0, 0
|
|
|
|
RegisterNetEvent('thinline_assets:resetVest', function()
|
|
oldVest, oldTexture = 0, 0
|
|
end)
|
|
|
|
RegisterCommand(TLS.Vest.Command, function()
|
|
local playerPed = PlayerPedId()
|
|
local currentGender, currentVest, currentTexture = TLS.Functions.GetPlayerGender(playerPed), TLS.Functions.GetPlayerDrawable(playerPed, 9, false)
|
|
local vehicle, isNearTrunk = TLS.Functions.GetClosestPoliceVehicle(playerPed)
|
|
if TLS.Vest.EnableTrunk then
|
|
if not isNearTrunk then
|
|
TLS.Functions.ShowNotification(TLS.Language.NotNear)
|
|
return
|
|
end
|
|
end
|
|
if oldVest ~= 0 then
|
|
RequestAnimDict('clothingtie')
|
|
while not HasAnimDictLoaded('clothingtie') do
|
|
Wait(10)
|
|
end
|
|
TaskPlayAnim(playerPed, 'clothingtie', 'try_tie_negative_a', 3.0, 3.0, -1, 49, 0, 0, 0, 0)
|
|
if TLS.Vest.EnableTrunk then
|
|
SetVehicleDoorOpen(vehicle, 5, false, true)
|
|
end
|
|
Wait(1300)
|
|
SetPedComponentVariation(playerPed, 9, oldVest, oldTexture, 0)
|
|
oldVest, oldTexture = 0, 0
|
|
Wait(100)
|
|
if TLS.Vest.EnableTrunk then
|
|
SetVehicleDoorShut(vehicle, 5, false)
|
|
end
|
|
ClearPedTasks(playerPed)
|
|
RemoveAnimDict('clothingtie')
|
|
return
|
|
end
|
|
for k, v in ipairs(TLS.Vest[currentGender]) do
|
|
if v == currentVest then
|
|
RequestAnimDict('clothingtie')
|
|
while not HasAnimDictLoaded('clothingtie') do
|
|
Wait(10)
|
|
end
|
|
TaskPlayAnim(playerPed, 'clothingtie', 'try_tie_negative_a', 3.0, 3.0, -1, 49, 0, 0, 0, 0)
|
|
if TLS.Vest.EnableTrunk then
|
|
SetVehicleDoorOpen(vehicle, 5, false, true)
|
|
end
|
|
Wait(1300)
|
|
SetPedComponentVariation(playerPed, 9, 0, 0, 0)
|
|
oldVest, oldTexture = currentVest, currentTexture
|
|
Wait(100)
|
|
if TLS.Vest.EnableTrunk then
|
|
SetVehicleDoorShut(vehicle, 5, false)
|
|
end
|
|
ClearPedTasks(playerPed)
|
|
RemoveAnimDict('clothingtie')
|
|
break
|
|
end
|
|
end
|
|
end, false)
|
|
|
|
RegisterKeyMapping(TLS.Vest.Command, TLS.Vest.Label, 'keyboard', TLS.Vest.Keybind)
|
|
end |