Jump to content

Help Script dxDrawText


UsErFaiLed

Recommended Posts

Hello everybody then is the following I want when typing /adm appears over the head of my character writing Administrator Can someone help me I think it is something.

function admin() 
      local px, py, pz, tx, ty, tz, dist 
      px, py, pz = getCameraMatrix( ) 
         tx, ty, tz = getElementPosition( lp ) 
         dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 ) 
         if dist < 30.0 then 
            if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then 
               local sx, sy, sz = getPedBonePosition( lp, 5 ) 
               local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.3 ) 
               if x then  
                dxDrawText("Administrador", x, y, x, y, tocolor(150, 50, 0), 0.85 + ( 15 - dist ) * 0.02, "bankgothic" ) 
                addEventHandler( "onClientRender" , root , bacon ) 
               end 
            end 
         end 
end 
addCommandHandler("adm" ,admin ) 
  

Link to comment
This doesn't make any sense.

Help me please i want that when digit /adm appears written on the character Administrator I know uses dxDrawText help me Thanks

I don't understand, please fix your English (Not trying to be rude...)

Next I want when typing / adm appears above the character written Staff and everyone to see on my character written Staff

Like a Nametags:

Sorry Google Translator

lp = getLocalPlayer() 
  
  
function admindx( ) 
      local px, py, pz, tx, ty, tz, dist 
      px, py, pz = getCameraMatrix( ) 
      for _, v in ipairs( getElementsByType 'player' ) do 
         tx, ty, tz = getElementPosition( lp ) 
         dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 ) 
         if dist < 30.0 then 
            if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then 
               local sx, sy, sz = getPedBonePosition( lp, 5 ) 
               local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.3 ) 
               if x then -- getScreenFromWorldPosition returns false if the point isn't on screen 
                dxDrawText( "Staff", x, y, x, y, tocolor(150, 50, 0), 0.85 + ( 15 - dist ) * 0.02, "bankgothic" ) 
               end 
            end 
         end 
      end 
   end 
  
function teste () 
    addEventHandler("onClientRender",root, admindx  ) 
end 
addCommandHandler("adm" , teste ) 
  
  

Link to comment
addEventHandler( "onClientRender",root, 
   function( ) 
      local px, py, pz, tx, ty, tz, dist 
      px, py, pz = getCameraMatrix( ) 
      for _, v in ipairs( getElementsByType 'player' ) do 
         tx, ty, tz = getElementPosition( v ) 
         dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 ) 
         if ( dist < 30.0 ) and ( getElementData ( source, "tagadmin" ) == true ) then 
            if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false ) then 
               local sx, sy, sz = getPedBonePosition( v, 5 ) 
               local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.3 ) 
               if x then -- getScreenFromWorldPosition returns false if the point isn't on screen 
                dxDrawText( getPlayerName( v ), x, y, x, y, tocolor(150, 50, 0), 0.85 + ( 15 - dist ) * 0.02, "bankgothic" ) 
               end 
            end 
         end 
      end 
   end 
) 
  
function teste (source) 
    local tagadmin = getElementData ( source, "tagadmin" ) 
    setElementData ( source, "tagadmin" , not tagadmin ) 
end 
addCommandHandler("adm" , teste ) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...