Jump to content

[HELP] Crosshair


Ekko

Recommended Posts

i want to add delay (0.3s) between press aim_weapon key and crosshair shows

 

setPlayerHudComponentVisible ( "crosshair", false ) -- removes the original crosshair

function crosshair()
    local hitX,hitY,hitZ = getPedTargetEnd ( getLocalPlayer() );
    local screenX1, screenY1 = getScreenFromWorldPosition ( hitX,hitY,hitZ );
    dxDrawImage(screenX1-(32/2), screenY1-(32/2), 32, 32, "files/crosshair.png")
end
bindKey("aim_weapon", "both", function(key, keyState)
    if keyState == "down" then 
    
            addEventHandler("onClientRender", root, crosshair)
    else
        removeEventHandler("onClientRender", root, crosshair)
    end
end)
 

Link to comment
function crosshair()
    local hitX,hitY,hitZ = getPedTargetEnd ( getLocalPlayer() );
    local screenX1, screenY1 = getScreenFromWorldPosition ( hitX,hitY,hitZ );
    dxDrawImage(screenX1-(32/2), screenY1-(32/2), 32, 32, "files/crosshair.png")
end
bindKey("aim_weapon", "both", yourFunction)


function yourFunction(key, keyState)
    if keyState == "down" then 
    
            addEventHandler("onClientRender", root, crosshair)
    else
        removeEventHandler("onClientRender", root, crosshair)
    end
end

setTimer(yourFunction, 300, 1)

idk what are you lookin' for but i think this will help you

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