manve1 Posted January 2, 2013 Share Posted January 2, 2013 How can i apply my own crosshair so when i aim a gun i see my crosshair? Link to comment
Cadu12 Posted January 2, 2013 Share Posted January 2, 2013 Please do not double-post some hours. You must wait anyone to post. Link to comment
manve1 Posted January 2, 2013 Author Share Posted January 2, 2013 Please do not double-post some hours. You must wait anyone to post. I know that, but people don't offten look at the middle or bottom posts, so i just moved it up. Link to comment
manve1 Posted January 2, 2013 Author Share Posted January 2, 2013 would you mind giving me an example? Link to comment
Baseplate Posted January 2, 2013 Share Posted January 2, 2013 Check my topic about crosshair Link to comment
manve1 Posted January 2, 2013 Author Share Posted January 2, 2013 I got a problem as it didn't apply the crosshair to any weapon LUA: addEventHandler( "onClientResourceStart", resourceRoot, function() local texture = dxCreateTexture ("hud/aimer.png") local shader = dxCreateShader ( "hud/shader.fx" ) dxSetShaderValue ( shader, "gTexture", texture ) engineApplyShaderToWorldTexture ( shader, "sitem16") end ) SHADER: texture gTexture; technique TexReplace { pass P0 { Texture[0] = gTexture; } } And i need one for weapons like deagle, m4 and a sniper, but for sniper a different crosshair Link to comment
manawydan Posted January 2, 2013 Share Posted January 2, 2013 has a resource in the community. https://community.multitheftauto.com/ind ... ls&id=6210 Link to comment
manve1 Posted January 2, 2013 Author Share Posted January 2, 2013 but how do i use that resource as there is no example, not even a picture Link to comment
Blaawee Posted January 2, 2013 Share Posted January 2, 2013 this resource has an exports function's https://community.multitheftauto.com/ind ... ls&id=6210 exports.crosshairreplace:register(weaponid, newcrosshairpath)Sets the new crosshair for 'weaponid'. 'newcrosshairpath' should be a path to an image file exports.crosshairreplace:unregister(weaponid) Restores the default crosshair for 'weaponid' try something like this : client: addEventHandler( "onClientResourceStart", resourceRoot, function ( startedRes ) exports.crosshairreplace:register( 34, "sniperCH.png" ) end ) Link to comment
manve1 Posted January 2, 2013 Author Share Posted January 2, 2013 Last thing: How can i make it for a sniper rifle not other weapons? Link to comment
Blaawee Posted January 2, 2013 Share Posted January 2, 2013 exports.crosshairreplace:register( weaponid, newcrosshairpath )Sets the new crosshair for 'weaponid'. 'newcrosshairpath' should be a path to an image file exports.crosshairreplace:register( 34, crossHairPath ) https://wiki.multitheftauto.com/wiki/Weapon Link to comment
manve1 Posted January 2, 2013 Author Share Posted January 2, 2013 It still looks original although the pic is a lot different Link to comment
Blaawee Posted January 2, 2013 Share Posted January 2, 2013 i think you should edit the script to : * EDIT Crosshair = { crosshairs = {}; shader = {}; default = dxCreateTexture("siteM16.png"); register = function(weaponid, crosshairpath) if not crosshairpath:find(":") then crosshairpath = (":%s/%s"):format(getResourceName(sourceResource), crosshairpath) end assert(fileExists(crosshairpath), "Invalid File for Crosshair.register") if Crosshair.crosshairs[weaponid] then destroyElement(Crosshair.crosshairs[weaponid]) end Crosshair.crosshairs[weaponid] = dxCreateTexture(crosshairpath) end, unregister = function(weaponid) if Crosshair.crosshairs[weaponid] then destroyElement(Crosshair.crosshairs[weaponid]) end Crosshair.crosshairs[weaponid] = nil end, init = function() Crosshair.shader = dxCreateShader("texreplace.fx") assert(Crosshair.shader, "Could not create Crosshair Replacement Shader") engineApplyShaderToWorldTexture(Crosshair.shader, "siteM16") dxSetShaderValue(Crosshair.shader, "gTexture", Crosshair.default) addEventHandler("onClientPlayerWeaponSwitch", localPlayer, Crosshair.weaponSwitch) end, weaponSwitch = function( prev, now ) weapon = getPedWeapon( localPlayer, now ) if weapon == 34 then dxSetShaderValue( Crosshair.shader, "gTexture", Crosshair.crosshairs[weapon] ) else dxSetShaderValue( Crosshair.shader, "gTexture", Crosshair.default ) end end } Crosshair.init() -- Exports register = Crosshair.register unregister = Crosshair.unregister Link to comment
manve1 Posted January 2, 2013 Author Share Posted January 2, 2013 returned false at argument 3 line 32 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