Jump to content

Adding /showchat command When you click Button


Recommended Posts

Hello, I need help with adding "showchat" which disables/enables chat. I have no idea on how to do that, i tried everything .. And I also need help with adding Speed + Big Jump if anyone knows how .... :fadein:

Skype - destroyermarc354

Ingame: [Victory]#1ERuPTiON / [xXx]#1ERuPTiON / 'kkingg'

Link to comment
Post your complete script.

My complete script is a Shop I'm making.. But here is the showChat..

-- Client --

showChat = guiCreateButton(385, 100, 144, 25, "Show/Hide Chat", false, tab)

guiSetProperty(showChat, "CaptionColour", "FFFE0000")

guiSetProperty(showChat, "PushedTextColour", "FFFE0000")

guiSetProperty(showChat, "HoverTextColour", "FFFE0000")

guiSetProperty(showChat, "NormalTextColour", "FFFE0000")

guiSetFont(showChat, "default-bold-small")

addEventHandler("onClientGUIClick",root,function()

if ( source == showChat ) then

triggerServerEvent("showChat",localPlayer)

end

end)

-- Server --

addEvent("showChat",true)

addEventHandler("showChat",root,

function()

showChat(false)

end)

Link to comment

Try changing the button variable to showChatButton since it might be causing a conflict with the function showChat.

For example you can try something like this(Client Side);

function showChatOnButtonClick_Handler() 
    local chatHidden = false; 
    if(source == showChatButton and chatHidden == false) then 
        showChat(false); 
        chatHidden = true; 
    elseif(source == showChatButton and chatHidden == true) then 
        showChat(true); 
        chatHidden = false; 
    end 
end 
addEventHandler("onClientGUIClick", getRootElement(), showChatOnButtonClick_Handler) 

Link to comment
Try changing the button variable to showChatButton since it might be causing a conflict with the function showChat.

For example you can try something like this(Client Side);

function showChatOnButtonClick_Handler() 
    local chatHidden = false; 
    if(source == showChatButton and chatHidden == false) then 
        showChat(false); 
        chatHidden = true; 
    elseif(source == showChatButton and chatHidden == true) then 
        showChat(true); 
        chatHidden = false; 
    end 
end 
  
Thanks, But now when I click it, yes it hides the chat, but I wanted it when you click it again it will show again .. the c 
addEventHandler("onClientGUIClick", getRootElement(), showChatOnButtonClick_Handler) 

Thanks, But now when I click it, yes it hides the chat, but I wanted it when you click it again it will show again .. Doesn't work with that .

Link to comment

Try this instead, I messed up the logic a bit...

  
local chatHidden = false; 
  
function showChatOnButtonClick_Handler() 
    if(source == showChatButton) then 
        if(chatHidden == false) then 
            showChat(false); 
            chatHidden = true; 
        else 
            showChat(true); 
            chatHidden = false; 
        end 
    end 
end 

Link to comment
Try this instead, I messed up the logic a bit...
  
local chatHidden = false; 
  
function showChatOnButtonClick_Handler() 
    if(source == showChatButton) then 
        if(chatHidden == false) then 
            showChat(false); 
            chatHidden = true; 
        else 
            showChat(true); 
            chatHidden = false; 
        end 
    end 
end 

Still doesn't work :| and you forgot to add "addEventHandler("onClientGUIClick", getRootElement(), showChatOnButtonClick_Handler)" in the second one ..

Anyways, i don't know maybe I have to make separate tabs for showchat and hidechat ? because this doesn't work :|

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