Jump to content

Hiding Tag and Blip


Recommended Posts

Hello guys,

I got a problem because I'm trying to create a button which will allow you to hide your tag and show it.

But it doesn't work, there's also no debug or error.

Can someone maybe help me?

PS: To check if it's even working I've added a outputchatbox, and the only thing it was saying is 'Tags Showing' but not Tag's hiding.

function onPanelHideTagButtonClicked ( btn, state) 
    if btn ~= "left" or state ~= "up" then return end 
    if setPlayerNametagShowing ( player, true) then 
        setPlayerNametagShowing ( player, false) 
        outputChatBox('Tags Hiding') 
    else 
        setPlayerNametagShowing ( player, true) 
        outputChatBox('Tags Showing') 
    end 
end 
  
panel.btn.hidetag = guiCreateButton(643, 358, 745, 386, "", false) 
guiSetAlpha(panel.btn.hidetag, 0) 
guiSetVisible(panel.btn.hidetag, false) 
addEventHandler("onClientGUIClick", panel.btn.hidetag, onPanelHideTagButtonClicked, false) 

I also got a question 2:

I want also a button to hide my blip and show it again. I've searched around but couldnt find it,

Can someone who can explain me or show me?

Thanks in advance,

Held.

Link to comment

Try this instead:

function onPanelHideTagButtonClicked ( btn, state) 
    if button == 'left' and state == 'up' then 
        setPlayerNametagShowing(localPlayer, not isPlayerNametagShowing(localPlayer)) -- set the nametag visibility to exactly the opposite of the current visibility. 
    end 
end 
  

The issue was on line 3, you used setPlayerNametagShowing in the if condition instead of isPlayerNametagShowing.

As for the blip, You will need to find the script where it is defined, and then use setElementVisibleTo(blip, root, false) to hide it completely.

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