1.The administrator gives a car directly to the player through instructions, and the car will be added to the player’s garage
2.The administrator directly deletes the player’s vehicle through instructions
[give me]
1./givecar [model]
[give to Player]
2./giveyoucar [model] [Player game id (number)]
[Delete vehicle]
3./dvplate [plate]
Works great, only thing I note is the car that actually spawns is not the car with the plate, but if you delete it, and grab the actual car from the impound it works fine.
Problem, i get the car in garage and i can take it out but when i want to store it again says, did you really own this car? Also i can lock the cars cause system do not detect owned car nearby, any fix?
the script is very good , could you help me to add modelname of the car on database ?
for example if i type
/givecar nissantitan17 PLATE ID
nissantitan17 is a modelname in my database
i added this to server/main.lua
RegisterServerEvent('nuo:setVehicleBySql')
AddEventHandler('nuo:setVehicleBySql', function (vehicleProps,vehicleData)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
MySQL.Async.execute('INSERT INTO owned_vehicles (owner, plate, vehicle, modelname) VALUES (@owner, @plate, @vehicle, @modelname)',
{
['@owner'] = xPlayer.identifier,
['@plate'] = vehicleProps.plate,
['@vehicle'] = json.encode(vehicleProps),
['@modelname'] = vehicleData.model
}, function (rowsChanged)
TriggerClientEvent('esx:showNotification', _source,'addCar:palte:'..vehicleProps.plate)
end)
end)