Jump to content

CrossHair


Oussema

Recommended Posts

11 minutes ago, #BrosS said:

what is crosshair ?

Aiming icon idk 

:P

You're not funny ahahaha :P 

this other problem guys i won't make for it new topice 

if i use guiSettext in guiEdit , then i try to input somthing in the guiEdit i not work what is the problem ! (sorry for bad explain ) 

password = guiCreateEdit (xx*515, yy*338, xx*134, yy*22, "", false)
guiSetText(password, "teest")



guisettext , i try in game to input somthing in the Edit i can't i hope you understnad me guys 

 

Link to comment

Try this:

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

addEventHandler("onClientPreRender", root,
    function ()
    	if getControlState("aim_weapon") then
          if getPedTargetStart(localPlayer) then
              local sx, sy, sz = getPedTargetEnd(localPlayer)
              local cx,cy = getScreenFromWorldPosition(sx,sy,sz)
              dxDrawImage(cx-10,cy-10,10,10,"crosshair.png")
        	  dxDrawImage(cx,cy,10,10,"crosshair.png",180)
          end
      	end
end)


But i think that using full crosshair image is pretty easier then drawing 2 half-cut parts
 

Edited by Decro
Link to comment
table = {
  -- you can add more stuff here :)
    -- Crosshair
    {"yourPNGNameHERE", "siteM16"},
    {"yourPNGNameHERE", "cameraCrosshair"},
    {"yourPNGNameHERE", "siterocket"},
    {"yourPNGNameHERE", "SNIPERcrosshair"},

}


addEventHandler( "onClientResourceStart", resourceRoot,
function()
    for i = 1, #tabla do
        local shader, tec = dxCreateShader ( "texreplace.fx" )
        local tex = dxCreateTexture ( "files/"..table[i][1]..".png" )
        engineApplyShaderToWorldTexture ( shader, table[i][2] )
        engineApplyShaderToWorldTexture ( shader, table[i][2].."lod" )
        dxSetShaderValue ( shader, "gTexture", tex )
    end
end)

 

texreplace.fx

texture gTexture;

technique TexReplace
{
    pass P0
    {
        Texture[0] = gTexture;
    }
}

 

Meta

 

 

<meta>
    <script src="sourceC.lua" type="client"></script>
    <file src="texreplace.fx"></file>
    <file src="files/cameraCrosshair.png"/>
    <file src="files/siteM16.png"/>
    <file src="files/siterocket.png"/>
    <file src="files/SNIPERcrosshair.png"/>
</meta>

 

Edited by TheMOG
dsffa
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...