Jump to content

NameTags


Recommended Posts

addEventHandler("onPlayerLogin", root, 
function ( thePlayer ) 
    local accName = getAccountName ( getPlayerAccount ( source ) ) 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        setElementData(source, "Classicon", tostring(":experience\class\classicon_admin.png" ))                                       
    end 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Moderator" ) ) then 
        setElementData(source, "Classicon", tostring(":experience\class\classicon_mod.png" ))                                       
    end 
    if isGuestAccount ( account ) then 
        setElementData(source, "Classicon",":experience\class\classicon_player.png") 
    end 
end 

this script is not in server side ?

Link to comment

local distmax = 30

local width = 50

local hight = 50

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 = getDistanceBetweenPoints3D ( tx, ty, tz, px, py, pz ) 
         if dist < distmax 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 ) 
               local w = width 
               local h = hight 
               local class = getElementData(v, "reputation.class") 
               if x and y and w and h then  
                  dxDrawImage ( x, y, h, w, ":reputation/class/classicon_"..class..".png", 0, 0, 0, tocolor(255, 255, 255), false ) 
               end 
            end 
         end 
      end 
   end 
) 
  
  
  

Edited by Guest
Link to comment

Try this i didn't test it

Client:

addEventHandler( 'onClientRender', root, 
    function ( ) 
        for i,v in ipairs( getElementsByType( "player" ) ) do 
            local x, y, z = getElementPosition( v ); 
            local cx, cy, cz = getCameraMatrix( ); 
            if getDistanceBetweenPoints3D( cx, cy, cz, x, y, z ) <= 15 then 
                local px,py = getScreenFromWorldPosition( x, y, z + 1.3, 0.06 ); 
                if px and py then 
                    dxDrawImage( px, py, px, py, getElementData( v, "Classicon" ), 0, 0, 0, tocolor( 255, 255, 255, 255 ) ); 
                end 
            end 
        end 
    end 
); 

Server:

addEventHandler( 'onPlayerLogin', root, 
    function ( ) 
        local account = getPlayerAccount( source ) 
        if account and not isGuestAccount( account ) then 
            local accountName = getAccountName( account ); 
            if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
                setElementData( source, "Classicon", tostring( ":experience/class/classicon_admin.png" ) ); 
            elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderator" ) ) then 
                setElementData( source, "Classicon", tostring( ":experience/class/classicon_mod.png" ) ); 
            else 
                setElementData( source, "Classicon", tostring( ":experience/class/classicon_player.png" ) ); 
            end 
       end 
    end 
); 

Link to comment
function renderIng( ) 
    for key, player in ipairs ( getElementsByType( "player" ) ) do 
        if getElementDimension( player ) == dimension then 
            local px, py, pz = getElementPosition( player ) 
            local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z ) 
            if distance <= 20 then 
                local text = getElementData( player, "Classicon" )     
                if text and ( distance < 2 or isLineOfSightClear( x, y, z, px, py, pz + 1.1, true, true, true, true, false, false, true, localPlayer ) ) then 
                    local sx, sy = getScreenFromWorldPosition( px, py, pz + 1.1 ) 
                    if sx and sy then 
                        dxDrawImage( px, py, px, py, text, 0, 0, 0, tocolor( 255, 255, 255, 255 ) ); 
                    end 
                end 
            end 
        end 
    end  
end 
addEventHandler( "onClientRender", getRootElement( ),renderIng)    

addEventHandler( 'onPlayerLogin', root, 
    function ( ) 
        local account = getPlayerAccount( source ) 
        if account and not isGuestAccount( account ) then 
            local accountName = getAccountName( account ); 
            if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
                setElementData( source, "Classicon", tostring( ":experience/class/classicon_admin.png" ) ); 
            elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderator" ) ) then 
                setElementData( source, "Classicon", tostring( ":experience/class/classicon_mod.png" ) ); 
            else 
                setElementData( source, "Classicon", tostring( ":experience/class/classicon_player.png" ) ); 
            end 
       end 
    end 
); 

Edited by Guest
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...