-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7f7f18
commit a2ebbee
Showing
6 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
lib.locale() | ||
|
||
if Config.target == "ox" or Config.target == "ox_target" then | ||
local vehicleOptions = { | ||
icon = Config.icon, | ||
label = Config.label, | ||
distance = Config.distance, | ||
groups = Config.jobs, | ||
onSelect = function(data) | ||
if lib.progressBar({ | ||
duration = Config.progressBarduration, | ||
label = Config.progressBarlabel, | ||
useWhileDead = false, | ||
canCancel = true, | ||
disable = { | ||
car = true, | ||
move = true, | ||
combat = true, | ||
}, | ||
anim = { scenario = Config.towingScenario } | ||
}) then | ||
Notify("Towing", locale("towedsoon"), 2500) | ||
Wait(Config.WaitTimeBeforeDelete) | ||
TriggerServerEvent('lion_towing:tow', NetworkGetNetworkIdFromEntity(data.entity)) | ||
Notify("Towing", locale("towed"), 2500) | ||
end | ||
end | ||
} | ||
exports.ox_target:addGlobalVehicle(vehicleOptions) | ||
|
||
elseif Config.target == "qb" or Config.target == "qb-target" then | ||
local vehicleOptions = { | ||
{ | ||
label = Config.label, | ||
icon = Config.icon, | ||
job = Config.jobs, | ||
action = function(entity) | ||
if lib.progressBar({ | ||
duration = Config.progressBarduration, | ||
label = Config.progressBarlabel, | ||
useWhileDead = false, | ||
canCancel = true, | ||
disable = { | ||
car = true, | ||
move = true, | ||
combat = true, | ||
}, | ||
anim = { scenario = Config.towingScenario } | ||
}) then | ||
Notify("Towing", locale("towedsoon"), 2500) | ||
Wait(Config.WaitTimeBeforeDelete) | ||
TriggerServerEvent('lion_towing:tow', NetworkGetNetworkIdFromEntity(entity)) | ||
Notify("Towing", locale("towed"), 2500) | ||
end | ||
end | ||
} | ||
} | ||
|
||
exports['qb-target']:AddTargetModel(GetHashKey('adder'), { | ||
options = vehicleOptions, | ||
distance = Config.distance | ||
}) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Config = {} | ||
|
||
-- TARGET SETTINGS | ||
Config.target = "ox" -- ox_target/ox or qb-target/qb | ||
Config.icon = "fas fa-car-side" -- Only fontawesome icons free https://fontawesome.com/search?o=r&m=free | ||
Config.label = "Tow Vehicle" -- Text on the target | ||
Config.distance = 2.0 -- Distance when you see the target on the vehicle | ||
Config.jobs = {['police']= 0} -- For more groups {['police']= 0, ['sheriff']= 0 } or just "police" | ||
|
||
-- PROGRESSBAR SETTINGS / If you want edit more go to client/client.lua | ||
Config.progressBarduration = 5000 -- DURATION IN MILISECONDS | ||
Config.progressBarlabel = "🚗 Towing Vehicle" -- TEXT ON THE PROGRESSBAR | ||
Config.towingScenario = "WORLD_HUMAN_CLIPBOARD" -- https://github.com/DioneB/gtav-scenarios | ||
Config.WaitTimeBeforeDelete = 8000 -- IN MILISECONDS, Time when you tow and need to wait before the vehicle is deleted | ||
|
||
Notify = function(title, desciption, duration) -- SET HERE YOUR OWN NOTIFICATIONS | ||
lib.notify({ | ||
title = title, | ||
description = desciption, | ||
icon = 'fas fa-car-side', | ||
iconColor = "#db9d00", | ||
duration = duration | ||
}) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
fx_version "cerulean" | ||
game "gta5" | ||
lua54 "true" | ||
|
||
name "lion_towing" | ||
author "Mrlion (@lostedmrlion)" | ||
description "Standalone for towing vehicles" | ||
version '2.0' | ||
repository 'https://github.com/L0stedMrlion/lion_towing' | ||
|
||
shared_scripts { | ||
'@ox_lib/init.lua', | ||
"config.lua" | ||
} | ||
|
||
client_scripts { | ||
"client/client.lua" | ||
} | ||
|
||
server_scripts { | ||
"server/server.lua" | ||
} | ||
|
||
files { | ||
'locales/*.json' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"towedsoon": "Vozidlo bude brzy odtaženo!", | ||
"towed": "Vozidlo bylo úspěsně odtaženo!" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"towedsoon": "Vehicle will be towed soon!", | ||
"towed": "Vehicle was successfully towed!" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
RegisterNetEvent('lion_towing:tow',function (entity) | ||
DeleteEntity(NetworkGetEntityFromNetworkId(entity)) | ||
end) | ||
|
||
if not lib.checkDependency('ox_lib', '3.22.2') then | ||
error() | ||
end | ||
|
||
AddEventHandler('onResourceStart', function(resourceName) | ||
if resourceName ~= GetCurrentResourceName() then | ||
return | ||
end | ||
|
||
if resourceName ~= "lion_towing" then | ||
lib.print.warn("The resource name must be 'lion_towing'. Current resource name: " .. resourceName) | ||
StopResource(resourceName) | ||
end | ||
end) |