Skip to content

Commit

Permalink
fix: admincar command
Browse files Browse the repository at this point in the history
  • Loading branch information
Manason committed Jun 14, 2024
1 parent 5ed2795 commit 5c862d6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions server/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,23 @@ lib.addCommand('admincar', {

local playerData = exports.qbx_core:GetPlayer(source).PlayerData
local vehName, props = lib.callback.await('qbx_admin:client:GetVehicleInfo', source)
if exports.qbx_vehicles:DoesEntityPlateExist(props.plate) then
local vehicleId = Entity(vehicle).state.vehicleid
if vehicleId then
local response = lib.callback.await('qbx_admin:client:SaveCarDialog', source)

if not response then
return exports.qbx_core:Notify(source, 'Canceled.', 'inform')
end
exports.qbx_vehicles:SetVehicleEntityOwner({
citizenId = playerData.citizenid,
plate = props.plate
})
local success, err = exports.qbx_vehicles:SetPlayerVehicleOwner(vehicleId, playerData.citizenid)
if not success then error(err) end
else
exports.qbx_vehicles:CreateVehicleEntity({
citizenId = playerData.citizenid,
local vehicleId, err = exports.qbx_vehicles:CreatePlayerVehicle({
model = vehName,
mods = props,
plate = props.plate
citizenId = playerData.citizenid,
props = props,
})
if err then error(err) end
Entity(vehicle).state:set('vehicleid', vehicleId, true)
end
exports.qbx_core:Notify(source, 'This vehicle is now yours.', 'success')
end)
Expand Down

0 comments on commit 5c862d6

Please sign in to comment.