Jacobob14 Posted June 10, 2014 Share Posted June 10, 2014 I'm doing a custom crosshair and my problem is that I want when point to a ped the color of crosshair change orgive my bad English if (getElementType(getPedTarget(localPlayer))== "vehicle" ) then local color= "255,0,0" else color = "0,0,0" end local hX,hY,hZ = getPedTargetEnd ( getLocalPlayer() ) local screenX1, screenY1 = getScreenFromWorldPosition ( hX,hY,hZ ) dxDrawLine(screenX1-(size/6), screenY1-(size/6), screenX1, screenY1, tocolor(color,255)) Link to comment
Saml1er Posted June 10, 2014 Share Posted June 10, 2014 if (getElementType(getPedTarget(localPlayer))== "vehicle" ) then local color= {255,0,0} else color = {0,0,0} end local hX,hY,hZ = getPedTargetEnd ( localPlayer ) local screenX1, screenY1 = getScreenFromWorldPosition ( hX,hY,hZ ) addEventHandler ("onClientRender",root,function() dxDrawLine(screenX1-(size/6), screenY1-(size/6), screenX1, screenY1, tocolor(unpack(color),255)) -- If your calculations are correct then it should work end ) Link to comment
Jacobob14 Posted June 12, 2014 Author Share Posted June 12, 2014 if (getElementType(getPedTarget(localPlayer))== "vehicle" ) then local color= {255,0,0} else color = {0,0,0} end local hX,hY,hZ = getPedTargetEnd ( localPlayer ) local screenX1, screenY1 = getScreenFromWorldPosition ( hX,hY,hZ ) addEventHandler ("onClientRender",root,function() dxDrawLine(screenX1-(size/6), screenY1-(size/6), screenX1, screenY1, tocolor(unpack(color),255)) -- If your calculations are correct then it should work end ) does not work does not change color: ( Link to comment
Max+ Posted June 12, 2014 Share Posted June 12, 2014 Try This , if (getElementType(getPedTarget(localPlayer))== "vehicle" ) then local color = "255,0,0" else local color = "0,0,0" end if(getPedTargetStart(localPlayer )) then local hX,hY,hZ = getPedTargetEnd ( getLocalPlayer() ) local screenX1, screenY1 = getScreenFromWorldPosition ( hX,hY,hZ ) dxDrawLine(screenX1- 6, screenY1- 6, screenX1, screenY1, tocolor(color, 255)) end 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