Hi all, im trying to get this code to work GCPHONE.
Idk why, but for some reason, cops wont get called…
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if carThief then
local coords = GetEntityCoords(GetPlayerPed(-1))
local vehicleModel = GetHashKey(Config.dropoffPoints[dropoff].model)
RequestModel(vehicleModel)
while not HasModelLoaded(vehicleModel) do
Citizen.Wait(0)
end
if GetDistanceBetweenCoords(coords, Config.dropoffPoints[dropoff].sx, Config.dropoffPoints[dropoff].sy, Config.dropoffPoints[dropoff].sz, true) < 50 then
local spawned_cars = CreateVehicle(vehicleModel, Config.dropoffPoints[dropoff].sx, Config.dropoffPoints[dropoff].sy, Config.dropoffPoints[dropoff].sz, Config.dropoffPoints[dropoff].sh, true, false)
SetVehicleOnGroundProperly(spawned_cars)
local hasTjuvkopplat = 0
repeat
Citizen.Wait(500)
if IsPedInVehicle(GetPlayerPed(-1), spawned_cars, false) then
--Bost försök att lösa felet
-- robbery_alert = 'Någon har stulit min bil, skynda er hit!'
--local PlayerCoords = { x = PedPosition.x, y = PedPosition.y, z = PedPosition.z }
-- TriggerServerEvent('esx_addons_gcphone:startCall', 'police', robbery_alert, PlayerCoords, {
--PlayerCoords = { x = PedPosition.x, y = PedPosition.y, z = PedPosition.z },
TriggerServerEvent('esx_addons_gcphone:startCall', 'police', true, {x = Config.dropoffPoints[dropoff].sx, y = Config.dropoffPoints[dropoff].sy, z = Config.dropoffPoints[dropoff].sz}, true)
ClearPrints()
SetTextEntry_2("STRING")
AddTextComponentString(_U('hot_wire').. '.')
DrawSubtitleTimed(500, 1)
Citizen.Wait(500)
ClearPrints()
SetTextEntry_2("STRING")
AddTextComponentString(_U('hot_wire').. '..')
DrawSubtitleTimed(500, 1)
Citizen.Wait(500)
ClearPrints()
SetTextEntry_2("STRING")
AddTextComponentString(_U('hot_wire').. '...')
DrawSubtitleTimed(500, 1)
Citizen.Wait(500)
ClearPrints()
SetTextEntry_2("STRING")
AddTextComponentString(_U('hot_wire').. '.')
DrawSubtitleTimed(500, 1)
Citizen.Wait(500)
ClearPrints()
SetTextEntry_2("STRING")
AddTextComponentString(_U('hot_wire').. '..')
DrawSubtitleTimed(500, 1)
Citizen.Wait(500)
ClearPrints()
SetTextEntry_2("STRING")
AddTextComponentString(_U('hot_wire').. '...')
DrawSubtitleTimed(500, 1)
Citizen.Wait(500)
hasTjuvkopplat = 1
end
until(hasTjuvkopplat == 1)
local timesUntilSendareLoss = 240
repeat
Citizen.Wait(500)
if IsPedInVehicle(GetPlayerPed(-1), spawned_cars, false) then
ClearPrints()
SetTextEntry_2("STRING")
AddTextComponentString(_U('remove_transmitter_1') .. timesUntilSendareLoss .. _U('remove_transmitter_2'))
DrawSubtitleTimed(1000, 1)
Citizen.Wait(400)
local vehicleCoords = GetEntityCoords(spawned_cars)
local Position = {x = vehicleCoords.x, y = vehicleCoords.y, z = vehicleCoords.z}
TriggerServerEvent('loffe_carthief:moveblip', Position)
timesUntilSendareLoss = timesUntilSendareLoss - 1
end
until(timesUntilSendareLoss == 0)
timesUntilSendareLoss = 240
Blip = AddBlipForCoord(Config.dropoffPoints[dropoff].x, Config.dropoffPoints[dropoff].y, Config.dropoffPoints[dropoff].z)
SetBlipRoute(Blip, true)
SetBlipColour(Blip, 11)
SetBlipRouteColour(Blip, 11)
TriggerServerEvent('loffe_carthief:removeblip')
local hasSoldVehicle = 0
repeat
Citizen.Wait(500)
local coords = GetEntityCoords(GetPlayerPed(-1))
if IsPedInVehicle(GetPlayerPed(-1), spawned_cars, false) then
if GetDistanceBetweenCoords(coords, Config.dropoffPoints[dropoff].x, Config.dropoffPoints[dropoff].y, Config.dropoffPoints[dropoff].z, true) < 5 then
TaskEveryoneLeaveVehicle(spawned_cars)
TaskLeaveVehicle(GetPlayerPed(-1), spawned_cars, 0)
Wait(2000)
ClearPedTasksImmediately(GetPlayerPed(-1))
SetVehicleDoorsLocked(spawned_cars, 2)
RemoveBlip(Blip)
TriggerServerEvent('loffe_carthief:questFinished')
hasSoldVehicle = 1
end
ClearPrints()
SetTextEntry_2("STRING")
AddTextComponentString(_U('drive_text'))
DrawSubtitleTimed(500, 1)
end
until(hasSoldVehicle == 1)
RemoveBlip(Blip)
local hasRemovedCar = false
while not hasRemovedCar do
Wait(1000)
local coordsMe = GetEntityCoords(GetPlayerPed(-1))
local coordsCar = GetEntityCoords(spawned_cars)
if GetDistanceBetweenCoords(coordsMe, coordsCar) > 50 then
SetEntityAsMissionEntity(spawned_cars, 0, 0)
DeleteVehicle(spawned_cars)
hasRemovedCar = true
carThief = false
end
end
end
end
end
end)