Jump to content

Adminduty nametag


William147

Recommended Posts

Posted

Hello!

I would like to make a script which write above ped: AdminDuty when it has "aduty" elementdata.

  
local x, y = guiGetScreenSize() 
  
function PlayerNameTags() 
    local players = getElementsByType("player") 
        for k,v in ipairs(players) do 
            if v == getLocalPlayer() then else 
                local r = getElementData(v,"red") 
                local g = getElementData(v,"green") 
                local b = getElementData(v,"blue") 
                local x1,y1,z1 = getElementPosition (getLocalPlayer()) 
                local x2,y2,z2 = getElementPosition (v) 
                local visibleto = getDistanceBetweenPoints3D(x1,y1,z1,x2,y2,z2) 
                    if visibleto > 350 then else 
                        local sx,sy = getScreenFromWorldPosition ( x2,y2,z2+1.05 ) 
                            if not sx and not sy then else 
dxDrawText ("Adminduty:" string.gsub ( getPlayerName ( v ), "#%x%x%x%x%x%x", "" ).."", sx,sy,sx,sy, tocolor(r,g,b,255), 8-visibleto/50, "default-bold", "center","top",false,false,false ) 
                end 
            end 
        end 
    end 
end 
addEventHandler("onClientRender",getRootElement(),PlayerNameTags) 
  

Posted

do you want sth like this

local x, y = guiGetScreenSize() 
  
function PlayerNameTags() 
    local players = getElementsByType("player") 
        for k,v in ipairs(players) do 
            if v == getLocalPlayer() then else 
                local r = getElementData(v,"red") 
                local g = getElementData(v,"green") 
                local b = getElementData(v,"blue") 
                local aduty = getElementData(v, "adminduty") 
                local x1,y1,z1 = getElementPosition (getLocalPlayer()) 
                local x2,y2,z2 = getElementPosition (v) 
                local visibleto = getDistanceBetweenPoints3D(x1,y1,z1,x2,y2,z2) 
                    if visibleto > 350 then else 
                        local sx,sy = getScreenFromWorldPosition ( x2,y2,z2+1.05 ) 
                            if not sx and not sy then else 
                    dxDrawText (aduty, sx,sy,sx,sy, tocolor(r,g,b,255), 8-visibleto/50, "default-bold", "center","top",false,false,false ) 
                end 
            end 
        end 
    end 
end 
addEventHandler("onClientRender",getRootElement(),PlayerNameTags) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

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...