LH_Lawliet

Untitled

Jul 13th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.88 KB | None | 0 0
  1. local radarpose=0
  2. local conepose=0
  3. local hersepose=0
  4.  
  5. -- fonction check voiture radar
  6. function GetCurrentTargetCar()
  7.     local ped = GetPlayerPed(-1)
  8.     local coords = GetEntityCoords(ped)
  9.    
  10.     local entityWorld = GetOffsetFromEntityInWorldCoords(ped, 0.0, 100.0, 0.0)
  11.     local rayHandle = Citizen.InvokeNative(0x28579D1B8F8AAC80, coords.x, coords.y, coords.z, entityWorld.x, entityWorld.y, entityWorld.z, 3.0, 2, ped, 0)
  12.     local a, b, c, d, vehicleHandle = GetRaycastResult(rayHandle)
  13.  
  14.     return vehicleHandle
  15. end
  16.  
  17. -- vue radar
  18.  
  19. Citizen.CreateThread(function()
  20.     while true do
  21.         Wait(0)
  22.             if radarpose==1 then                       
  23.                 local pos = GetEntityCoords(GetPlayerPed(-1))
  24.                 local coordA = GetEntityCoords(GetPlayerPed(-1), 1)
  25.                 local coordB = GetOffsetFromEntityInWorldCoords(GetPlayerPed(-1), 0.5, 75.0, 0.0)
  26.                 local targetVehicle = GetCurrentTargetCar()            
  27.                  if targetVehicle ~=nil then
  28.                      local plate=GetVehicleNumberPlateText(targetVehicle)
  29.                      local herSpeedKm=GetEntitySpeed(targetVehicle)*3.6
  30.                      info = string.format("~b~Plaque:~w~ %s ~n~~y~Km/h:  ~r~%s",plate,math.ceil(herSpeedKm) )
  31.                     DrawRect(0.5,0.0,0.12,0.18,0,10,28,210)
  32.                     exports.ft_ui:Text(info, 0, 0, 0.45, 0.01, 0.4, 255, 255, 255, 255)
  33.                  end
  34.             end
  35.      end  
  36. end)
  37.  
  38.  
  39. -- pose radar
  40.  
  41. Citizen.CreateThread(function()
  42.     while true do
  43.         Wait(0)
  44.  
  45.         if IsControlPressed(1, 244)then
  46.             if radarpose==0 then
  47.                 RadarPos = GetOffsetFromEntityInWorldCoords(GetPlayerPed(-1), 0, 1.5, 0)
  48.                 RadarAng = GetEntityRotation(GetPlayerPed(-1))
  49.                 Radar = CreateObject(1927491455, RadarPos.x, RadarPos.y, RadarPos.z - 7, true, true, true) -- http://gtan.codeshock.hu/objects/index.php?page=1&search=prop_cctv_pole_01a
  50.                 SetEntityRotation(Radar, RadarAng.x, RadarAng.y, RadarAng.z - 115)
  51.                 FreezeEntityPosition(GetPlayerPed(-1), true)
  52.                 SetFollowPedCamViewMode(4)
  53.                 radarpose=1
  54.             end
  55.         end    
  56.     end        
  57. end)
  58.  
  59. -- delete radar
  60.  
  61. Citizen.CreateThread(function()
  62.     while true do
  63.         Wait(0)
  64.  
  65.         if IsControlPressed(1, 178)then
  66.             if radarpose==1 then
  67.                 DeleteObject(Radar) -- remove the radar pole (otherwise it leaves from inside the ground)
  68.                 DeleteEntity(Radar)
  69.                 FreezeEntityPosition(GetPlayerPed(-1), false)
  70.                 SetFollowPedCamViewMode(0)
  71.                 radarpose=0
  72.             end
  73.         end    
  74.     end        
  75. end)
  76.  
  77.  
  78. -- creat cone
  79.  
  80.  
  81. Citizen.CreateThread(function()
  82.     while true do
  83.         Wait(0)
  84.         if IsControlPressed(1, 172)then
  85.             if radarpose<25 then
  86.                 ConePos = GetOffsetFromEntityInWorldCoords(GetPlayerPed(-1), 0, 1.5, 0)
  87.                 ConeAng = GetEntityRotation(GetPlayerPed(-1))
  88.                 Cone = CreateObject(1839621839, ConePos.x, ConePos.y, ConePos.z - 1, true, true, true) -- http://gtan.codeshock.hu/objects/index.php?page=1&search=prop_cctv_pole_01a
  89.                 SetEntityRotation(Cone, ConeAng.x, ConeAng.y, ConeAng.z - 115)
  90.                 conepose=conepose+1
  91.                 Wait(1000)
  92.             end
  93.         end    
  94.     end        
  95. end)
  96.  
  97. -- creat herse
  98.  
  99. Citizen.CreateThread(function()
  100.     while true do
  101.         Wait(0)
  102.         if IsControlPressed(1, 175)then
  103.             if hersepose==0 then
  104.                 hersePos = GetOffsetFromEntityInWorldCoords(GetPlayerPed(-1), 0, 1.5, 0)
  105.                 herseAng = GetEntityRotation(GetPlayerPed(-1))
  106.                 herse = CreateObject(1276148988, hersePos.x, hersePos.y, hersePos.z - 1, true, true, true) -- http://gtan.codeshock.hu/objects/index.php?page=1&search=prop_cctv_pole_01a
  107.                 SetEntityRotation(herse, herseAng.x, herseAng.y, herseAng.z)
  108.                 hersepose=0
  109.                 Wait(1000)
  110.             end
  111.         end    
  112.     end        
  113. end)
  114.  
  115. -- delete cone
  116.  
  117. Citizen.CreateThread(function()
  118.     while true do
  119.         Wait(0)
  120.         if IsControlPressed(1, 173)then
  121.                 DeleteObject(Cone)
  122.                 DeleteEntity(Cone)
  123.                 conepose=0 
  124.         end    
  125.     end        
  126. end)
  127.  
  128.  
  129. -- test pour voir si vehicule sur herse
  130.  
  131. Citizen.CreateThread(function()
  132.     while true do
  133.         Wait(0)
  134.        
  135.         local carfind = GetClosestVehicle(hersePos.x, hersePos.y, hersePos.z, 2,0,70)
  136.         SetVehicleBurnout(carfind, true)
  137.            
  138.  
  139.     end        
  140. end)
Advertisement
Add Comment
Please, Sign In to add comment