Advertisement
Smokahontas

MTA Draw all Vehicles Names.

Aug 21st, 2022 (edited)
820
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.74 KB | None | 0 0
  1. -- Created by Smokahontas.
  2. function dxDrawTextOnVehicles()
  3.     for i,vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do
  4.         local x,y,z = getElementPosition ( vehicle )
  5.         local _,_,rz = getElementRotation ( vehicle )
  6.         local px,py,pz,protx,proty,protz = getCameraMatrix()
  7.         local distance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz )
  8.         if ( distance < 1000 ) then
  9.                         local sx,sy = getScreenFromWorldPosition ( x,y,z+1 )
  10.                 local vehname = getVehicleName ( vehicle )
  11.                 local r,g,b = getVehicleColor ( vehicle,true )
  12.                 if ( sx and sy ) then
  13.                     dxDrawText ( vehname,sx,sy,sx,sy,tocolor ( 247,255,0 ),0.5,"default-bold","center","center" )
  14.                
  15.             end
  16.         end
  17.     end
  18. end
  19. addEventHandler ("onClientRender",root,dxDrawTextOnVehicles)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement