Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. function Draw3DText(x,y,z, text)
  2. local onScreen,_x,_y = World3dToScreen2d(x,y,z)
  3. local px,py,pz = table.unpack(GetGameplayCamCoord())
  4. local dist = GetDistanceBetweenCoords(px,py,pz, x,y,z, 1)
  5.  
  6. local scale = 0.5
  7.  
  8. if onScreen then
  9.  
  10. -- Formalize the text
  11. SetTextColour(255, 255, 255, 255)
  12. SetTextScale(scale, scale)
  13. SetTextFont(0)
  14. SetTextProportional(1)
  15. SetTextCentre(true)
  16. SetTextDropshadow(10, 100, 100, 100, 255)
  17.  
  18. -- Calculate width and height
  19. BeginTextCommandWidth("STRING")
  20. AddTextComponentString(text)
  21. local height = GetTextScaleHeight(scale, 0)
  22. local width = EndTextCommandGetWidth(0)
  23.  
  24. -- Diplay the text
  25. SetTextEntry("STRING")
  26. AddTextComponentString(text)
  27. EndTextCommandDisplayText(_x, _y)
  28.  
  29. DrawRect(_x, _y+0.019, width+0.005, height+0.005, 102, 56, 56 ,125)
  30. end
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement