Advertisement
Guest User

Untitled

a guest
May 19th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.49 KB | None | 0 0
  1. --[[
  2. autor: EZ3N (for: ventos-rpg.pl)
  3. wszelkie prawwa zastrzezone!
  4. ]]
  5.  
  6. local sw,sh = guiGetScreenSize()
  7. local baseX = 1920
  8. local zoom = 1
  9. zoom=1920/sw
  10.  
  11. function wczytajFont()
  12. roboto = dxCreateFont("/misc/roboto.ttf",12/zoom)
  13. end
  14.  
  15. function usunFont()
  16. if roboto then
  17. destroyElement(roboto)
  18. roboto = nil
  19. end
  20. end
  21.  
  22. local miejsca = {
  23. --{x,y,z,dystans,limit}
  24. {1569.40234375, -2471.0029296875, 13.5546875, 5, 80},
  25. {1536.0908203125, -2466.4052734375, 13.28168296814,4,60},
  26. }
  27.  
  28. function pokazMandat()
  29. if ss then
  30. dxDrawImage(61/zoom, 419/zoom, 432/zoom, 243/zoom, ss, 350, 0, 0, tocolor(255,255,255), false)
  31. dxDrawText(getVehiclePlateText(getPedOccupiedVehicle(localPlayer)), 715/zoom, 780/zoom, 1205/zoom, 1070/zoom, tocolor(100,255,100, 255), 1, roboto, "center", "center", false)
  32. dxDrawText("KM/h: "..string.format("%.00f",kmh), 715/zoom, 830/zoom, 1205/zoom, 1070/zoom, tocolor(255, 255, 255, 255), 1, roboto, "center", "center", false)
  33. dxDrawText("PKT.KARNE: "..getElementData(localPlayer,"punkty:karne").."/20", 715/zoom, 880/zoom, 1205/zoom, 1070/zoom, tocolor(255, 255, 255, 255), 1, roboto, "center", "center", false)
  34. dxDrawText("POZIOM POSZUKIWAŃ: 2", 715/zoom, 930/zoom, 1205/zoom, 1070/zoom, tocolor(255, 255, 255, 255), 1, roboto, "center", "center", false)
  35. end
  36. end
  37.  
  38. function wlaczFotoradar()
  39. for k,v in pairs(miejsca) do
  40. if (source == miejsca[k].cs) then
  41. if isPedInVehicle(localPlayer) then
  42. pojazd = getPedOccupiedVehicle(localPlayer)
  43. if getVehicleSirensOn(pojazd) or getVehicleType(pojazd) == "Plane" or getVehicleType(pojazd) == "Helicopter" or getVehicleType(pojazd) == "Boat" or getVehicleType(pojazd) == "BMX" or getElementDimension(localPlayer) ~= 0 or getElementInterior(localPlayer) ~= 0 or getVehicleController(pojazd) ~= localPlayer then return end
  44. speedx,speedy,speedz = getElementVelocity(pojazd)
  45. actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5)
  46. kmh = actualspeed * 180
  47. przekroczenie = kmh - miejsca[k][5]
  48. limit = miejsca[k][5]
  49. liczbapkt = przekroczenie > 100 and 0.5 or przekroczenie > 75 and 0.4 or przekroczenie > 50 and 0.3 or przekroczenie > 25 and 0.2 or przekroczenie < 10 and 0.1
  50. if (kmh-10>miejsca[k][5]) then
  51. if isEventHandlerAdded("onClientRender",root,pokazMandat) then return end
  52. fadeCamera(false,0.1,255,255,255)
  53. ss = dxCreateScreenSource(500,500)
  54. dxUpdateScreenSource(ss)
  55. addEventHandler("onClientRender",root,pokazMandat)
  56. wczytajFont()
  57. setTimer(fadeCamera,60,1,true,1.5)
  58. setElementData(localPlayer,"punkty:karne",getElementData(localPlayer,"punkty:karne")+liczbapkt)
  59. setTimer(function()
  60. removeEventHandler("onClientRender",root,pokazMandat)
  61. usunFont()
  62. end, 5000,1)
  63. end
  64. end
  65. end
  66. end
  67. end
  68.  
  69. for k,v in pairs(miejsca) do
  70. miejsca[k].cs = createColSphere(miejsca[k][1],miejsca[k][2],miejsca[k][3],miejsca[k][4])
  71. end
  72. addEventHandler("onClientColShapeHit",resourceRoot,wlaczFotoradar)
  73.  
  74. function isEventHandlerAdded( sEventName, pElementAttachedTo, func )
  75. if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then
  76. local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo )
  77. if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
  78. for i, v in ipairs( aAttachedFunctions ) do
  79. if v == func then
  80. return true
  81. end
  82. end
  83. end
  84. end
  85. return false
  86. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement