GTX Posted January 17, 2013 Posted January 17, 2013 For example I have: outputChatBox"hi" Then I want to cancel this (with cancelEvent() or something). So, it will not output "hi" into chatbox. Got it? Thanks in advance! Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
DiSaMe Posted January 17, 2013 Posted January 17, 2013 Put this code in the resources which use outputChatBox: addEvent("onOutputChatBox", false) _outputChatBox = outputChatBox function outputChatBox(text, visibleTo, r, g, b, colorCoded) local success = triggerEvent("onOutputChatBox", root, text, visibleTo, r, g, b, colorCoded) if success then return _outputChatBox(text, visibleTo, r, g, b, colorCoded) else return false end end Then cancelling the event "onOutputChatBox" will make triggerEvent return false, therefore preventing the true outputChatBox (which was renamed to _outputChatBox) function from being called: function cancelMessage(text, visibleTo, r, g, b, colorCoded) if text == "hi" then cancelEvent() end end addEventHandler("onOutputChatBox", root, cancelMessage) -
GTX Posted January 17, 2013 Author Posted January 17, 2013 Thanks but there are about 1000 resources which have to be cancelled. Is there another way? Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
Smart. Posted January 17, 2013 Posted January 17, 2013 https://wiki.multitheftauto.com/wiki/OnChatMessage lol
GTX Posted January 20, 2013 Author Posted January 20, 2013 https://wiki.multitheftauto.com/wiki/OnChatMessage Thanks! But how do I check if chatbox outputs a resource? And if this resource is a map? Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
Anderl Posted January 20, 2013 Posted January 20, 2013 https://wiki.multitheftauto.com/wiki/OnChatMessage Thanks! But how do I check if chatbox outputs a resource? And if this resource is a map? Chatbox can't output a resource, you probably wanted to said "outputs a resource name". If so, use getResources, iterate through the array returned by it and check if the resource's name is the one outputted. Use getResourceInfo to find out resource's name and its details ( type, author, description, ... ). "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
Cadu12 Posted January 20, 2013 Posted January 20, 2013 theElement: Player element if chatbox output was done via say, teamsay or me. Resource if it was done via outputChatBox. You can use getResourceInfo with that. Ingame nick: Cadu12
csiguusz Posted January 20, 2013 Posted January 20, 2013 Oh, damn, so my code is useless Not useless, it's awesome. I like your idea and I always like to learn new things, so maybe I will use this once. Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
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