├── fxmanifest.lua ├── readme.md ├── config.lua └── client └── client.lua /fxmanifest.lua: -------------------------------------------------------------------------------- 1 | 2 | fx_version 'cerulean' 3 | 4 | author 'KevinGirardx' 5 | 6 | game 'gta5' 7 | 8 | client_scripts { 9 | 'client/*.lua', 10 | } 11 | shared_scripts { 12 | 'config.lua', 13 | } 14 | 15 | lua54 'yes' -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # This Script allows you to pickup bikes simple as that For qb-core 2 | 3 | # Useable through qb-target and drawtext 4 | 5 | * Drag and Drop 6 | 7 | # Depedencies 8 | - qb-target 9 | 10 | Preview : https://www.youtube.com/watch?v=_lxJ11hXPlA 11 | 12 | My Discord : https://discord.gg/SCnKXKN7cA 13 | -------------------------------------------------------------------------------- /config.lua: -------------------------------------------------------------------------------- 1 | Config = Config or {} 2 | 3 | Config.Interaction = "" --qb/target (you dont need to put target if you want to use target, can just leave blank) 4 | Config.InteractKey = 'G' 5 | Config.DrawTextPosition = "left" 6 | Config.Bikes = { 7 | ['bmx'] = { 8 | ['x'] = 0.0, 9 | y = 0.35, 10 | z = 0.160, 11 | RotX = 180.0, 12 | RotY = 170.0, 13 | RotZ = 90.0 14 | }, 15 | ['tribike3'] = { 16 | x = 0.0, 17 | y = 0.35, 18 | z = 0.160, 19 | RotX = 180.0, 20 | RotY = 170.0, 21 | RotZ = 90.0 22 | }, 23 | ['fixter'] = { 24 | x = 0.0, 25 | y = 0.35, 26 | z = 0.160, 27 | RotX = 180.0, 28 | RotY = 170.0, 29 | RotZ = 90.0 30 | }, 31 | ['cruiser'] = { 32 | x = 0.0, 33 | y = 0.35, 34 | z = 0.160, 35 | RotX = 180.0, 36 | RotY = 170.0, 37 | RotZ = 90.0 38 | }, 39 | ['scorcher'] = { 40 | x = 0.0, 41 | y = 0.35, 42 | z = 0.160, 43 | RotX = 180.0, 44 | RotY = 170.0, 45 | RotZ = 90.0 46 | }, 47 | ['tribike2'] = { 48 | x = 0.0, 49 | y = 0.35, 50 | z = 0.160, 51 | RotX = 180.0, 52 | RotY = 170.0, 53 | RotZ = 90.0 54 | }, 55 | ['tribike'] = { 56 | x = 0.0, 57 | y = 0.35, 58 | z = 0.160, 59 | RotX = 180.0, 60 | RotY = 170.0, 61 | RotZ = 90.0 62 | }, 63 | } 64 | -------------------------------------------------------------------------------- /client/client.lua: -------------------------------------------------------------------------------- 1 | local QBCore = exports['qb-core']:GetCoreObject() 2 | local bike = nil 3 | local hasbike = false 4 | local closebike = false 5 | 6 | local function PickUpBike(hash) 7 | local ped = PlayerPedId() 8 | local name = string.lower(GetDisplayNameFromVehicleModel(hash)) 9 | RequestAnimDict("anim@heists@box_carry@") 10 | while (not HasAnimDictLoaded("anim@heists@box_carry@")) do 11 | Wait(1) 12 | end 13 | TaskPlayAnim(ped, "anim@heists@box_carry@" ,"idle", 5.0, -1, -1, 50, 0, false, false, false) 14 | AttachEntityToEntity(bike, ped, GetPedBoneIndex(player, 60309), Config.Bikes[name].x, Config.Bikes[name].y, Config.Bikes[name].z, Config.Bikes[name].RotX, Config.Bikes[name].RotY, Config.Bikes[name].RotZ, true, false, false, true, 0, true) 15 | hasbike = true 16 | exports['qb-core']:DrawText("["..Config.InteractKey.."] Drop ", Config.DrawTextPosition) 17 | end 18 | 19 | local function PressedKey(hash) 20 | CreateThread(function () 21 | while not hasbike do 22 | local ped = PlayerPedId() 23 | if IsControlJustReleased(0, 38) then 24 | PickUpBike(hash) 25 | end 26 | Wait(1) 27 | end 28 | end) 29 | end 30 | 31 | CreateThread( function () 32 | if Config.Interaction == "qb" then 33 | while true do 34 | local ped = PlayerPedId() 35 | local pos = GetEntityCoords(ped) 36 | bike = QBCore.Functions.GetClosestVehicle() 37 | for k, v in pairs(Config.Bikes) do 38 | local hash = GetHashKey(k) 39 | if GetEntityModel(bike) == hash then 40 | local bikepos = GetEntityCoords(bike) 41 | local dist = #(pos - bikepos) 42 | if dist <= 1.5 then 43 | if IsPedOnFoot(ped) and not closebike then 44 | closebike = true 45 | exports['qb-core']:DrawText("["..Config.InteractKey.."] Pick Up", Config.DrawTextPosition) 46 | PressedKey(hash) 47 | end 48 | else 49 | closebike = false 50 | exports['qb-core']:HideText() 51 | end 52 | end 53 | end 54 | Wait(1000) 55 | end 56 | else 57 | for k,v in pairs(Config.Bikes) do 58 | local hash = GetHashKey(k) 59 | exports['qb-target']:AddTargetModel(hash, { 60 | options = { 61 | { 62 | type = "client", 63 | event = "kevin-pickbikes:client:takeup", -- I'm not familiar but there is a way to put the function right in here and pass the variable i believe but this event will do for now. 64 | icon = "fas fa-bicycle", 65 | label = "Pick Up", 66 | hash = hash 67 | } 68 | }, 69 | distance = 2.0, 70 | }) 71 | end 72 | end 73 | end) 74 | 75 | RegisterNetEvent("kevin-pickbikes:client:takeup", function(data) 76 | local hash = data.hash 77 | bike = QBCore.Functions.GetClosestVehicle() 78 | PickUpBike(hash) 79 | end) 80 | 81 | RegisterCommand('dropbike', function() 82 | if IsEntityAttachedToEntity(bike, PlayerPedId()) then 83 | DetachEntity(bike, false, false) 84 | SetVehicleOnGroundProperly(bike) 85 | ClearPedTasks(PlayerPedId()) 86 | hasbike = false 87 | closebike = false 88 | exports['qb-core']:HideText() 89 | end 90 | end) 91 | 92 | RegisterKeyMapping('dropbike', 'Drop Bike', 'keyboard', Config.InteractKey) 93 | --------------------------------------------------------------------------------