Jump to content

SetWeaponProperty Help


ksTakor

Recommended Posts

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

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 by Guest
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...