Jump to content

help target pliz


Recommended Posts

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

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

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