├── qb-gangs
├── fxmanifest.lua
├── config.lua
└── client
│ └── main.lua
└── README.md
/qb-gangs/fxmanifest.lua:
--------------------------------------------------------------------------------
1 |
2 | fx_version 'cerulean'
3 | game 'gta5'
4 |
5 | description 'QB-Gangs'
6 |
7 | version '1.0.0'
8 |
9 | author 'Floki'
10 |
11 | shared_scripts {
12 | 'config.lua',
13 | }
14 |
15 | client_scripts {
16 | 'client/main.lua'
17 |
18 | }
19 |
20 | lua54 'yes'
21 |
--------------------------------------------------------------------------------
/qb-gangs/config.lua:
--------------------------------------------------------------------------------
1 | Config = Config or {}
2 |
3 | Config.Fuel = 'ps-fuel' --ps-fuel, lj-fuel, LegacyFuel
4 |
5 | Config.stash ={
6 | ["ballas"] = vector3(113.3059, -1970.89, 21.3276),
7 | ["vagos"] = vector3(344.67, -2022.14, 22.39),
8 | ["families"] = vector3(-136.91, -1609.84, 35.03),
9 | }
10 |
11 | Config.Gangs = {
12 | ["ballas"] = {
13 | ["VehicleSpawner"] = vector4(108.58, -1945.01, 20.8, 43.42),
14 | ["colors"] = { 145, 0 }, --- primary and secondary colors id https://wiki.rage.mp/index.php?title=Vehicle_Colors
15 | ["vehicles"] = {
16 | ["buffalo2"] = "Buffalo Sport",
17 | ["rumpo3"] = "RumpoXL",
18 | ["manchez"] = "Manchez",
19 | ["chino2"] = "Lowrider",
20 | },
21 | },
22 | ["vagos"] = {
23 | ["VehicleSpawner"] = vector4(329.59, -2035.1, 20.98, 53.08),
24 | ["colors"] = { 89, 0 }, --- primary and secondary colors id https://wiki.rage.mp/index.php?title=Vehicle_Colors
25 | ["vehicles"] = {
26 | ["buffalo2"] = "Buffalo Sport",
27 | ["rumpo3"] = "RumpoXL",
28 | ["manchez"] = "Manchez",
29 | ["chino2"] = "Lowrider",
30 | },
31 | },
32 | ["families"] = {
33 | ["VehicleSpawner"] = vector4(-108.68, -1598.61, 31.66, 329.64),
34 | ["colors"] = { 53, 0 }, --- primary and secondary colors id https://wiki.rage.mp/index.php?title=Vehicle_Colors
35 | ["vehicles"] = {
36 | ["buffalo2"] = "Buffalo Sport",
37 | ["rumpo3"] = "RumpoXL",
38 | ["manchez"] = "Manchez",
39 | ["chino2"] = "Lowrider",
40 | },
41 | }, -- Add your next table under this comma
42 | }
43 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # qb-gangs used with QBCore Framework
3 | # Dependencies
4 | * [qbcore framework](https://github.com/qbcore-framework)
5 | * [qb-core](https://github.com/qbcore-framework/qb-core)
6 | ## Installation
7 | ### Manual
8 | - Download the script and put it in the `[qb]` directory.
9 | - Add the following code to your server.cfg/resouces.cfg
10 | ```
11 | ensure qb-core
12 | ensure qb-logs
13 | ensure qb-gangs
14 | ensure qb-radio
15 | ensure qb-drugs
16 | ```
17 |
18 | ## Configuration
19 | ```
20 | Config = Config or {}
21 |
22 | Config.Fuel = 'ps-fuel' --ps-fuel, lj-fuel, LegacyFuel
23 |
24 | Config.stash ={
25 | ["ballas"] = vector3(113.3059, -1970.89, 21.3276),
26 | ["vagos"] = vector3(344.67, -2022.14, 22.39),
27 | ["families"] = vector3(-136.91, -1609.84, 35.03),
28 | }
29 |
30 | Config.Gangs = {
31 | ["ballas"] = {
32 | ["VehicleSpawner"] = vector4(108.58, -1945.01, 20.8, 43.42),
33 | ["colors"] = { 145, 0 }, --- primary and secondary colors id https://wiki.rage.mp/index.php?title=Vehicle_Colors
34 | ["vehicles"] = {
35 | ["buffalo2"] = "Buffalo Sport",
36 | ["rumpo3"] = "RumpoXL",
37 | ["manchez"] = "Manchez",
38 | ["chino2"] = "Lowrider",
39 | },
40 | },
41 | ["vagos"] = {
42 | ["VehicleSpawner"] = vector4(329.59, -2035.1, 20.98, 53.08),
43 | ["colors"] = { 89, 0 }, --- primary and secondary colors id https://wiki.rage.mp/index.php?title=Vehicle_Colors
44 | ["vehicles"] = {
45 | ["buffalo2"] = "Buffalo Sport",
46 | ["rumpo3"] = "RumpoXL",
47 | ["manchez"] = "Manchez",
48 | ["chino2"] = "Lowrider",
49 | },
50 | },
51 | ["families"] = {
52 | ["VehicleSpawner"] = vector4(-108.68, -1598.61, 31.66, 329.64),
53 | ["colors"] = { 53, 0 }, --- primary and secondary colors id https://wiki.rage.mp/index.php?title=Vehicle_Colors
54 | ["vehicles"] = {
55 | ["buffalo2"] = "Buffalo Sport",
56 | ["rumpo3"] = "RumpoXL",
57 | ["manchez"] = "Manchez",
58 | ["chino2"] = "Lowrider",
59 | },
60 | }, -- Add your next table under this comma
61 | }
62 |
--------------------------------------------------------------------------------
/qb-gangs/client/main.lua:
--------------------------------------------------------------------------------
1 | local QBCore = exports['qb-core']:GetCoreObject()
2 | local isLoggedIn = false
3 | local PlayerGang = {}
4 | local currentAction = "none"
5 |
6 |
7 | RegisterNetEvent('QBCore:Client:OnPlayerLoaded')
8 | AddEventHandler('QBCore:Client:OnPlayerLoaded', function()
9 | isLoggedIn = true
10 | PlayerGang = QBCore.Functions.GetPlayerData().gang
11 | end)
12 |
13 | RegisterNetEvent('QBCore:Client:OnPlayerUnload')
14 | AddEventHandler('QBCore:Client:OnPlayerUnload', function()
15 | isLoggedIn = false
16 | end)
17 |
18 | RegisterNetEvent('QBCore:Client:OnGangUpdate')
19 | AddEventHandler('QBCore:Client:OnGangUpdate', function(GangInfo)
20 | PlayerGang = GangInfo
21 | isLoggedIn = true
22 | end)
23 |
24 |
25 | function GangMenu()
26 | exports['qb-menu']:openMenu({
27 | {
28 | header = "Gang Vehicle",
29 | icon = "fab fa-whmcs",
30 | isMenuHeader = true
31 | },
32 | {
33 | header = "Vehicle List ",
34 | txt = " ",
35 | icon = "fas fa-car",
36 | params = {
37 | event = "fl-gangs:client:VehicleList"
38 | }
39 | },
40 | {
41 | header = "Store Vehicle",
42 | txt = " ",
43 | icon = "fas fa-arrow-right-to-bracket",
44 | params = {
45 | event = "fl-gangs:client:VehicleDelet"
46 | }
47 | },
48 | {
49 | header = "Close",
50 | txt = "",
51 | icon = "fas fa-circle-right",
52 | params = {
53 | event = "qb-menu:closeMenu"
54 | }
55 | },
56 | })
57 | end
58 |
59 | RegisterNetEvent("fl-gangs:client:VehicleList", function()
60 | local VehicleList = {
61 | {
62 | header = " Vehicle List",
63 | icon = "fab fa-whmcs",
64 | isMenuHeader = true
65 | },
66 | }
67 | for k, v in pairs(Config.Gangs[PlayerGang.name]["vehicles"]) do
68 | table.insert(VehicleList, {
69 | header = v,
70 | icon = "fas fa-circle",
71 | params = {
72 | event = "fl-gangs:client:SpawnListVehicle",
73 | args = k
74 | }
75 | })
76 | end
77 | table.insert(VehicleList, {
78 | header = "Close",
79 | txt = "",
80 | icon = "fas fa-circle-xmark",
81 | params = {
82 | event = "qb-menu:closeMenu",
83 | }
84 | })
85 | exports['qb-menu']:openMenu(VehicleList)
86 | end)
87 |
88 | Citizen.CreateThread(function()
89 | while true do
90 | Citizen.Wait(0)
91 | if isLoggedIn and PlayerGang.name ~= "none" then
92 | v = Config.stash[PlayerGang.name]
93 | ped = PlayerPedId()
94 | pos = GetEntityCoords(ped)
95 |
96 | stashdist = #(pos - vector3(v.x, v.y, v.z))
97 | if stashdist < 10.0 then
98 | DrawMarker(2, v.x, v.y, v.z - 0.2 , 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.2, 0.15, 200, 200, 200, 222, false, false, false, true, false, false, false)
99 | if stashdist < 1.5 then
100 | exports['qb-core']:DrawText('[E] - STASH','left')
101 | currentAction = "stash"
102 | elseif stashdist < 2.0 then
103 | currentAction = "none"
104 | exports['qb-core']:HideText()
105 | end
106 | else
107 | Citizen.Wait(1000)
108 | end
109 | else
110 | Citizen.Wait(2500)
111 | end
112 | end
113 | end)
114 |
115 |
116 | Citizen.CreateThread(function()
117 | while true do
118 | Citizen.Wait(0)
119 | if isLoggedIn and PlayerGang.name ~= "none" then
120 | v = Config.Gangs[PlayerGang.name]["VehicleSpawner"]
121 | ped = PlayerPedId()
122 | pos = GetEntityCoords(ped)
123 | vehdist = #(pos - vector3(v.x, v.y, v.z))
124 | if vehdist < 20.0 then
125 | DrawMarker(2, v.x, v.y, v.z - 0.2 , 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.2, 0.15, 200, 200, 200, 222, false, false, false, true, false, false, false)
126 | if vehdist < 1.5 then
127 | exports['qb-core']:DrawText('[E] - Garage','left')
128 | if IsControlJustPressed(0, 38) then
129 | GangMenu()
130 | end
131 | else
132 | exports['qb-core']:HideText()
133 | end
134 | end
135 | end
136 | end
137 | end)
138 |
139 |
140 | RegisterNetEvent("fl-gangs:client:VehicleDelet", function()
141 | DeleteVehicle(GetVehiclePedIsIn(PlayerPedId()))
142 | end)
143 |
144 |
145 | RegisterNetEvent("fl-gangs:client:SpawnListVehicle", function(model)
146 | local coords = {
147 | x = Config.Gangs[PlayerGang.name]["VehicleSpawner"].x,
148 | y = Config.Gangs[PlayerGang.name]["VehicleSpawner"].y,
149 | z = Config.Gangs[PlayerGang.name]["VehicleSpawner"].z,
150 | w = Config.Gangs[PlayerGang.name]["VehicleSpawner"].w,
151 | }
152 | QBCore.Functions.SpawnVehicle(model, function(veh)
153 | SetVehicleNumberPlateText(veh, "GANG"..tostring(math.random(1000, 9999)))
154 | SetEntityHeading(veh, coords.w)
155 | exports[Config.Fuel]:SetFuel(veh, 100.0)
156 | TaskWarpPedIntoVehicle(PlayerPedId(), veh, -1)
157 | SetVehicleColours(veh, Config.Gangs[PlayerGang.name]["colors"][1], Config.Gangs[PlayerGang.name]["colors"][2])
158 | TriggerEvent("vehiclekeys:client:SetOwner", GetVehicleNumberPlateText(veh))
159 | SetVehicleEngineOn(veh, true, true)
160 | SetVehicleDirtLevel(veh, 0.0)
161 | end, coords, true)
162 | end)
163 |
164 | RegisterKeyMapping("+GangInteract", "Interaction for gang script", "keyboard", "e")
165 |
166 | RegisterCommand("+GangInteract", function()
167 | if currentAction == "stash" then
168 | TriggerServerEvent("inventory:server:OpenInventory", "stash", PlayerGang.name.."stash", {
169 | maxweight = 4000000,
170 | slots = 500,
171 | })
172 | TriggerEvent("inventory:client:SetCurrentStash", PlayerGang.name.."stash")
173 | end
174 | end, false)
175 |
--------------------------------------------------------------------------------