Trust aka Tiffergan Posted June 9, 2020 Posted June 9, 2020 (edited) Hello i want to do script that when player aim, you will see player nick and distance between you and player that you aiming at ( sorry for english ) i did something like this if playerTarget then local x,y,z = getElementPosition(playerTarget) local x,y,distance = getScreenFromWorldPosition (x,y,z+0.5) distance = 30 if getElementData(playerTarget,"bandit") then text = string.gsub(getPlayerName(playerTarget), '#%x%x%x%x%x%x', '' ) else text = string.gsub(getPlayerName(playerTarget), '#%x%x%x%x%x%x', '' ) end local w = dxGetTextWidth(text,distance*0.033,"default-bold") if w and x and y and text and distance then dxDrawText ( text.."("..(getDistanceBetweenPoints3D( x,y,z, getElementPosition ( localPlayer )))..")",x-(w/5),y,x-(w/5),y,tocolor(100, 255, 100, 200),distance*0.033,"bankgothic") end end end); that line is the showing name and distance dxDrawText text.."("..(getDistanceBetweenPoints3D( x,y,z, getElementPosition ( localPlayer )))..")",x-(w/5),y,x-(w/5),y,tocolor(100, 255, 100, 200),distance*0.033,"bankgothic") but i dont know why i have so damn large output Edited June 9, 2020 by LOOah R
sacr1ficez Posted June 9, 2020 Posted June 9, 2020 3 hours ago, LOOah said: Hello i want to do script that when player aim, you will see player nick and distance between you and player that you aiming at ( sorry for english ) i did something like this if playerTarget then local x,y,z = getElementPosition(playerTarget) local x,y,distance = getScreenFromWorldPosition (x,y,z+0.5) distance = 30 if getElementData(playerTarget,"bandit") then text = string.gsub(getPlayerName(playerTarget), '#%x%x%x%x%x%x', '' ) else text = string.gsub(getPlayerName(playerTarget), '#%x%x%x%x%x%x', '' ) end local w = dxGetTextWidth(text,distance*0.033,"default-bold") if w and x and y and text and distance then dxDrawText ( text.."("..(getDistanceBetweenPoints3D( x,y,z, getElementPosition ( localPlayer )))..")",x-(w/5),y,x-(w/5),y,tocolor(100, 255, 100, 200),distance*0.033,"bankgothic") end end end); that line is the showing name and distance dxDrawText text.."("..(getDistanceBetweenPoints3D( x,y,z, getElementPosition ( localPlayer )))..")",x-(w/5),y,x-(w/5),y,tocolor(100, 255, 100, 200),distance*0.033,"bankgothic") but i dont know why i have so damn large output Perhaps it's your issue: distance*0.033 It's a text scale. Script security
Trust aka Tiffergan Posted June 9, 2020 Author Posted June 9, 2020 40 minutes ago, majqq said: Perhaps it's your issue: distance*0.033 It's a text scale. but text scale is not a problem, the problem is that I'm 15 meters away from my opponent and he shows me 2031 R
Sisqo0 Posted June 9, 2020 Posted June 9, 2020 That's because there are two variables called (x, y) 8 hours ago, LOOah said: local x,y,z = getElementPosition(playerTarget) local x,y,distance = getScreenFromWorldPosition (x,y,z+0.5) and the 2nd variables only will be called here 8 hours ago, LOOah said: dxDrawText ( text.."("..(getDistanceBetweenPoints3D( x,y,z, getElementPosition ( localPlayer )))..")",x-(w/5),y,x-(w/5),y,tocolor(100, 255, 100, 200),distance*0.033,"bankgothic") Try this if playerTarget then local xp,yp,zp = getElementPosition(playerTarget) local x,y,distance = getScreenFromWorldPosition (xp,yp,zp+0.5) distance = 30 if getElementData(playerTarget,"bandit") then text = string.gsub(getPlayerName(playerTarget), '#%x%x%x%x%x%x', '' ) else text = string.gsub(getPlayerName(playerTarget), '#%x%x%x%x%x%x', '' ) end local w = dxGetTextWidth(text,distance*0.033,"default-bold") if w and x and y and text and distance then dxDrawText ( text.."("..(getDistanceBetweenPoints3D( xp,yp,zp, getElementPosition ( localPlayer )))..")",x-(w/5),y,x-(w/5),y,tocolor(100, 255, 100, 200),distance*0.033,"bankgothic") end end end); 1
Trust aka Tiffergan Posted June 9, 2020 Author Posted June 9, 2020 1 hour ago, Sisqo0 said: That's because there are two variables called (x, y) and the 2nd variables only will be called here Try this if playerTarget then local xp,yp,zp = getElementPosition(playerTarget) local x,y,distance = getScreenFromWorldPosition (xp,yp,zp+0.5) distance = 30 if getElementData(playerTarget,"bandit") then text = string.gsub(getPlayerName(playerTarget), '#%x%x%x%x%x%x', '' ) else text = string.gsub(getPlayerName(playerTarget), '#%x%x%x%x%x%x', '' ) end local w = dxGetTextWidth(text,distance*0.033,"default-bold") if w and x and y and text and distance then dxDrawText ( text.."("..(getDistanceBetweenPoints3D( xp,yp,zp, getElementPosition ( localPlayer )))..")",x-(w/5),y,x-(w/5),y,tocolor(100, 255, 100, 200),distance*0.033,"bankgothic") end end end); thanks mate 1 R
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