ASiT Posted November 3, 2008 Share Posted November 3, 2008 I found this code on the development wiki when looking for a way to disable the chatbox ...this should do it ...but when i started it it said there was an error at line 11...btw i was making it into a script if that helps... local isChatVisible = true -- let's assume the chat is visible function chat ( key, keyState ) if ( isChatVisible ) then -- if it's on showChat (false) -- turn it off isChatVisible = false else showChat = (true) -- if it's off isChatVisible = true -- turn it on end end bindKey ( "i", "down","toggle chat", chat ) -- the player's "i" key will toggle the chat addEventHandler("onPlayerJoin", getRootElement(), chat) Link to comment
robhol Posted November 3, 2008 Share Posted November 3, 2008 Oh, an error. Thanks for providing so much info, now we all know what's wrong at once. Link to comment
Simbad de Zeeman Posted November 3, 2008 Share Posted November 3, 2008 Well i dont think we need this info. Have a look @ line 11. bindKey ( "i", "down","toggle chat", chat ) -- the player's "i" key will toggle the chat Shouldn't it be: bindKey ( "i", "down", chat ) -- the player's "i" key will toggle the chat Hmm? try! Link to comment
Gamesnert Posted November 3, 2008 Share Posted November 3, 2008 Lol, looks kind of weird... >.< Anyway, it looks like client-side and server-side mixed anyway... I mean: showChat and the build of the bindKey look client-side, while it has a server-side event handler... Try instead of: addEventHandler("onPlayerJoin", getRootElement(), chat) This... addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), chat) --Makes sure it only triggers at the start of only this resource And ofcourse the thing Simbad said, I don't understand what the "toggle chat" is doing there anyway... >.< Link to comment
50p Posted November 3, 2008 Share Posted November 3, 2008 This is I think the simplest way to show/hide chat with "i" key, here: local isChatVisible = true bindKey( "i", "down", function( ) isChatVisible = not isChatVisible; showChat( isChatVisible ); end ) Link to comment
ASiT Posted November 4, 2008 Author Share Posted November 4, 2008 do you guys know how to turn off like when i see another player i see their name and health above their head .... do you know how to turn that off as well when i push "i" or is it not possible to turn it off...? Link to comment
robhol Posted November 4, 2008 Share Posted November 4, 2008 The wiki is there for a reason, look at it a bit! Just look at the function lists and you'll learn stuff like that. http://development.mtasa.com/index.php? ... _Functions http://development.mtasa.com/index.php? ... _Functions Link to comment
Gamesnert Posted November 4, 2008 Share Posted November 4, 2008 do you guys know how to turn off like when i see another player i see their name and health above their head .... do you know how to turn that off as well when i push "i" or is it not possible to turn it off...? For as far as I know you can't disable other player's healthbars. You can do it with Nametags! (that's a hint, look for it in the pages Robhol gave ) Link to comment
=FAS=Shigawire Posted November 4, 2008 Share Posted November 4, 2008 do you guys know how to turn off like when i see another player i see their name and health above their head .... do you know how to turn that off as well when i push "i" or is it not possible to turn it off...? For as far as I know you can't disable other player's healthbars. You can do it with Nametags! (that's a hint, look for it in the pages Robhol gave ) Of course it is, if we are talking about the bar which is going through the body of the players... In the ChatBox its the command /shownametags. Then all is disabled, i actually dont know the function inside the wiki... But interesting point: Is there a possibility of Executing a Command? (No, i do not mean executeCommandHandler). Would be nice like executeCommand("shownametags",source). This would save veeeery much work, and make the using of TriggerServer/CientEvent unnecessary in many cases. Tell me if this is bullshit Link to comment
50p Posted November 4, 2008 Share Posted November 4, 2008 do you guys know how to turn off like when i see another player i see their name and health above their head .... do you know how to turn that off as well when i push "i" or is it not possible to turn it off...? For as far as I know you can't disable other player's healthbars. You can do it with Nametags! (that's a hint, look for it in the pages Robhol gave ) Of course it is, if we are talking about the bar which is going through the body of the players... In the ChatBox its the command /shownametags. Then all is disabled, i actually dont know the function inside the wiki... But interesting point: Is there a possibility of Executing a Command? (No, i do not mean executeCommandHandler). Would be nice like executeCommand("shownametags",source). This would save veeeery much work, and make the using of TriggerServer/CientEvent unnecessary in many cases. Tell me if this is :~ There is no other function to execute command. Link to comment
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