ksTakor Posted October 30, 2013 Share Posted October 30, 2013 (edited) Deleted Edited October 30, 2013 by Guest Link to comment
codeluaeveryday Posted October 30, 2013 Share Posted October 30, 2013 You are able to remove the crosshair texture using basic shaders and use lua to draw a sniper scope on the screen. Link to comment
ksTakor Posted October 30, 2013 Author Share Posted October 30, 2013 How can I detect when I aim with the m4? Link to comment
-.Paradox.- Posted October 30, 2013 Share Posted October 30, 2013 Try it setWeaponProperty (31, "poor", "flags", 0x000004) setWeaponProperty (31, "std", "flags", 0x000004) setWeaponProperty (31, "pro", "flags", 0x000004) Link to comment
ksTakor Posted October 30, 2013 Author Share Posted October 30, 2013 I already do this, I want detect when I aim with the m4 to hide the crosshair and dxdrawn another Link to comment
-.Paradox.- Posted October 30, 2013 Share Posted October 30, 2013 dxDrawImage Events : OnPlayerTarget Link to comment
ksTakor Posted October 30, 2013 Author Share Posted October 30, 2013 thank's, I gonna try Link to comment
ksTakor Posted October 30, 2013 Author Share Posted October 30, 2013 How can I use OnPlayerTarget only for the m4 weapon Link to comment
-.Paradox.- Posted October 30, 2013 Share Posted October 30, 2013 https://wiki.multitheftauto.com/wiki/GetPedWeaponSlot Link to comment
ksTakor Posted October 30, 2013 Author Share Posted October 30, 2013 Oh i see Thanks you helped a lot Link to comment
ksTakor Posted October 30, 2013 Author Share Posted October 30, 2013 I have write this script but it don't render the image Can someone help? local screenWidth,screenHeight = guiGetScreenSize() function drawncross ( prevSlot, newSlot ) if getPedWeapon(getLocalPlayer(),newSlot) == 31 then --if the switched weapon is the M4 local seconds = getTickCount() / 1000 local angle = math.sin(seconds) * 80 dxDrawImage ( screenWidth/2 - 637,- 100, 1280, 960, 'arrow.png')--drawn the crosshair else --if it isnt the M4 return end end end addEventHandler ( "onClientPlayerTarget", getRootElement(), drawncross ) Link to comment
-.Paradox.- Posted October 31, 2013 Share Posted October 31, 2013 (edited) EDIT: --[[ that's not my code, it's csmit195's i just edited it to work with you're script]]-- --Client Side crosshairShader = dxCreateShader ( "crosshair.fx" ) crosshair = dxCreateTexture("arrow.png") dxSetShaderValue(crosshairShader,"gTexture",crosshair) addEventHandler('onClientRender', getRootElement(), function() if getControlState('aim_weapon') and getPedTarget(localPlayer) and not active and getPedWeapon(getLocalPlayer(),newSlot) == 31 then engineApplyShaderToWorldTexture(crosshairShader,"sitem16") active = true elseif getControlState('aim_weapon') and getPedTarget(localPlayer) and active then elseif active then engineRemoveShaderFromWorldTexture(crosshairShader,"sitem16") active = false end end) Edited November 10, 2013 by Guest Link to comment
ksTakor Posted November 1, 2013 Author Share Posted November 1, 2013 How to use it, only put in the lua and execute or add to my code? Link to comment
-.Paradox.- Posted November 1, 2013 Share Posted November 1, 2013 Yes and crosshair.fx too 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