FiveM sell vehicle
-
I did this but it would seem not work, how can I solve?
CLIENT SIDE
#code block
if IsPedInAnyVehicle(GetPlayerPed(-1), false ) then
local veh = GetVehiclePedIsIn(GetPlayerPed(-1), false)
local veicoloProprieta = ESX.Game.GetVehicleProperties(veh)
TriggerServerEvent('esx_mafiajob:vendiauto', veicoloProprieta, player) ESX.Game.DeleteVehicle(veh)SERVER SIDE
#code block
RegisterServerEvent('esx_mafiajob:vendiauto')
AddEventHandler('esx_mafiajob:vendiauto', function(vehicleProps, target)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local vehicules = getPlayerVehicles(xPlayer.getIdentifier())
local plate = vehicleProps.plate
local target = ESX.GetPlayerFromId(target)for _,v in pairs(vehicules) do if(plate == v.plate)then local idveh = v.id MySQL.Sync.execute("UPDATE owned_vehicles SET owner=@target WHERE id=@id",{['@target'] = target.getIdentifier() , ['@id'] = v.id}) break end end
end)
-
your better asking for help on the fivem discord