Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.06 KB | None | 0 0
  1.  
  2. local cols = {
  3. [1] = {
  4. {2046.4508056641,1552.8034667969,10.671875,8}, -- 90km/h
  5. },
  6. [2] = {
  7. {2046.8505859375,1591.9591064453,10.671875,4} -- 120km/h
  8. },
  9. [3] = {
  10. {2047.2889404297,1619.2237548828,10.671875,2} -- 30km/h
  11. }
  12. }
  13.  
  14. local model = {
  15. [1] = {2057.4448242188,1523.0300292969,10.940486907959}
  16. }
  17. addEventHandler("onResourceStart", resourceRoot,
  18. function ()
  19. for id, datas in pairs(cols) do
  20. for _, values in pairs(datas) do
  21. local x, y, z, r = unpack(values)
  22. local col = createColSphere(x, y, z-1, r)
  23. setElementData(col, "col.id", id)
  24. end
  25. end
  26. for k, v in pairs(model) do
  27. local x, y, z = unpack(v)
  28. local model = createObject(1214, x, y, z-1)
  29. setElementFrozen(model, true)
  30. end
  31. end
  32. )
  33.  
  34. addEvent("policeWrite", true)
  35. addEventHandler("policeWrite", root,
  36. function()
  37. local car = getPedOccupiedVehicle(client)
  38. local name = getVehicleName(car)
  39. local c1, c2, c3, c4 = getVehicleColor(car, false)
  40. local teszt = RGBToHex(c1, c2, c3, c4)
  41. outputChatBox(teszt)
  42. outputChatBox("#DE8226[Rendőrség]:#FFFFFFKocsi:#ABA7A2"..name.. "#FFFFFF|".."#FFFFFFSzíne: Szín1", getRootElement(), _, _, _, true)
  43. end
  44. )
  45.  
  46. addEvent("removePay", true)
  47. addEventHandler("removePay", root,
  48. function ()
  49. setPlayerMoney(source, getPlayerMoney(client) - 650)
  50. end
  51. )
  52.  
  53. function RGBToHex(red, green, blue, alpha)
  54.  
  55. -- Make sure RGB values passed to this function are correct
  56. if( ( red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255 ) or ( alpha and ( alpha < 0 or alpha > 255 ) ) ) then
  57. return nil
  58. end
  59.  
  60. -- Alpha check
  61. if alpha then
  62. return string.format("#%.2X%.2X%.2X%.2X", red, green, blue, alpha)
  63. else
  64. return string.format("#%.2X%.2X%.2X", red, green, blue)
  65. end
  66.  
  67. end
  68.  
  69. Itt a kliens:
  70.  
  71. --készítette:nszabol3--
  72. defendVeh = {
  73. [1] = {
  74. {510}, -- Mountan Bike
  75. {481}, -- BMX
  76. {508}, -- Bike
  77. {596}, -- Polcie
  78. {598}, -- Police
  79. {599}, -- Police
  80. {597}, -- Police
  81. }
  82. }
  83.  
  84.  
  85. for k, v in pairs(defendVeh) do
  86. teszt = unpack(v)
  87. end
  88.  
  89.  
  90. addEventHandler("onClientColShapeHit", root,
  91. function(element, dimension)
  92. if element == localPlayer then
  93. if dimension then
  94. local veh = getPedOccupiedVehicle(element)
  95. if veh then
  96. local car1 = getElementModel(veh)
  97. triggerServerEvent("policeWrite", root)
  98. if car1 ~= teszt then
  99. triggerServerEvent("removePay", root)
  100. if (getElementData(source, "col.id") == 1) then
  101. if getElementSpeed(veh) > 2 then
  102. outputChatBox("#DE8226[Rendőrség]: #FFFFFFGyorsabban mentél mint #ABA7A290km/h. #FFFFFFBüntetésed:#ABA7A2650$", _, _, _, true)
  103. end
  104. else
  105. if (getElementData(source, "col.id") == 2) then
  106. if getElementSpeed(veh) > 2 then
  107. outputChatBox("#DE8226[Rendőrség]: #FFFFFFGyorsabban mentél mint #ABA7A2120km/h. #FFFFFFBüntetésed:#ABA7A2650$", _, _, _, true)
  108. end
  109. else
  110. if (getElementData(source, "col.id") == 3) then
  111. if getElementSpeed(veh) > 2 then
  112. outputChatBox("#DE8226[Rendőrség]: #FFFFFFGyorsabban mentél mint #ABA7A230km/h. #FFFFFFBüntetésed:#ABA7A2650$", _, _, _, true)
  113. end
  114. end
  115. end
  116. end
  117. end
  118. end
  119. end
  120. end
  121. end
  122. )
  123.  
  124.  
  125.  
  126. ----- usefule function -----------
  127. function getElementSpeed(theElement, unit)
  128. -- Check arguments for errors
  129. assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")")
  130. local elementType = getElementType(theElement)
  131. assert(elementType == "player" or elementType == "ped" or elementType == "object" or elementType == "vehicle" or elementType == "projectile", "Invalid element type @ getElementSpeed (player/ped/object/vehicle/projectile expected, got " .. elementType .. ")")
  132. assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)")
  133. -- Default to m/s if no unit specified and 'ignore' argument type if the string contains a number
  134. unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit))
  135. -- Setup our multiplier to convert the velocity to the specified unit
  136. local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456)
  137. -- Return the speed by calculating the length of the velocity vector, after converting the velocity to the specified unit
  138. return (Vector3(getElementVelocity(theElement)) * mult).length
  139. end
  140.  
  141.  
  142. local sx, sy = guiGetScreenSize()
  143. local relX, relY = sx/1920, sy/1080
  144. addEventHandler("onClientRender", root,
  145. function ()
  146. local veh = getPedOccupiedVehicle(localPlayer)
  147. if veh then
  148. local vehS = getElementSpeed(veh)
  149. dxDrawText(vehS, sx*(0.85), sy*(0.098), sx*0.99, sy*0.19, tocolor(255, 255, 255, 255), relX*2.1, relY*2.2, "sans", "left", "center", false, false, false )
  150. end
  151. end
  152. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement