Ekko Posted September 27, 2018 Share Posted September 27, 2018 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
LyricalMM Posted September 27, 2018 Share Posted September 27, 2018 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
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