[Release] [ESX] [Garage]


#1

Posted on behalf of @GiZz, the developer of ESX (ES Extended).

[Requirements]:

MySQL
EssentialMode Base by @Kanersps: [Release] EssentialMode base
ES Extended (ESX) by @GiZz: https://github.com/FXServer-ESX/fxserver-es_extended
Instance: https://github.com/FXServer-ESX/fxserver-instance

[Features]:

-Allows users to save vehicles inside of a garage
-Default 1 garage on map however easy to add more within config files
-Ability to store stolen vehicles or purchased vehicles
-French (fr), English (en), and Portugese (br), languages available all adjustable through the config.lua file

[Screenshots]:

[Installation]:

  1. Change directory to resources/[esx]/
  2. Clone the Git repository located here: https://github.com/FXServer-ESX/fxserver-esx_garage
  3. Import esx_garage.sql into your MySQL database
  4. Add this to your server.cfg “start esx_garage”

[Additional Information]
For any and all support please visit the ESX Discord: https://discord.gg/pVvDcPH as I do not provide support and have been away from quite some time.

There are more plugins available which you can view at: https://github.com/FXServer-ESX


ESX_Garage extention
#2

port for Vrp framework please :frowning:


#3

can you sent me a config.lua file with more garages?


#4

I cannot, I can only provide you the groundwork in order for you to have the basics to implement these for your server as you deem fit. All you’ve got to do is get coordinates, and set them appropriately in your files if you want a single shared garage.


#5

Well i’m fucked to get all the coords for the spawn points bause i have the coords of the garages not of the spwan points xd


#6

Please contribute on github as the garage is not perfect. Maybe you have some great ideas to share !


#7

i need a garage (save custom) even after a explosion of the car buy thx


#8

how can we only add bought vehicles in garage ?


#10

why do my cars disappear?
how to add more garages?


#11

[ 190446] Connecting: Mickie Finn
[ 388599] Successfully Loaded Identity For Mickie Finn
[ 390003] [ERROR] [MySQL] An error happens on MySQL for query “SELECT * FROM vehicles {=}”: Table ‘essentialmode.vehicles’ doesn’t exist
[ 391126] Error running call reference function for resource dmvschool: server.lua:53: attempt to index a nil value (local ‘xPlayer’)
[ 391126] stack traceback:
[ 391126] server.lua:53: in local ‘ref’
[ 391141] citizen:/scripting/lua/scheduler.lua:317: in function citizen:/scripting/lua/scheduler.lua:308
[ 391188] Error running system event handling function for resource es_extended: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: citizen:/scripting/lua/MessagePack.lua:830: missing bytes
[ 391188] stack traceback:
[ 391188] [C]: in function ‘error’
[ 391188] citizen:/scripting/lua/MessagePack.lua:830: in method ‘underflow’
[ 391188] citizen:/scripting/lua/MessagePack.lua:465: in field ‘any’
[ 391188] citizen:/scripting/lua/MessagePack.lua:860: in field ‘unpack’
[ 391204] citizen:/scripting/lua/scheduler.lua:378: in field ‘?’
[ 391204] server/functions.lua:30: in field ‘TriggerServerCallback’
[ 391204] server/common.lua:72: in upvalue ‘handler’
[ 391204] citizen:/scripting/lua/scheduler.lua:163: in function citizen:/scripting/lua/scheduler.lua:162
[ 391204] stack traceback:
[ 391204] [C]: in function ‘error’
[ 391204] citizen:/scripting/lua/scheduler.lua:41: in field ‘CreateThreadNow’
[ 391204] citizen:/scripting/lua/scheduler.lua:162: in function citizen:/scripting/lua/scheduler.lua:131
[ 425181] [SAVED] Mickie Finn]

What do i install to get the vehicles table in my database? or am i missing something, thanks in advance, mickie.


#12

You need https://github.com/ESX-Org/esx_vehicleshop from esx or only the sql that inserts u a vehicle table


#13

Is there a way to set vehicles to return to the garage once destroyed or after reset?


#14

Turbo seems to be broke can buy it but doesn’t give it to you. Anyway you can share the fix. I have modified the files to work with my money system so I can’t just replace all my files. Thanks in advance.


#15

I had to stop using the resource due to the fact that if someone steals a bus and stores it, the size of the vehicle causes a constant duplicating process until the garage is filled with them. Also, if in the garage at the same time, a person can plant explosives in their instance and destroy cars or kill people in theirs.

I recommend esx_eden_garage


#16

Main client Lua

-- removed that shitty key table because that's not how controls work.
local GUI                          = {}
GUI.Time                           = 0
local hasAlreadyEnteredMarker      = false;
local lastZone                     = nil;
local PlayerData                   = nil
local LastVehicle                  = nil;
local HasLoadedParking             = false
local IsInGarage                   = false
local IsInExteriorGarageSpawnPoint = false
local Message                      = nil

function round(num, numDecimalPlaces)
  local mult = 10^(numDecimalPlaces or 0)
  return math.floor(num * mult + 0.5) / mult
end

function GetVehicleProperties(vehicle)

	local colour1, colour2             = GetVehicleColours(vehicle)
	local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle)
	
	return {
		
		model            = GetEntityModel(vehicle),
		
		plate            = GetVehicleNumberPlateText(vehicle),
		plateIndex       = GetVehicleNumberPlateTextIndex(vehicle),

		color1           = colour1,
		color2           = colour2,
		pearlescentColor = pearlescentColor,
		wheelColor       = wheelColor,
		
		wheels           = GetVehicleWheelType(vehicle),
		windowTint       = GetVehicleWindowTint(vehicle),
		
		neonColor        = table.pack(GetVehicleNeonLightsColour(vehicle)),
		
		modSpoilers      = GetVehicleMod(vehicle, 0),
		modFrontBumper   = GetVehicleMod(vehicle, 1),
		modRearBumper    = GetVehicleMod(vehicle, 2),
		modSideSkirt     = GetVehicleMod(vehicle, 3),
		modExhaust       = GetVehicleMod(vehicle, 4),
		modFrame         = GetVehicleMod(vehicle, 5),
		modGrille        = GetVehicleMod(vehicle, 6),
		modHood          = GetVehicleMod(vehicle, 7),
		modFender        = GetVehicleMod(vehicle, 8),
		modRightFender   = GetVehicleMod(vehicle, 9),
		modRoof          = GetVehicleMod(vehicle, 10),

		modEngine        = GetVehicleMod(vehicle, 11),
		modBrakes        = GetVehicleMod(vehicle, 12),
		modTransmission  = GetVehicleMod(vehicle, 13),
		modHorns         = GetVehicleMod(vehicle, 14),
		modSuspension    = GetVehicleMod(vehicle, 15),
		modArmor         = GetVehicleMod(vehicle, 16),

		modTurbo         = IsToggleModOn(vehicle,  18),
		modXenon         = IsToggleModOn(vehicle,  22),

		modFrontWheels   = GetVehicleMod(vehicle, 23),
		modBackWheels    = GetVehicleMod(vehicle, 24)
	}

end

function SetVehicleProperties(vehicle, props)

	SetVehicleModKit(vehicle,  0)

	if props.plate ~= nil then
		SetVehicleNumberPlateText(vehicle,  props.plate)
	end

	if props.plateIndex ~= nil then
		SetVehicleNumberPlateTextIndex(vehicle,  props.plateIndex)
	end

	if props.color1 ~= nil and props.color2 ~= nil then
		SetVehicleColours(vehicle, props.color1, props.color2)
	end

	if props.pearlescentColor ~= nil and props.wheelColor ~= nil then
		SetVehicleExtraColours(vehicle,  props.pearlescentColor,  props.wheelColor)
	end

	if props.wheels ~= nil then
		SetVehicleWheelType(vehicle,  props.wheels)
	end

	if props.windowTint ~= nil then
		SetVehicleWindowTint(vehicle,  props.windowTint)
	end

	if props.neonColor ~= nil then
		SetVehicleNeonLightsColour(vehicle,  props.neonColor[1], props.neonColor[2], props.neonColor[3])
	end

	if props.modSpoilers ~= nil then
		SetVehicleMod(vehicle, 0, props.modSpoilers, false)
	end

	if props.modFrontBumper ~= nil then
		SetVehicleMod(vehicle, 1, props.modFrontBumper, false)
	end

	if props.modRearBumper ~= nil then
		SetVehicleMod(vehicle, 2, props.modRearBumper, false)
	end

	if props.modSideSkirt ~= nil then
		SetVehicleMod(vehicle, 3, props.modSideSkirt, false)
	end

	if props.modExhaust ~= nil then
		SetVehicleMod(vehicle, 4, props.modExhaust, false)
	end

	if props.modFrame ~= nil then
		SetVehicleMod(vehicle, 5, props.modFrame, false)
	end

	if props.modGrille ~= nil then
		SetVehicleMod(vehicle, 6, props.modGrille, false)
	end

	if props.modHood ~= nil then
		SetVehicleMod(vehicle, 7, props.modHood, false)
	end

	if props.modFender ~= nil then
		SetVehicleMod(vehicle, 8, props.modFender, false)
	end

	if props.modRightFender ~= nil then
		SetVehicleMod(vehicle, 9, props.modRightFender, false)
	end

	if props.modRoof ~= nil then
		SetVehicleMod(vehicle, 10, props.modRoof, false)
	end

	if props.modEngine ~= nil then
		SetVehicleMod(vehicle, 11, props.modEngine, false)
	end

	if props.modBrakes ~= nil then
		SetVehicleMod(vehicle, 12, props.modBrakes, false)
	end

	if props.modTransmission ~= nil then
		SetVehicleMod(vehicle, 13, props.modTransmission, false)
	end

	if props.modHorns ~= nil then
		SetVehicleMod(vehicle, 14, props.modHorns, false)
	end

	if props.modSuspension ~= nil then
		SetVehicleMod(vehicle, 15, props.modSuspension, false)
	end

	if props.modArmor ~= nil then
		SetVehicleMod(vehicle, 16, props.modArmor, false)
	end

	if props.modTurbo ~= nil then
		ToggleVehicleMod(vehicle, 18, props.modTurbo)	
	end

	if props.modXenon ~= nil then
		ToggleVehicleMod(vehicle, 22, props.modXenon)
	end

	if props.modFrontWheels ~= nil then
		SetVehicleMod(vehicle, 23, props.modFrontWheels, false)
	end

	if props.modBackWheels ~= nil then
		SetVehicleMod(vehicle, 24, props.modBackWheels, false)
	end

end

AddEventHandler('esx_garage:hasEnteredMarker', function(zone)

	for k,v in pairs(Config.Parkings) do

		if zone == k then

			local playerPed = GetPlayerPed(-1)

			if IsPedInAnyVehicle(playerPed, false) then

				local vehicle     = GetVehiclePedIsIn(playerPed, false)
				local vehicleData = GetVehicleProperties(vehicle)

				for i=1, #PlayerData.parking, 1 do
					if PlayerData.parking[i].zone == zone then

						for j=1, #PlayerData.ownedVehicles, 1 do
							if PlayerData.ownedVehicles[j] == vehicleData.plate then
								vehicleData.owner = PlayerData.identifier
							end
						end

						PlayerData.parking[i].vehicle = vehicleData

					end
				end

				TriggerServerEvent('esx_garage:addedParkedVehicle', zone, vehicleData)
				TriggerEvent('esx:showNotification', 'Vehicle parked')
				break

			end
		end

	end

	if zone == 'ExteriorGarageEntryPoint' then

		local playerPed = GetPlayerPed(-1)

		if IsPedInAnyVehicle(playerPed,  false) then

			local vehicle = GetVehiclePedIsIn(playerPed, false)
			
			if GetPedInVehicleSeat(vehicle,  -1) == playerPed then
				LastVehicle = GetVehicleProperties(vehicle)
			end

			SetEntityCoords(playerPed, Config.Zones.InteriorGarageSpawnPoint.Pos.x, Config.Zones.InteriorGarageSpawnPoint.Pos.y, Config.Zones.InteriorGarageSpawnPoint.Pos.z)
			DeleteVehicle(vehicle)

		else

			SetEntityCoords(playerPed, Config.Zones.InteriorGarageSpawnPoint.Pos.x, Config.Zones.InteriorGarageSpawnPoint.Pos.y, Config.Zones.InteriorGarageSpawnPoint.Pos.z)

		end

	end

	if zone == 'InteriorGarageSpawnPoint' then

			IsInGarage = true

			local playerPed = GetPlayerPed(-1)

			if LastVehicle ~= nil then

				local model = LastVehicle.model
				
				Citizen.CreateThread(function()

					RequestModel(model)
					
					while not HasModelLoaded(model) do
						Citizen.Wait(0)
					end

					local vehicle = CreateVehicle(model, Config.Zones.InteriorGarageSpawnPoint.Pos.x, Config.Zones.InteriorGarageSpawnPoint.Pos.y, Config.Zones.InteriorGarageSpawnPoint.Pos.z + Config.ParkingZDiff,  0.0,  false,  false)
					
					SetModelAsNoLongerNeeded(model)
					SetVehicleOnGroundProperly(vehicle)
					TaskWarpPedIntoVehicle(playerPed,  vehicle,  -1)
					
					SetVehicleProperties(vehicle, LastVehicle)

					LastVehicle = nil

				end)

			end

			if not HasLoadedParking then

				Citizen.CreateThread(function()

					for i=1, #PlayerData.parking, 1 do

						if PlayerData.parking[i].vehicle.plate ~= nil then

							local zone        = PlayerData.parking[i].zone;
							local vehicleData = PlayerData.parking[i].vehicle
							local model       = vehicleData.model

							RequestModel(model)
							
							while not HasModelLoaded(model) do
								Citizen.Wait(0)
							end

							local vehicle = CreateVehicle(model, Config.Zones[zone].Pos.x, Config.Zones[zone].Pos.y, Config.Zones[zone].Pos.z + Config.ParkingZDiff, Config.Zones[zone].heading,  false,  false)

							SetModelAsNoLongerNeeded(model)
							SetVehicleOnGroundProperly(vehicle)
							
							SetVehicleProperties(vehicle, vehicleData)

						end

					end

				end)

				HasLoadedParking = true

			end

	end

	if zone == 'InteriorGarageExitPoint' then
            TriggerEvent('esx:showNotification', 'You are leaving your personal garage!')
		local playerPed = GetPlayerPed(-1)

		if IsPedInAnyVehicle(playerPed,  false) then

			local vehicle = GetVehiclePedIsIn(playerPed, false)
			LastVehicle   = GetVehicleProperties(vehicle)

			SetEntityCoords(playerPed, Config.Zones.ExteriorGarageSpawnPoint.Pos.x, Config.Zones.ExteriorGarageSpawnPoint.Pos.y, Config.Zones.ExteriorGarageSpawnPoint.Pos.z)
			DeleteVehicle(vehicle)

		else

			SetEntityCoords(playerPed, Config.Zones.ExteriorGarageSpawnPoint.Pos.x, Config.Zones.ExteriorGarageSpawnPoint.Pos.y, Config.Zones.ExteriorGarageSpawnPoint.Pos.z)

		end

		for k,v in pairs(Config.Parkings) do
			if IsAnyVehicleNearPoint(v.Pos.x, v.Pos.y, v.Pos.z, 4.0) then
				local vehicle = GetClosestVehicle(v.Pos.x, v.Pos.y, v.Pos.z, 4.0,  0,  71)
				DeleteVehicle(vehicle)
			end
		end

		HasLoadedParking = false

	end

	if zone == 'ExteriorGarageSpawnPoint' then
			TriggerEvent('esx:showNotification', 'You are at your personal garage!')

			IsInGarage                   = false
			IsInExteriorGarageSpawnPoint = true

			local playerPed = GetPlayerPed(-1)

			if LastVehicle ~= nil then

				local playerPed = GetPlayerPed(-1)
				local model     = LastVehicle.model
				
				Citizen.CreateThread(function()

					RequestModel(model)
					
					while not HasModelLoaded(model) do
						Citizen.Wait(0)
					end

					local vehicle = CreateVehicle(model, Config.Zones.ExteriorGarageSpawnPoint.Pos.x, Config.Zones.ExteriorGarageSpawnPoint.Pos.y, Config.Zones.ExteriorGarageSpawnPoint.Pos.z,  180.0,  true,  false)

				  SetModelAsNoLongerNeeded(model)
					SetVehicleOnGroundProperly(vehicle)

					TaskWarpPedIntoVehicle(playerPed,  vehicle,  -1)

					SetVehicleHasBeenOwnedByPlayer(vehicle,  true)
					SetEntityAsMissionEntity(vehicle,  true,  true)
					local id = NetworkGetNetworkIdFromEntity(vehicle)
					SetNetworkIdCanMigrate(id, true)
					
					SetVehicleProperties(vehicle, LastVehicle)

					TriggerServerEvent('esx_garage:setLastVehicle', LastVehicle,GetPlayerServerId())

					LastVehicle = nil
				end)

			end

	end

	if zone == 'Resell' then

		if IsAnyVehicleNearPoint(Config.Zones.Resell.Pos.x,  Config.Zones.Resell.Pos.y,  Config.Zones.Resell.Pos.z,  5.0) then
			TriggerEvent('esx:showNotification', 'Exit your vehicle and press ~g~ENTER~w~ to sell it to ' .. Config.ResellPercentage .. '% of original price')
		end

	end

end)

AddEventHandler('esx_garage:hasExitedMarker', function(zone)
	
	for k,v in pairs(Config.Parkings) do

		if zone == k then

			local playerPed = GetPlayerPed(-1)

			if IsPedInAnyVehicle(playerPed, false) then

				for i=1, #PlayerData.parking, 1 do

					local parking = PlayerData.parking[i]

					if parking.zone == zone then
						PlayerData.parking[i].vehicle = {}
						break
					end
				end

				TriggerServerEvent('esx_garage:removedParkedVehicle', k)
				TriggerEvent('esx:showNotification', 'Vehicle out')
			end
		end

	end

	if zone == 'ExteriorGarageSpawnPoint' then
		IsInExteriorGarageSpawnPoint = false
	end

end)

RegisterNetEvent('esx_garage:onPlayerData')
AddEventHandler('esx_garage:onPlayerData', function(playerData)
	PlayerData = playerData
end)

RegisterNetEvent('esx_garage:requestSaveVehicle')
AddEventHandler('esx_garage:requestSaveVehicle', function()

	local playerPed = GetPlayerPed(-1)

	if IsPedInAnyVehicle(playerPed,  true) then
		
		local vehicle     = GetVehiclePedIsIn(playerPed, false)
		local vehicleData = GetVehicleProperties(vehicle)

		TriggerServerEvent('esx_garage:responseSaveVehicle', vehicleData)

	else
		TriggerEvent('esx:showNotification', 'You must be in a vehicle')
	end

end)

RegisterNetEvent('esx_garage:spawnVehicle')
AddEventHandler('esx_garage:spawnVehicle', function(vehicleData)

	local playerPed = GetPlayerPed(-1)
	local coords    = GetEntityCoords(playerPed)
	local heading   = GetEntityHeading(playerPed)
	local model     = vehicleData.model

	Citizen.CreateThread(function()

		RequestModel(model)
		
		while not HasModelLoaded(model) do
			Citizen.Wait(0)
		end

		local vehicle = CreateVehicle(model, coords.x, coords.y, coords.z,  heading,  true,  false)

	  SetModelAsNoLongerNeeded(model)
		SetVehicleOnGroundProperly(vehicle)

		TaskWarpPedIntoVehicle(playerPed,  vehicle,  -1)

		SetVehicleHasBeenOwnedByPlayer(vehicle,  true)
		SetEntityAsMissionEntity(vehicle,  true,  true)
		local id = NetworkGetNetworkIdFromEntity(vehicle)
		SetNetworkIdCanMigrate(id, true)
		
		SetVehicleProperties(vehicle, vehicleData)
	end)

end)

RegisterNetEvent('esx_garage:responseResell')
AddEventHandler('esx_garage:responseResell', function(success)

	if success then

		local playerPed = GetPlayerPed(-1)

		if IsAnyVehicleNearPoint(Config.Zones.Resell.Pos.x,  Config.Zones.Resell.Pos.y,  Config.Zones.Resell.Pos.z,  5.0) and not IsPedInAnyVehicle(playerPed,  false) then
			local vehicle = GetClosestVehicle(Config.Zones.Resell.Pos.x,  Config.Zones.Resell.Pos.y,  Config.Zones.Resell.Pos.z,  5.0,  0,  71)
			DeleteVehicle(vehicle)
			TriggerEvent('esx:showNotification', 'Vehicle sold!')
		end

	else
		TriggerEvent('esx:showNotification', 'Sorry we dont buy stolen cars!')
	end

end)

-- Display markers
Citizen.CreateThread(function()
	while true do
		
		Wait(0)
		
		local coords = GetEntityCoords(GetPlayerPed(-1))
		
		for k,v in pairs(Config.Zones) do

			if Config.Parkings[k] ~= nil then

				local playerPed   = GetPlayerPed(-1)

				if(IsPedInAnyVehicle(playerPed,  false) and v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then
					DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, v.Color.r, v.Color.g, v.Color.b, 100, false, true, 2, false, false, false, false)
				end

			else

				if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then
					DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, v.Color.r, v.Color.g, v.Color.b, 100, false, true, 2, false, false, false, false)
				end

			end

		end
	end
end)

-- Marker interactions
Citizen.CreateThread(function()
	while true do
		
		Wait(0)
		
		local coords      = GetEntityCoords(GetPlayerPed(-1))
		local isInMarker  = false
		local currentZone = nil

		for k,v in pairs(Config.Zones) do
			if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x / 2) then
				isInMarker  = true
				currentZone = k
			end
		end

		if isInMarker and not hasAlreadyEnteredMarker then
			hasAlreadyEnteredMarker = true
			lastZone                = currentZone
			TriggerEvent('esx_garage:hasEnteredMarker', currentZone)
		end

		if not isInMarker and hasAlreadyEnteredMarker or (isInMarker and currentZone ~= lastZone) then
			hasAlreadyEnteredMarker = false
			TriggerEvent('esx_garage:hasExitedMarker', lastZone)
		end

	end
end)

-- Create blips
Citizen.CreateThread(function()

	local blip = AddBlipForCoord(Config.Zones.ExteriorGarageEntryPoint.Pos.x, Config.Zones.ExteriorGarageEntryPoint.Pos.y, Config.Zones.ExteriorGarageEntryPoint.Pos.z)
  
  SetBlipSprite (blip, 357)
  SetBlipDisplay(blip, 4)
  SetBlipScale  (blip, 1.2)
  SetBlipColour (blip, 3)
  SetBlipAsShortRange(blip, true)
	
	BeginTextCommandSetBlipName("STRING")
  AddTextComponentString("Personal Garage")
  EndTextCommandSetBlipName(blip)

	local blip = AddBlipForCoord(Config.Zones.Resell.Pos.x, Config.Zones.Resell.Pos.y, Config.Zones.Resell.Pos.z)
  
  SetBlipSprite (blip, 207)
  SetBlipDisplay(blip, 4)
  SetBlipScale  (blip, 1.2)
  SetBlipColour (blip, 3)
  SetBlipAsShortRange(blip, true)
	
	BeginTextCommandSetBlipName("STRING")
  AddTextComponentString("Chop Shop")
  EndTextCommandSetBlipName(blip)


end)

-- Hide other players in garage / No collide in ExteriorGarageSpawnPoint
Citizen.CreateThread(function()

	while true do

		Wait(0)

		local playerPed = GetPlayerPed(-1)

		if IsInGarage then

			for i=0, 32, 1 do
				if i ~= PlayerId() then
					local otherPlayerPed = GetPlayerPed(i)
					SetEntityLocallyInvisible(otherPlayerPed)
					SetEntityNoCollisionEntity(playerPed,  otherPlayerPed,  true)
				end
			end

		end

		if IsInExteriorGarageSpawnPoint then

			for i=0, 32, 1 do
				if i ~= PlayerId() then
					local otherPlayerPed = GetPlayerPed(i)
					SetEntityNoCollisionEntity(playerPed,  otherPlayerPed,  true)
				end
			end

			if IsPedInAnyVehicle(playerPed,  true) then

				local vehicle = GetVehiclePedIsIn(playerPed,  true)
				
				for i=0, 32, 1 do
					if i ~= PlayerId() then

						local otherPlayerPed = GetPlayerPed(i)

						if IsPedInAnyVehicle(otherPlayerPed,  true) then
							local otherPlayerVehicle = GetVehiclePedIsIn(otherPlayerPed,  true)
							SetEntityNoCollisionEntity(playerPed,  otherPlayerVehicle,  true)
							SetEntityNoCollisionEntity(vehicle,    otherPlayerVehicle,  true)
						end
					end

				end

			end

		end

	end

end)

Citizen.CreateThread(function()

	while true do

		Wait(0)

		if lastZone == 'Resell' and IsControlPressed(0,  Keys['ENTER']) and (GetGameTimer() - GUI.Time) > 500 then

			local playerPed = GetPlayerPed(-1)

			if IsAnyVehicleNearPoint(Config.Zones.Resell.Pos.x,  Config.Zones.Resell.Pos.y,  Config.Zones.Resell.Pos.z,  5.0) and not IsPedInAnyVehicle(playerPed,  false) then

				local vehicle = GetClosestVehicle(Config.Zones.Resell.Pos.x,  Config.Zones.Resell.Pos.y,  Config.Zones.Resell.Pos.z,  5.0,  0,  71)
				local model   = GetEntityModel(vehicle)

				TriggerEvent('vehshop:getVehicleCost', model, function(cost)
					
					if cost == -1 then
						TriggerEvent('esx:showNotification', 'This vehicle is not in our catalog')
					else
						local percentCost = round(cost / 100 * Config.ResellPercentage, 0)
						TriggerServerEvent('esx_garage:requestResell', GetVehicleNumberPlateText(vehicle), percentCost,GetPlayerServerId())
					end

				end)

			end

			GUI.Time = GetGameTimer()

		end

	end

end)

#17

how to add garage more point


#20

ok So here is the issue I have right now. Someone pulled there car out of this garage and when they did and left it on the street now it says the own a car and we can’t find it anywhere but in the DB. Dose this garage have like a reset that after a set time the car shows back up?
Is there away to right it if the server restarts the car gose in thee garage or can you add like a impound lot to the garage where they can go get there car for a set fee if the car gose missing? What dose everyone else do when this happens and can you please share?


#21

Did you figure it out ?


#22

I love this garage script, only wish it only allowed owned vehicles to be pulled in.


#23

vehicles dont save and noughing appears when i take it too a blue marker