#qb-garage
1 messages · Page 1 of 1 (latest)
How are you aquiring the vehicle
/admincar
and then bought the car and still no
what resource is giving you this command?
qb-adminmenu
What garage resource
qb-garage
Any script errors?
noup
I installed a server the other day from the recipe and this isn't an issue. I can spawn a car, give it to myself with the admin menu, and hey presto, it's there in the database.
But as I said where am I going to get the car back once I delete it with /dv or every reboot it is not in the storage or in the garage
is it in your database before you /dv it?
yes
Is it in your database after you /dv it?
So park it before you delete it.
I did it and nothing
You're gonna have to give more information. Playing 20 questions isn't fun. Like I said, this works.
I'm telling you everything you're asking me. I bought the car, parked it in the garage, took it out, deleted it and it's not in the warehouse...
qb-vehicleshop is a different thing entiely
You're checking the right garage? The one in Legion Square?
Your database says it's there but in the out state. It's not showing in the list at all?
Yeah that's what I'm saying. Your database says it's in the garage in Legion Square.
What do you see when you go there and try to access the garage?
I go there and he tells me out.
That's because of the state being set to 0
When you DV a car, it doesn't change the state back to 1.
In your database, where you see 'state', change that 0 to a 1.
it say that the vehicle cant be tracked, so for some reason your vehicle is "outside"
When changing it to 1, the car is given to me in the depot and how should I set that to 1 when I am outside?
You changed depotprice to 1, not state.
depotprice should remain 0
state should be 1.
How do you establish that it is not manual but that the script does it by itself?
Using DV, from my memory, has never changed the vehicle state unfortunately. Is there a reason you're using that to get rid of your vehicles?
.What do you mean?
I mean that I believe the DV command doesn't change the garage state.
I don't know what it is, every time I delete the car with dv it doesn't show it in the deposit
Yeah because it doesn't change the state. It's still considered OUT. So the car will show in whichever garage you parked it in last, but the state will still remain 0.
Yes, it's not being sent to the depot when you dv it.
If you make sure to set this in your qb-garages/config.lua:
Config.AutoRespawn = true -- true == stores cars in garage on restart | false == doesnt modify car states
Then on server restart the cars will be in their garages with state 1, unless they were impounded by police.
Ok, that's what I want to change, if the car was erased by dv or is lost somewhere, you can go to the depot and recover it, how can I do it?
Besides that, I recommend only DVing if necessary. DV isn't really meant to replace parking a car.
you can change the behavior of the command to check if is owned and adding the state to 1
Yeah it would require modifying the command.
because the thing is not to be touching the player's SQL all the time but to do it alone
sorry didnt understand
you dont need to do all the time, just when you "dv"
you check if the vehicle is owned, and if it is you set "store" to 1, and add a default garage
else, you just delete the vehicle
From what I've been told, what I have to do is edit the dv code, but I don't know how I can do it so that when I make a dv it takes the car to the depot.
you need to have a small knowledge of lua and how the core works, maybe big problems will appear and you cant wait until someonelse fixed it, im not saying in the bad way im saying like "No esperes por otros para porque no te van a ayudar mucho" Dont expect other people fix your problems
QBCore.Commands.Add('dv', Lang:t('command.dv.help'), {}, false, function(source)
local coords = GetEntityCoords(GetPlayerPed(source))
local closeVeh, closeDist = QBCore.Functions.GetClosestVehicle(coords)
local vehicle = GetVehiclePedIsIn(GetPlayerPed(source), false) or closeVeh
if vehicle then
local plate = GetVehicleNumberPlateText(vehicle)
local result = MySQL.query.await("SELECT plate FROM player_vehicles WHERE plate = ?", { plate })
if result and #result > 0 then
local update = MySQL.update.await("UPDATE player_vehicles SET garage = 'pillboxgarage' WHERE plate = ?",
{ plate })
end
TriggerClientEvent('QBCore:Command:DeleteVehicle', source)
else
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.no_vehicle_near'), 'error')
end
end, 'admin')
try this code and also change the garage 'pillboxgarage' to de default one, i dont remember the name
using /dv doesnt send cars back to garage./ it literally just removes the car from the world and should only be used by admins
another problem is the entity ownership some times you cant delete it
I already have it, in the end I did it another way, thanks a lot bro, but one thing, how can I do so that when the car is in another garage or depot, the menu in the photo does not appear?