Jump to content

closed


Gallagher

Recommended Posts

hello!

I would like to ask for help again.

How do I put a bind on this image?

When the Player tighten "o" or another button the image appears, and when he presses the image disappears again.

Thank you!

local myImage = guiCreateStaticImage ( 0.45, 0.48, 0.2, 0.5, "myimage.png", true ) 

Edited by Guest
Link to comment
bindKey ( "mouse2", "both", 
    function ( _, state ) 
        guiSetVisible ( myImage, ( state == "down" and true or false ) ) 
    end 
) 

thank you it works!

I now have another problem, the image disrupts the crosshairs of some weapons such as Sniper Rifle, Rocket Launcher and others. would add a prohibition so that the image is not displayed when you are with a Rocket Launcher?

prohibit the id of the weapon?

thanks again

Link to comment
No, you don't need to destroy the image.
bindKey("mouse2", "both", 
function(_, state) 
    if (getPedWeapon(localPlayer) ~= 34) then 
        guiSetVisible(myImage, (state == "down" and true or false)) 
    end 
end) 

works, but as I put other weapons too?

if (getPedWeapon (localPlayer) = 34 or 43 or 35) then 

did not work.

Link to comment

Use table easier.

disAllowed = {[34] = true, [43] = true, [35] = true} 
  
bindKey("mouse2", "both", 
function(_, state) 
    if not (disAllowed[getPedWeapon(localPlayer)]) then 
        guiSetVisible(myImage, (state == "down" and true or false)) 
    end 
end) 

Link to comment
Use table easier.
disAllowed = {[34] = true, [43] = true, [35] = true} 
  
bindKey("mouse2", "both", 
function(_, state) 
    if not (disAllowed[getPedWeapon(localPlayer)]) then 
        guiSetVisible(myImage, (state == "down" and true or false)) 
    end 
end) 

did not work, the image does not disappear

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