Fivem Gang System (script)

This is what I did but the option to transfer ownership of the vehicle to the gang remains grayed out so I cannot click on it

do you have any error in client or server side ?
if you want i can remote on your pc and check that.

I have no errors, yes I am okay if you don’t mind please

i have an issue with gang vehicles. once added to the gang garage if you apply any upgrades they are not sticking ie vehicle returns to the state you added it to the gang garage. needs adding to update these in the database upon storing in the gang garage. also a way for gang boss to remove vehicles server side would be a great addition and save devs the time of removing them manually from the database if it is possible. great work on this script

2 Likes

You gave a very positive and constructive opinion. I will definitely implement the upgrade in the next updates and I will include the removal of the cars in the next update.

Thanks for your constructive comments

1 Like

i have fixed the issue of upgrades not sticking upon storing vehicle.
client vehicle.lua :

RageUI.Button( _U(‘store_in_garage’), ‘’ , {}, disabled, {

                onSelected = function()

                    if IsPedSittingInAnyVehicle(playerPed) then

                        SetVehicleProperties(vehicle, props)

                        local vehicle = GetVehiclePedIsIn(playerPed, false)

                        vehicleProperties = GetVehicleProperties(vehicle)

                        whileGoGarageMenu = false

                        for k,v in pairs (Vehicles) do

                            if v.plate == vehicleProperties.plate then

                                Vehicles[k].stored = true

                                break

                            end

                        end

                        DeleteEntity(vehicle)

                        TriggerServerEvent('Erfan:gang:setVehicleStatusIn', vehicleProperties, vehicleProperties.plate, true)

                        

                        canStoredInGarage = false

                    end

                end,

            });

            RageUI.Separator(_U('list_of_garage' ))

            for _key, Vehicle in pairs(Vehicles) do

                local vehicleProperties = json.decode(Vehicle.vehicle)

                local vehicleLabel = GetDisplayNameFromVehicleModel(vehicleProperties.model)

                vehicleLabel = GetLabelText(vehicleLabel)

                RageUI.Button( vehicleLabel , ''  , {}, Vehicle.stored , {

                    onSelected = function()

                        local coords = GetEntityCoords(PlayerPedId())

                        if IsAnyVehicleNearPoint(coords, 3) then

                            TriggerEvent('Erfan:gang:sendNotfication','[Gang System]', ''  , _U('not_empty_to_spawn') , 'CHAR_SOCIAL_CLUB' , 2 )

                        else

                            RageUI.Visible(gangGarageMenu, false)

                            whileGoGarageMenu = false

                            TriggerEvent('Erfan:gang:spawnVehicle', vehicleProperties)

                            TriggerServerEvent('Erfan:gang:setVehicleStatusOut', vehicleProperties.plate, false)

                        end

                    end,

                });

            end

server vehicle.lua :

RegisterServerEvent(‘Erfan:gang:setVehicleStatusOut’)

AddEventHandler(‘Erfan:gang:setVehicleStatusOut’, function( plate , status )

executeOnDB('UPDATE `gangs_vehicle` SET  `stored` = @status WHERE `plate` = @plate', {['@plate']     = plate , ['@status']   = status } , function(e)end)

end)

RegisterServerEvent(‘Erfan:gang:setVehicleStatusIn’)

AddEventHandler(‘Erfan:gang:setVehicleStatusIn’, function(vehicleProperties , plate , status )

executeOnDB('UPDATE `gangs_vehicle` SET `vehicle` = @vehicle, `stored` = @status WHERE `plate` = @plate', {['@vehicle'] = json.encode(vehicleProperties) ,['@plate']     = plate , ['@status']   = status } , function(e)end)

end)

2 Likes

vehicle.lua (19.1 KB) client side
vehicle.lua (7.8 KB) server side

1 Like

very nice
thank you

i check it :ok_hand:
if you have github , send username to mention you

Don’t have github bud but thanks for the appreciation

2 Likes

where do ya get gang Hq houses?

this resource not developed for one gang, you can create many gang ( any where ) you want.

just admin should open gang menu and create gang and set location for garage and armory and …


How to fix it?

are you join any gang ?

this error is going on fix in next update

same waiting for update

1 Like

this error fixed when you join to gang
for un gang player fixed in next update

1 Like

when is the next update?

Less than a few days
check github, today we release new update

Hey man, i fixed my errors and wanted to ask you something. Is there a way to add names of gang members above players? So they can see eachother not just on minimap also in game

nothing developed for this but you can add resource for that
in client.lua you can use export like :

exports['gang']:getGangName()

or

exports['gang']:getGangGradeName()

Such a great work dude…
I’ll def use it in my sever
Keep it up brother!

1 Like