William147 Posted March 28, 2016 Posted March 28, 2016 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)
Simple0x47 Posted March 28, 2016 Posted March 28, 2016 Can you make to us easier and tell us what's the problem with the script?
William147 Posted March 28, 2016 Author Posted March 28, 2016 I would like to write to script: only then write adminduty above player if the player has aduty elementdata
Dimos7 Posted March 28, 2016 Posted March 28, 2016 then add that aduty = getElementData(v, "adminduty")
Walid Posted March 28, 2016 Posted March 28, 2016 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)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now