1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-08-13 20:15:04 +02:00
parent 41d330bde5
commit d6225ef198
15 changed files with 2447 additions and 0 deletions

Binary file not shown.

View file

@ -0,0 +1,67 @@
######
## There are no longer circles- makesure to read the controls. Bed controls are done at the back left or right of the truck.
#####
## Default Controls:
[E] - At bed to attach / detach vehicle (useable in vehicle on bed as well)
[LeftArrow] - Attach, Wind winch
[RightArrow] - Unwind winch
[UpArrow] - Raise Bed (automatic, click once)
[DownArrow] - Lower Bed (automatic, click once)
[G] - Remove Rope
[SHIFT] - Access Hand Winch controls
[SHIFT] + [LeftArrow] - Grab winch
[SHIFT] + [RightArrow] - Return winch
[SHIFT] + [E] - Attach winch
## How to use:
# For ROLLING beds:
1. Lower bed
2. Ensure the vehicle is behind the truck close to the bed
3. Press Left Arrow next to the flatbed truck body to attach the winch
4. Press Left Arrow again to wind the winch
5. Press E when the vehicle is ON the bed. If the vehicle is inside the bed, or too high, press E to disconnect then E again to reconnect the car.
# For Static beds:
1. Ensure the car is behind the truck.
2. Press E next to the truck, or inside the car.
## Exports / Events:
# wind start/stop winding the winch
targetflatbedWind(truck)
# OR connect target or wind start/stop winding the winch
targetflatbedWind(truck, target)
# event:
"ebu_flatbeds:client:targetflatbedWind"
# start/stop unwinding the winch
targetflatbedUnWind(truck)
# event:
"ebu_flatbeds:client:targetflatbedUnWind"
# attach/detach vehicle on bed
targetflatbedAtt(truck)
# event:
"ebu_flatbeds:client:targetflatbedAtt"
# delete rope attached to truck
targetflatbedRope(truck)
# event
"ebu_flatbeds:client:targetflatbedRope"
# toggle wheel lift on truck (if applicable)
targetflatbedWheel(truck)
# event:
"ebu_flatbeds:client:targetflatbedWheel"
# Raise / stop the bed
targetflatbedRaise(truck)
# event:
"ebu_flatbeds:client:targetflatbedRaise"
# Lower /stop the bed
targetflatbedLower(truck)
# event:
"ebu_flatbeds:client:targetflatbedLower"

View file

@ -0,0 +1,241 @@
if not Config.DisableExtKeyControls then
RegisterKeyMapping('+bedLower', Config.Controlmessages.LowerBed, 'keyboard', 'DOWN')
RegisterKeyMapping('+bedRaise', Config.Controlmessages.RaiseBed, 'keyboard', 'UP')
RegisterKeyMapping('+flatbedWheel', Config.Controlmessages.WheelLift, 'keyboard', 'H')
if Config.EnableRopes then
RegisterKeyMapping('+flatbedWind', Config.Controlmessages.WindWinch..' / '..Config.Controlmessages.GrabWinch, 'keyboard', 'LEFT')
RegisterKeyMapping('+flatbedUWind', Config.Controlmessages.ExtendWinch..' / '..Config.Controlmessages.ReturnWinch, 'keyboard', 'RIGHT')
RegisterKeyMapping('+flatbedRope', Config.Controlmessages.DetachWinch..' / '..Config.Controlmessages.AttachWinch, 'keyboard', 'G')
end
end
if not Config.DisableInVehControl then
RegisterKeyMapping('+flatbedAtt', Config.Controlmessages.AttachVehicle, 'keyboard', 'E')
end
RegisterKeyMapping('+flatbedWarp', 'Flatbed Get In Car', 'keyboard', 'F')
function loadComplete(car, truck)
--This is called once a vehicle is loaded onto a truck
end
--allowed() is the function that determines if the player is allowed to use the controls. DO NOT RENAME THE FUNCTION
--Place whatever job check code you want in here, return true if allowed, false if not
function allowed()
return true
end
--This function allows checks for vehicle ownership before attaching ropes or to the bed
-- args [truck(entity), car(entity)]
function checkOwnership(truck, car)
return true
end
--This function returns if the vehicle is locked or not when trying to get in the loaded vehicle from next to the trailer
--false = NOT locked true == LOCKED
function IsVehicleLocked(car)
return DecorGetInt(car, '_VEH_DOOR_LOCK_STATUS') == 2 or DecorGetInt(car, '_VEH_DOOR_LOCK_STATUS') == 10
end
--======NOTIFICATIONS======--
function LoadCompleteNotif()
EndTextCommandThefeedPostTickerForced(1,1)
ThefeedNextPostBackgroundColor(184)
BeginTextCommandThefeedPost("STRING")
AddTextComponentSubstringPlayerName(Config.NotiLoadCompleteMessage)
EndTextCommandThefeedPostTicker(true, true)
Wait(3000)
EndTextCommandThefeedPostTickerForced(1,1)
end
function UnLoadCompleteNotif()
EndTextCommandThefeedPostTickerForced(1,1)
ThefeedNextPostBackgroundColor(184)
BeginTextCommandThefeedPost("STRING")
AddTextComponentSubstringPlayerName(Config.NotiUnLoadCompleteMessage)
EndTextCommandThefeedPostTicker(true, true)
Wait(3000)
EndTextCommandThefeedPostTickerForced(1,1)
end
function FBBlockedNotif()
EndTextCommandThefeedPostTickerForced(1,1)
ThefeedNextPostBackgroundColor(6)
BeginTextCommandThefeedPost("STRING")
AddTextComponentSubstringPlayerName(Config.NotiFBBlockedMessage)
EndTextCommandThefeedPostTicker(true, true)
Wait(3000)
EndTextCommandThefeedPostTickerForced(1,1)
end
function BlockedMessage()
EndTextCommandThefeedPostTickerForced(1,1)
ThefeedNextPostBackgroundColor(6)
BeginTextCommandThefeedPost("STRING")
AddTextComponentSubstringPlayerName(Config.NotiBlockedMessage)
EndTextCommandThefeedPostTicker(true, true)
Wait(3000)
EndTextCommandThefeedPostTickerForced(1,1)
end
--Help Text Messages
function message(lineOne, lineTwo, lineThree, duration, loop)
BeginTextCommandDisplayHelp("THREESTRINGS")
AddTextComponentSubstringPlayerName(lineOne)
AddTextComponentSubstringPlayerName(lineTwo or "")
AddTextComponentSubstringPlayerName(lineThree or "")
-- shape (always 0), loop (bool), makeSound (bool), duration (5000 max 5 sec)
EndTextCommandDisplayHelp(0, loop, false, duration or 5000)
end
--Advanced Functions
function validTruck(veh)
local playerPos = GetEntityCoords(PlayerPedId())
local truckCoords = GetEntityCoords(veh)
if trucks and #trucks > 0 and has_value(trucks, GetEntityModel(veh)) and #(playerPos - truckCoords) < 10 then
return true
end
return false
end
--Target
if Config.UseTarget then
--QB CORE
local bones = {"seat_dside_f", "seat_dside_r", "seat_pside_f", "seat_pside_f", 'boot', "scoop", 'chassis'}
local options = {}
options[#options+1] = {
num = 1,
icon = 'fa-solid fa-car-side',
label = '[Winch] Attach Winch',
action = function(entity)
playerAttach(entity)
end,
canInteract = function(entity, distance, data)
return winchInHand and Config.EnableRopes
end,
}
options[#options+1] = {
num = 2,
icon = 'fa-solid fa-angles-left',
label = '[Winch] Attach / Wind Winch',
action = function(entity)
TriggerEvent("ebu_flatbeds:client:targetflatbedWind", entity)
end,
canInteract = function(entity, distance, data)
return Config.Trucks[GetEntityModel(entity)] and Config.Trucks[GetEntityModel(entity)].type ~= "static" and allowed() and Config.EnableRopes
end,
}
options[#options+1] = {
num = 3,
icon = 'fa-solid fa-angles-right',
label = '[Winch] UnWind Winch',
action = function(entity)
TriggerEvent("ebu_flatbeds:client:targetflatbedUnWind", entity)
end,
canInteract = function(entity, distance, data)
return Config.Trucks[GetEntityModel(entity)] and Config.Trucks[GetEntityModel(entity)].type ~= "static" and allowed() and Config.EnableRopes
end,
}
options[#options+1] = {
num = 4,
icon = 'fa-solid fa-angles-up',
label = '[Winch] Raise Bed',
action = function(entity)
TriggerEvent("ebu_flatbeds:client:targetflatbedRaise", entity)
end,
canInteract = function(entity, distance, data)
return Config.Trucks[GetEntityModel(entity)] and Config.Trucks[GetEntityModel(entity)].type ~= "static" and allowed()
end,
}
options[#options+1] = {
num = 5,
icon = 'fa-solid fa-angles-down',
label = '[Winch] Lower Bed',
action = function(entity)
TriggerEvent("ebu_flatbeds:client:targetflatbedLower", entity)
end,
canInteract = function(entity, distance, data)
return Config.Trucks[GetEntityModel(entity)] and Config.Trucks[GetEntityModel(entity)].type ~= "static" and allowed()
end,
}
options[#options+1] = {
num = 6,
icon = 'fa-solid fa-ban',
label = '[Winch] Remove Winch',
action = function(entity)
TriggerEvent("ebu_flatbeds:client:targetflatbedRope", entity)
end,
canInteract = function(entity, distance, data)
return Config.Trucks[GetEntityModel(entity)] and Config.Trucks[GetEntityModel(entity)].type ~= "static" and allowed() and Config.EnableRopes
end,
}
options[#options+1] = {
num = 7,
icon = 'fa-solid fa-car-side',
label = '[Winch] Attach / Detach Vehicle',
action = function(entity)
TriggerEvent("ebu_flatbeds:client:targetflatbedAtt", entity)
end,
canInteract = function(entity, distance, data)
return Config.Trucks[GetEntityModel(entity)] and Config.Trucks[GetEntityModel(entity)].type ~= "static" and allowed()
end,
}
options[#options+1] = {
num = 8,
icon = 'fa-solid fa-truck-ramp-box',
label = '[Winch] Toggle Wheel Lift',
action = function(entity)
TriggerEvent("ebu_flatbeds:client:targetflatbedWheel", entity)
end,
canInteract = function(entity, distance, data)
return Config.Trucks[GetEntityModel(entity)] and Config.Trucks[GetEntityModel(entity)].wheellift and allowed() and Config.EnableRopes
end,
}
--Grab winch from truck
options[#options+1] = {
num = 9,
icon = 'fa-solid fa-car-side',
label = '[Winch] Grab Winch',
action = function(entity)
playerGrab(entity, PlayerPedId())
end,
canInteract = function(entity, distance, data)
return Config.Trucks[GetEntityModel(entity)] and Config.Trucks[GetEntityModel(entity)].type ~= "static" and allowed() and Config.EnableRopes
end,
}
--Grab winch from winched car
options[#options+1] = {
num = 10,
icon = 'fa-solid fa-car-side',
label = '[Winch] Grab Veh Winch',
action = function(entity)
playerGrabVeh(entity, PlayerPedId())
end,
canInteract = function(entity, distance, data)
return getIsVehWinched(entity) and allowed() and Config.EnableRopes
end,
}
options[#options+1] = {
num =11,
icon = 'fa-solid fa-car-side',
label = '[Winch] Return Winch',
action = function(entity)
playerReturn(entity)
end,
canInteract = function(entity, distance, data)
return Config.Trucks[GetEntityModel(entity)] and Config.Trucks[GetEntityModel(entity)].type ~= "static" and winchInHand and Config.EnableRopes
end,
}
exports['qb-target']:AddTargetBone(bones, {
options = options,
distance = 5.5
})
end

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,27 @@
fx_version 'adamant'
game 'gta5'
lua54 'yes'
description 'Flatbeds Winch Script'
author 'Theebu'
version '0.7.8a'
shared_scripts {
'config.lua',
}
client_scripts {
'client/utils.lua',
'client/client.lua'
}
server_scripts {
'server/server.lua'
}
escrow_ignore {
'config.lua',
'client/utils.lua'
}
dependency '/assetpacks'