Implemented plate generation from esx_migrate

This commit is contained in:
ElPumpo
2018-07-24 16:20:52 +02:00
parent 1f6cbe9d8d
commit 6a4ccf0cd7
7 changed files with 105 additions and 12 deletions
+13 -4
View File
@@ -419,9 +419,13 @@ function OpenResellerMenu ()
if closestPlayer == -1 or closestDistance > 3.0 then
ESX.ShowNotification(_U('no_players'))
else
SetVehicleNumberPlateText(LastVehicles[#LastVehicles], string.upper(ESX.GetRandomString(8)))
local newPlate = GeneratePlate()
local vehicleProps = ESX.Game.GetVehicleProperties(LastVehicles[#LastVehicles])
local model = CurrentVehicleData.model
vehicleProps.plate = newPlate
SetVehicleNumberPlateText(LastVehicles[#LastVehicles], newPlate)
TriggerServerEvent('esx_vehicleshop:sellVehicle', model)
@@ -441,10 +445,12 @@ function OpenResellerMenu ()
ESX.ShowNotification(_U('no_players'))
else
ESX.TriggerServerCallback('esx:getOtherPlayerData', function (xPlayer)
SetVehicleNumberPlateText(LastVehicles[#LastVehicles], string.upper(ESX.GetRandomString(8)))
local newPlate = GeneratePlate()
local vehicleProps = ESX.Game.GetVehicleProperties(LastVehicles[#LastVehicles])
local model = CurrentVehicleData.model
vehicleProps.plate = newPlate
SetVehicleNumberPlateText(LastVehicles[#LastVehicles], newPlate)
TriggerServerEvent('esx_vehicleshop:sellVehicle', model)
if Config.EnableSocietyOwnedVehicles then
@@ -476,9 +482,12 @@ function OpenResellerMenu ()
if closestPlayer == -1 or closestDistance > 5.0 then
ESX.ShowNotification(_U('no_players'))
else
SetVehicleNumberPlateText(LastVehicles[#LastVehicles], 'RENT' .. string.upper(ESX.GetRandomString(4)))
local newPlate = 'RENT' .. string.upper(ESX.GetRandomString(4))
local vehicleProps = ESX.Game.GetVehicleProperties(LastVehicles[#LastVehicles])
local model = CurrentVehicleData.model
vehicleProps.plate = newPlate
SetVehicleNumberPlateText(LastVehicles[#LastVehicles], newPlate)
TriggerServerEvent('esx_vehicleshop:rentVehicle', model, vehicleProps.plate, GetPlayerName(closestPlayer), CurrentVehicleData.price, amount, GetPlayerServerId(closestPlayer))