Power Scripts
  • ๐Ÿ“„Home
  • ๐ŸšฒBikerack
  • ๐Ÿ“ธBodycams
  • ๐Ÿ“นDashcams V2
  • ๐Ÿ“ฑEncrypted Chat
  • ๐Ÿ”งMechanic Tablet
  • ๐ŸขPlayer Owned Offices
  • ๐ŸšขPlayer Owned Yachts
  • ๐Ÿ Stash Houses
  • ๐Ÿ”’Storage Lockers
  • ๐ŸงนSunset Bleach
  • ๐Ÿ“ฆWarehouses V2
Powered by GitBook
On this page
  • Introduction
  • Installation
  • Configuration
  • Editable files
  • target.lua

Was this helpful?

Bikerack

Introduction

This standalone script will allow you to carry and store a bike onto the back of a vehicle.

Bikes can be picked up by using the command or key bind, depending on what is set up within the configuration. The vehicles and bikes that can be used are also customizable, and the ability to configure the position and rotation of the bikes in the player's hands and on the vehicle.

In the config you can set one of the following options to pickup the bike:

  • Chat command

    • Either custom or default of /pickup

  • Text prompt "Press E to pickup bike"

  • Target

    • Support included for QBTarget and QTarget

This is a standalone script, however, you can enable some QBCore support or QTarget within the config.


Installation

  • Download the power_bikerack from Keymaster

  • Add the files to your resources folder

  • Ensure that the resource file will start (either ensure your resource in the server.cfg or inside a folder which is started on server start)

  • Edit the config file to your needs

  • Restart your server


Configuration

Select the tab below to see the configuration options available.

enablePickupCommand = true -- True if you want to use a chat command to pickup
pickupCommand = 'pickup' -- How to trigger chat command. Default is /pickup
 
enablePickupPromt = true -- True if you want a prompt to display to pick up. Like "Press E to pickup bike"

enableQBTarget = false -- True if you want to enable QBTarget to third eye the bike to pickup.

enableQTarget = false -- True if you want to enable QTarget to third eye the bike to pickup.

enableQBKeys = false -- True if using QBCore and you want to require the player to have keys to the vehicle.
QBKeysName = 'qb-vehiclekeys' -- Resource name if you have changed the name from qb-vechilekeys.

keyControl = 38 -- E -- Set the key which activates the prompt. 
-- If changing the above key be sure to change the language for the prompts from E as well.
-- Promts
 ['pickupBike'] = "~w~Press ~g~E~w~ To Pickup Bike",
 ['dropBike'] = "~w~Press ~g~Q~w~ To Drop Bike",
 ['unrackBike'] = "~w~Press ~g~E~w~ To Unrack Bike",
 ['rackBike'] = "~w~Press ~g~E~w~ To Rack Bike",

These bikes are added by default, if you want to add more, please use the below as a guide.

If you want to remove a certain bike, you can comment out the line.

The bike must also be added to the rackableVehicle list to be able to be loaded in a particular vehicle.

-- The list of bikes that can be carried or placed on the back of a vehicle.
-- Offset and rot will change the position of the bike in the players hands, the bike must be added to both this list and the rackableVehicle list under each vehicle.
rackableBikes = {
 ['scorcher'] = {offsetX = -0.3, offsetY = 0.36, offsetZ = 0.25, rotX = -10.0, rotY = 0.0, rotZ = 90.0},
 ['cruiser'] = {offsetX = -0.3, offsetY = 0.36, offsetZ = 0.25, rotX = -10.0, rotY = 0.0, rotZ = 90.0},
 ['fixter'] = {offsetX = -0.15, offsetY = 0.36, offsetZ = 0.25, rotX = -10.0, rotY = 0.0, rotZ = 90.0},

 ['tribike'] = {offsetX = -0.3, offsetY = 0.36, offsetZ = 0.25, rotX = -10.0, rotY = 0.0, rotZ = 90.0},

 ['tribike2'] = {offsetX = -0.3, offsetY = 0.36, offsetZ = 0.25, rotX = -10.0, rotY = 0.0, rotZ = 90.0},
 ['tribike3'] = {offsetX = -0.3, offsetY = 0.36, offsetZ = 0.25, rotX = -10.0, rotY = 0.0, rotZ = 90.0},

 ['bmx'] = {offsetX = -0.175, offsetY = 0.36, offsetZ = 0.0, rotX = -10.0, rotY = 0.0, rotZ = 90.0},

 -- Motorbike  
 ['sanchez01'] = {offsetX = -0.175, offsetY = 0.36, offsetZ = 0.0, rotX = -10.0, rotY = 0.0, rotZ = 90.0},

 --  Quad
 ['blazer'] = {offsetX = -0.175, offsetY = 0.36, offsetZ = 0.0, rotX = -10.0, rotY = 0.0, rotZ = 90.0},
}

This is where you can define which bikes can be loaded in which vehicles and adjust the placement. The bikes must already be in the rackableBikes list before adding to the rackableVehicles.

Some vechicles with seperate options have been included. You can use this as a guide to add additional vehicles or change which bikes are permitted per vehicle.

-- The list of vehicles that can have bikes placed on the back of them
rackableVehicles = {
 ['bison'] = { -- Car spawn name
  ['bikes'] = { -- Below here you can specify the bike spawn names and their placement
   ['scorcher'] = {offsetX = 0.0, offsetY = -1.625, offsetZ = 0.875, rotX = 0.0, rotY = 0.0, rotZ = 25.0},
   ['cruiser'] = {offsetX = 0.0, offsetY = -1.625, offsetZ = 0.875, rotX = 0.0, rotY = 0.0, rotZ = 25.0},
   ['fixter'] = {offsetX = 0.0, offsetY = -1.625, offsetZ = 0.875, rotX = 0.0, rotY = 0.0, rotZ = 25.0},

   ['tribike'] = {offsetX = 0.0, offsetY = -1.625, offsetZ = 0.875, rotX = 0.0, rotY = 0.0, rotZ = 25.0},
   ['tribike2'] = {offsetX = 0.0, offsetY = -1.625, offsetZ = 0.875, rotX = 0.0, rotY = 0.0, rotZ = 25.0},
   ['tribike3'] = {offsetX = 0.0, offsetY = -1.625, offsetZ = 0.875, rotX = 0.0, rotY = 0.0, rotZ = 25.0},

   ['bmx'] = {offsetX = 0.0, offsetY = -1.625, offsetZ = 0.75, rotX = 0.0, rotY = 0.0, rotZ = 0.0},
  }
 }, 

 ['bodhi2'] = { 
  ['bikes'] = {
   ['scorcher'] = {offsetX = 0.0, offsetY = -1.625, offsetZ = 0.5, rotX = 0.0, rotY = 0.0, rotZ = 25.0},
   ['cruiser'] = {offsetX = 0.0, offsetY = -1.625, offsetZ = 0.5, rotX = 0.0, rotY = 0.0, rotZ = 25.0},
   ['fixter'] = {offsetX = 0.0, offsetY = -1.625, offsetZ = 0.5, rotX = 0.0, rotY = 0.0, rotZ = 25.0},

   ['tribike'] = {offsetX = 0.0, offsetY = -1.625, offsetZ = 0.5, rotX = 0.0, rotY = 0.0, rotZ = 25.0},
   ['tribike2'] = {offsetX = 0.0, offsetY = -1.625, offsetZ = 0.5, rotX = 0.0, rotY = 0.0, rotZ = 25.0},
   ['tribike3'] = {offsetX = 0.0, offsetY = -1.625, offsetZ = 0.5, rotX = 0.0, rotY = 0.0, rotZ = 25.0},

   ['bmx'] = {offsetX = 0.0, offsetY = -1.625, offsetZ = 0.2, rotX = 0.0, rotY = 0.0, rotZ = 0.0},
  }
 }, 

 ['kamacho'] = { 
  ['bikes'] = {
   ['bmx'] = {offsetX = 0.0, offsetY = -1.90, offsetZ = 0.60, rotX = 0.0, rotY = 0.0, rotZ = 30.0},
  }
 }, 

 ['rebel2'] = { 
  ['bikes'] = {
   ['sanchez01'] = {offsetX = 0.0, offsetY = -1.5, offsetZ = 0.8, rotX = 0.0, rotY = 0.0, rotZ = 25.0},
   ['blazer'] = {offsetX = 0.0, offsetY = -1.4, offsetZ = 0.8, rotX = 0.0, rotY = 0.0, rotZ = 0.0},
  }
 }, 
}

The language section is also included in the config so that you can change the text or translate to another language if needed.

- Edit Language Configuration
Lang = {
 ['chatPrefix'] = "^8System",
 ['cannotPickup'] = "You cannot pickup this bike.",
 ['notBike'] = "This is not a bike.",
 ['bikeOnVehicle'] = "Bike already on the vehicle.",
 ['bikeCannotBePutOnVehicle'] = "This bike cannot be placed on this vehicle.",
 ['noKeys'] = "You do not have the keys to this bike.",
 -- Promts
 ['pickupBike'] = "~w~Press ~g~E~w~ To Pickup Bike",
 ['dropBike'] = "~w~Press ~g~Q~w~ To Drop Bike",
 ['unrackBike'] = "~w~Press ~g~E~w~ To Unrack Bike",
 ['rackBike'] = "~w~Press ~g~E~w~ To Rack Bike",

Editable files

target.lua

Target

If you are using a target system other than qbtarget or qtarget, you can set the custom target message here:

-- This can be used to edit the target.
Citizen.CreateThread(function()
 local models = {}
 for id,v in pairs(rackableBikes) do 
  table.insert(models, id)
 end 
 
 if enableQBTarget then 
  exports['qb-target']:AddTargetModel(models, {options = {{type = "client", event = "power_bikerack:pickup", icon = "fas fa-bicycle", label = "Carry"}}, distance = 3.5})
 elseif enableQTarget then 
  exports['qtarget']:AddTargetModel(models, {options = {{event = "power_bikerack:pickup", icon = "fas fa-bicycle", label = "Carry"}}, distance = 3.5})
 end 
end)

Custom Notifications

If you would like to edit the notifications to add your own custom notifications or to match them to your other server notifications, you can edit them in the target.lua file. Default notifications are as follows:

-- This can be used to edit the notification event.
function triggerNotification(message)
 TriggerEvent('chat:addMessage', {color = {255, 255, 255}, args = {Lang['chatPrefix'], message}})
end 

PreviousHomeNextBodycams

Last updated 1 year ago

Was this helpful?

๐Ÿšฒ