Jump to content

call outputChatBox to nil


Klesh

Recommended Posts

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

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

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

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