ksTakor Posted October 30, 2013 Posted October 30, 2013 (edited) Deleted Edited October 30, 2013 by Guest
codeluaeveryday Posted October 30, 2013 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.
ksTakor Posted October 30, 2013 Author Posted October 30, 2013 How can I detect when I aim with the m4?
-.Paradox.- Posted October 30, 2013 Posted October 30, 2013 Try it setWeaponProperty (31, "poor", "flags", 0x000004) setWeaponProperty (31, "std", "flags", 0x000004) setWeaponProperty (31, "pro", "flags", 0x000004)
ksTakor Posted October 30, 2013 Author Posted October 30, 2013 I already do this, I want detect when I aim with the m4 to hide the crosshair and dxdrawn another
ksTakor Posted October 30, 2013 Author Posted October 30, 2013 How can I use OnPlayerTarget only for the m4 weapon
-.Paradox.- Posted October 30, 2013 Posted October 30, 2013 https://wiki.multitheftauto.com/wiki/GetPedWeaponSlot
ksTakor Posted October 30, 2013 Author 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 )
-.Paradox.- Posted October 31, 2013 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
ksTakor Posted November 1, 2013 Author Posted November 1, 2013 How to use it, only put in the lua and execute or add to my code?
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