Klesh Posted January 10, 2012 Share Posted January 10, 2012 Hello, im asking for example in a wrote function, its created an a display outputChatBox("........, executed when command is called, then i want to cancel later that outputChatBox, someone have a easier way to set that outputChatBox created to nil or false, i dont want to show it when i cancel that. Link to comment
Castillo Posted January 10, 2012 Share Posted January 10, 2012 You mean remove a chatbox message? if so, I don't think that's possible. Link to comment
Klesh Posted January 10, 2012 Author Share Posted January 10, 2012 Yes i want to remove the outputChatBox, when time is passed, is for a antispam system, remove that outputChatBox, i was made it, by other stuff, but the display show it, i dont want that. --example function antiSpam(commandName) outputChatBox("*"..getPlayerName(source).."Has change his nick..", g_Root, 255, 255, 0, true)--example when player changenick if (getTickCount(source, 10000)) then outputChatBox("You use this command every 10 seconds".source, 255, 0, 0, true) --how to remove first outputChatBox? end addEventHandler("onPlayerChangeNick", getResourceRootElement(getThisResource()), antiSpam) --I wanna include this system to the joinquit script. Link to comment
Castillo Posted January 10, 2012 Share Posted January 10, 2012 You can't remove a chatbox message. Link to comment
Klesh Posted January 10, 2012 Author Share Posted January 10, 2012 Fail script antispam system? Link to comment
codeluaeveryday Posted January 10, 2012 Share Posted January 10, 2012 (edited) Removed by Chris* Edited January 13, 2012 by Guest Link to comment
Klesh Posted January 10, 2012 Author Share Posted January 10, 2012 function antiSpam(commandName) outputChatBox("*"..getPlayerName(source).."Has change his nick..", g_Root, 255, 255, 0, true)--example when player changenick if (getTickCount(source, 10000)) then outputChatBox("You use this command every 10 seconds".source, 255, 0, 0, true) cancelEvent()--the change nick is locked, nick no change but it show the message like's it is, but dont. end addEventHandler("onPlayerChangeNick", getResourceRootElement(getThisResource()), antiSpam) Link to comment
BinSlayer1 Posted January 10, 2012 Share Posted January 10, 2012 Solidsnake isnt thinking... You can't remove a message, but you can cancel it before it outputs... using onPlayerChat... Recreate it... Look at my admin tag script, it will help you with recreating chat... https://community.multitheftauto.com/index.php?p= ... ls&id=2963 Way to go, insulting someone who's been helping people since the beginning of time He's right actually, you can't cancel/remove outputChatBox's because while this event will gather it, it doesn't support cancellation: https://wiki.multitheftauto.com/wiki/OnChatMessage Also you can't use onPlayerChat because chatting has nothing to do with outputChatBox Link to comment
TwiX! Posted January 10, 2012 Share Posted January 10, 2012 just put the timer on this function, when player changed nick - start timer (10sec) if player use this command again, script told him "You cant change nick, wait 10 sec" local locktime = 0 addEventHandler('onClientPlayerChangeNick', root, function(oldNick, newNick) local locktime = getElementData(source,"LOCKTIME") if locktime == 1 then outputChatBox("You need to wait 10 seconds before use the /nick again",source,255,0,0,true) else outputChatBox('* ' .. oldNick .. ' is now known as ' .. newNick, 255, 100, 100) Lock(source) setTimer ( UnLock, get('locktime')*1000, 1 ,source) end end ) function Lock() setElementData(source,"LOCKTIME",1) end function UnLock() setElementData(source,"LOCKTIME",0) end Meta: <meta> <script src="" /> <settings> <setting name="*locktime" value="10" friendlyname="Nick Locktime" accept="true,false" group="Nick" desc="The locktime between each /nick command." /> </settings> </meta> Not testing Link to comment
Klesh Posted January 10, 2012 Author Share Posted January 10, 2012 Also, multitheftauto can do a new event, of course with time in future version can be posible, "onPlayerCancelOutput()", it's needed, trying to make it fix by other ways. Edit : I was fixed by my own, but thanks for help. 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