Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ESX = nil
- local PlayerData = {}
- --Car Positions:
- local position1=vector3(-1201.18,-1738.57,4.39)
- local position2=vector3(-1197.7,-1738.15,4.39)
- local position3=vector3(-1194.03,-1737.95,4.39)
- Citizen.CreateThread(function()
- while ESX == nil do
- TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
- Citizen.Wait(0)
- end
- end)
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(1000)
- PlayerData = ESX.GetPlayerData()
- end
- end)
- RegisterCommand('testcar', function(source, args, rawCommand)
- if PlayerData.job.name == 'cardealer' then
- local veh = args[1]
- local position=tonumber(args[2])
- if veh == nil then
- ESX.ShowNotification("~r~Please enter a car model")
- end
- vehiclehash = GetHashKey(veh)
- RequestModel(vehiclehash)
- Citizen.CreateThread(function()
- local waiting = 0
- while not HasModelLoaded(vehiclehash) do
- waiting = waiting + 100
- Citizen.Wait(100)
- if waiting > 5000 then
- ESX.ShowNotification("Could not load the vehicle model.")
- break
- end
- end
- if position then
- if position==1 then
- TriggerEvent("SpawnVehicle",position1)
- elseif position==2 then
- TriggerEvent("SpawnVehicle",position2)
- elseif position==3 then
- TriggerEvent("SpawnVehicle",position3)
- end
- else
- ESX.ShowNotification("~r~No position")
- end
- end)
- elseif PlayerData.job.name ~= 'cardealer' then
- ESX.ShowNotification("~r~You cannot use this command")
- end
- end)
- --CLEARING THE AREA OUT OF VEHICLES
- Citizen.CreateThread(function()
- while true do
- ClearAreaOfVehicles(-1168.08, -1747.34, 4.0, 30.0, false,false,false,false,false)
- Citizen.Wait(0)
- end
- end)
- RegisterCommand('dvtest', function()
- if PlayerData.job.name == 'cardealer' then
- if IsPedSittingInAnyVehicle(GetPlayerPed(-1)) and not IsEntityDead(GetPlayerPed(-1)) then
- DeleteEntity(GetVehiclePedIsIn(GetPlayerPed(-1),false))
- end
- end
- end)
- RegisterNetEvent("SpawnVehicle")
- AddEventHandler('SpawnVehicle', function(x,y,z)
- ESX.Game.SpawnVehicle(vehiclehash,x,y,z,296,function(vehicle)
- FreezeEntityPosition(vehicle, true)
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement