#qb-garage

1 messages · Page 1 of 1 (latest)

hot loom
#

Because every time I do a /dv or the server restarts I go to the depot and my vehicle is not there. It tells me that there is nothing. Where are they going? They are not in the garage either.

onyx mason
#

How are you aquiring the vehicle

hot loom
#

and then bought the car and still no

onyx mason
hot loom
onyx mason
#

What garage resource

hot loom
onyx mason
#

Any script errors?

hot loom
onyx mason
#

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.

hot loom
onyx mason
#

is it in your database before you /dv it?

onyx mason
#

Is it in your database after you /dv it?

onyx mason
#

So park it before you delete it.

hot loom
onyx mason
#

You're gonna have to give more information. Playing 20 questions isn't fun. Like I said, this works.

hot loom
#

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...

onyx mason
#

qb-vehicleshop is a different thing entiely

sullen pike
#

You're checking the right garage? The one in Legion Square?

sullen pike
#

Your database says it's there but in the out state. It's not showing in the list at all?

sullen pike
#

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?

hot loom
#

I go there and he tells me out.

sullen pike
#

That's because of the state being set to 0

#

When you DV a car, it doesn't change the state back to 1.

hot loom
sullen pike
#

In your database, where you see 'state', change that 0 to a 1.

cunning grail
#

it say that the vehicle cant be tracked, so for some reason your vehicle is "outside"

hot loom
sullen pike
#

You changed depotprice to 1, not state.

#

depotprice should remain 0

#

state should be 1.

hot loom
sullen pike
#

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?

hot loom
#

.What do you mean?

sullen pike
#

I mean that I believe the DV command doesn't change the garage state.

hot loom
#

I don't know what it is, every time I delete the car with dv it doesn't show it in the deposit

sullen pike
#

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.

onyx mason
#

Yes, it's not being sent to the depot when you dv it.

sullen pike
#

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.

hot loom
#

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?

sullen pike
#

Besides that, I recommend only DVing if necessary. DV isn't really meant to replace parking a car.

cunning grail
sullen pike
#

Yeah it would require modifying the command.

hot loom
cunning grail
#

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

hot loom
cunning grail
#

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

drifting sun
#

using /dv doesnt send cars back to garage./ it literally just removes the car from the world and should only be used by admins

cunning grail
#

another problem is the entity ownership some times you cant delete it

hot loom