Guest User

Untitled

a guest
Sep 22nd, 2021
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. local textures = {}
  2. xd = dxCreateTexture('test.png','argb',true,'clamp')
  3. local sx, sy = guiGetScreenSize()
  4. local zoom = sx / 1920 and 1 or math.min(2, 1920 / sx)
  5. font = dxCreateFont('f.ttf',8/zoom)
  6. function xd()
  7. for k, v in ipairs(getElementsByType("vehicle", root, true)) do
  8. if getElementData(v,'vehicle:salon') == true then
  9. data = getElementData(v,'vehicle:sell:info')
  10. local x, y, z = getElementPosition(localPlayer)
  11. local vx, vy, vz = getElementPosition(v)
  12. local dist = getDistanceBetweenPoints3D(x, y, z, vx, vy, vz)
  13. if dist < 5 then
  14. render(v) -- Podajesz dane auto do renderu
  15. else
  16. removeEventHandler('onClientRender',root,xd)
  17. end
  18.  
  19. end
  20. end
  21. end
  22.  
  23. addEventHandler('onClientRender',root,xd)
  24. local rt = dxCreateRenderTarget(253 / zoom, 123 / zoom, true)
  25. local tex = dxCreateTexture(253 / zoom, 123 / zoom)
  26.  
  27. function render(Veh)
  28. local vx, vy, vz = getElementPosition(Veh)
  29. if rt then
  30. dxSetRenderTarget(rt, true)
  31. dxDrawImage(0, 0, 253 / zoom, 123 / zoom, xd, 0, 0, 0, tocolor(255, 255, 255, 255))
  32. dxDrawText("Model: "..getVehicleName(Veh), 15 / zoom, 10 / zoom, 253 / zoom, 123 / zoom, white, 1, font, "left", "top", false, false, false, true)
  33. dxDrawText("Przebieg: "..data['mileage1']..'km', 15 / zoom, 35 / zoom, 253 / zoom, 123 / zoom, white, 1, font, "left", "top", false, false, false, true)
  34. dxDrawText("Silnik: "..data['engine']..'dm3', 15 / zoom, 60 / zoom, 253 / zoom, 123 / zoom, white, 1, font, "left", "top", false, false, false, true)
  35. dxDrawText("Napęd: "..data['naped'], 15 / zoom, 85 / zoom, 253 / zoom, 123 / zoom, white, 1, font, "left", "top", false, false, false, true)
  36. dxDrawText("Cena: "..data['cost']..'PLN\n\nAby kupić pojazd,\npodejdź bliżej\ni kliknij K', 135 / zoom, 10 / zoom, 253 / zoom, 123 / zoom, white, 1, font, "left", "top", false, false, false, true)
  37. dxSetRenderTarget()
  38. dxSetBlendMode('modulate_add')
  39. dxDrawMaterialLine3D(vx, vy, vz + 2, vx, vy, vz + 1,rt, 3)
  40.  
  41. end
  42. end
  43.  
  44.  
  45.  
  46.  
Advertisement
Add Comment
Please, Sign In to add comment