Lachuks Posted May 14, 2015 Share Posted May 14, 2015 I am scripting beginer and dont know why its dont work. local screenX, screenY = guiGetScreenSize () function leaderText(marker) local xm,ym,zm = getElementPosition(marker) local x,y = getScreenFromWorldPosition(xm,ym,zm+0.2) local camX,camY,camZ = getCameraMatrix() if (x and y and getDistanceBetweenPoints3D(camX, camY, camZ, xm,ym,zm) <= 20) then dxDrawText ("Hello", x,y,x,y, tocolor (255,0, 0, 255) , ( screenX / 1440 ) * 2 , "default-bold" , "center" , "center" , false , true , false ) end end addCommandHandler ("Hello", leaderText) Link to comment
Walid Posted May 14, 2015 Share Posted May 14, 2015 Simply because marker it's not defined in your code. this how you can fix it . local screenX, screenY = guiGetScreenSize () local marker = createMarker ( x, y, z, "cylinder", 1.5, 255, 255, 0, 170 ) function leaderText() local xm,ym,zm = getElementPosition(marker) local x,y = getScreenFromWorldPosition(xm,ym,zm+0.2) local camX,camY,camZ = getCameraMatrix() if (x and y and getDistanceBetweenPoints3D(camX, camY, camZ, xm,ym,zm) <= 20) then dxDrawText ("Hello", x,y,x,y, tocolor (255,0, 0, 255) , ( screenX / 1440 ) * 2 , "default-bold" , "center" , "center" , false , true , false ) end end addEventHandler ("onClientPreRender", root,leaderText) Link to comment
Lachuks Posted May 14, 2015 Author Share Posted May 14, 2015 I put it in and dont work Link to comment
darhal Posted May 14, 2015 Share Posted May 14, 2015 At the line two u should put numbers not undefined x, y, z variables Link to comment
Walid Posted May 14, 2015 Share Posted May 14, 2015 I put it in and dont work lol you need to add the marker coordination x , y , z local marker = createMarker ( x, y, z, "cylinder", 1.5, 255, 255, 0, 170 ) Link to comment
Lachuks Posted May 14, 2015 Author Share Posted May 14, 2015 I want for marker be up player head and text under it... I make like duty script where you say aduty and you ahve godmode... its like say aduty and on head marker and text Admin OnDuty... (sorry for bad english) Link to comment
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