Jump to content

Rapaziada eu quero trocar a tecla do chat alguem pode ajudar ?


NeoGM

Recommended Posts

 

['antiSpamFilter'] = {
    ['enabled'] = true,
    ['execeptionGroups'] = 'Console,Admin,Moderator,SuperModerator',
    ['chatTimeOut'] = 1.5
},
['freezeChat'] = {
    ['enabled'] = true,
    ['command'] = 'BvRF', 
    ['allowedGroups'] = 'Console,SB', 
    ['resetTime'] = 5
},
['clearChat'] = {
    ['enabled'] = true,
    ['command'] = '',
    ['allowedGroups'] = 'Admin,Console,SuperModerator,Moderator'
}
}

spam = { }
stopChat = false

function chatbox(message, msgtype)
    if stopChat then cancelEvent() outputChatBox('#ff0000[ BCC ]#FAFAFA O chat foi bloqueado', source, 255, 255, 255, true) return end
    local account = getAccountName(getPlayerAccount(source))
    local name = getPlayerName(source)
    local serial = getPlayerSerial(source)
    local r, g, b = getPlayerNametagColor(source)
    local text = message:gsub("%a", string.upper, 1)
    local check = 0
    local spamCheck = false
    if settings['swearFilter']['enabled'] then
        for i, v in pairs(settings['swearFilter']['swears']) do
            while text:lower():find(i:lower(),1,true) do
                local start, end_ = text:lower():find(i:lower(),1,true)
                local found = text:sub(start,end_)
                text = text:gsub(found,v)
                if settings['swearFilter']['swearCost'] ~= 0 then
                    takePlayerMoney(source, settings['swearFilter']['swearCost'])
                end
            end
        end
    end
    if msgtype == 0 then
        cancelEvent()
        if not settings['adminTag']['enabled'] and not spam[serial] then
            message = RGBToHex(r, g, b) .. name .. ':#FAFAFA ' .. text
            if 300 <= #message then
                outputChatBox('#ff0000[ BCC ] #FAFAFA Essa sua mensagem esta muito grande!', source, 255, 255, 255, true)
            else
                outputChatBox(message, getRootElement(), 255, 255, 255, false)
                aclgroup = split(settings['antiSpamFilter']['execeptionGroups'], ', ') or settings['antiSpamFilter']['execeptionGroups']
                for i, v in ipairs(aclgroup) do    if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup(v)) then    spamCheck = true end end
                if not spamCheck then
                    if settings['antiSpamFilter']['enabled'] then
                        spam[serial] = true
                        setTimer(function()
                            spam[serial] = false
                        end, settings['antiSpamFilter']['chatTimeOut']*1000, 1)
                    end
                end
                outputServerLog('CHAT: ' .. name .. ': ' .. text)
            end
            return
        end
        for _,v in ipairs(settings['adminTag']['ACL']) do
            if aclGetGroup(v[1]) ~= false and isObjectInACLGroup('user.' .. account, aclGetGroup(v[1])) and check == 0 and not spam[serial] then
                local message = v[2] .. RGBToHex(r, g, b) .. name .. ":#FAFAFA " .. text
                if 300 <= #message then
                    outputChatBox('#ff0000[ BCC ]#FAFAFA Essa sua mensagem esta muito grande!', source, 255, 255, 255, true)
                    check = 1
                else
                    check = 1
                    outputChatBox(message, getRootElement(), 255, 255, 255, true)
                    if settings['antiSpamFilter']['enabled'] then
                        aclgroup = split(settings['antiSpamFilter']['execeptionGroups'], ', ') or settings['antiSpamFilter']['execeptionGroups']
                        for i, v in ipairs(aclgroup) do    if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup(v)) then    spamCheck = true end end
                        if not spamCheck then
                            spam[serial] = true
                            check = 1
                                setTimer(function()
                                spam[serial] = false
                            end, settings['antiSpamFilter']['chatTimeOut']*1000, 1)
                        end
                    end
                    outputServerLog('CHAT: '.. v[2] .. name .. ': ' .. text)
                end
            elseif spam[serial] and check == 0 then
                outputChatBox('#ff0000[ BCC ] #FAFAFA Você esta digitando muito rapido. espere: '..settings['antiSpamFilter']['chatTimeOut']..' para enviar outra mensagem!', source, 255, 255, 255, true)
                check = 1
            end
        end
    elseif msgtype == 1 and not settings['enableTeamChat'] then
        cancelEvent()
    end
end
addEventHandler("onPlayerChat", getRootElement(), chatbox)

addEventHandler("onPlayerQuit", getRootElement(),
function()
    local serial = getPlayerName(source)
    spam[serial] = false
end )

-- Freeze chat
addCommandHandler(settings['freezeChat']['command'],
function(player)
    if not settings['freezeChat']['enabled'] then return end
    aclgroup = split(settings['freezeChat']['allowedGroups'], ', ') or settings['freezeChat']['allowedGroups']
    for i, v in ipairs(aclgroup) do    if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup(v)) then    check = true end end
    if not check then return end
    
    if not stopChat then
        outputChatBox('#ff0000[ BCC ] #FAFAFA'..getPlayerName(player)..' Bate-papo bloqueado', getRootElement(), 255, 255, 255, true)
        stopChat = true
        frozenTimer = setTimer(function() stopChat = false end, (settings['freezeChat']['resetTime'] * 60000), 1)
    else
        outputChatBox('#ff0000[ BCC ] #FAFAFA'..getPlayerName(player)..' Bate-papo liberado!', getRootElement(), 255, 255, 255, true)
        stopChat = false
    end
end
)

-- Clear chat
addCommandHandler(settings['clearChat']['command'],
function(player)
    if not settings['clearChat']['enabled'] then return end
    aclgroup = split(settings['clearChat']['allowedGroups'], ',') or settings['clearChat']['allowedGroups']
    for i, v in ipairs(aclgroup) do if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup(v)) then    check = true end end
    if not check then return end
    
    for i = 2, getElementData(player, 'chatLines') do
        outputChatBox(' ')
        outputChatBox(' ')
        outputChatBox(' ')
        outputChatBox(' ')
        outputChatBox(' ')
        outputChatBox(' ')
        outputChatBox(' ')
        outputChatBox(' ')
        outputChatBox(' ')
        outputChatBox(' ')
        outputChatBox(' ')
        outputChatBox(' ')
        outputChatBox(' ')
    end
    outputChatBox('#FF0000[ BMR ]#FAFAFA '..getPlayerName(player)..'  Apagou todo o chat', getRootElement(), 255, 255, 255, true)
end
)

function RGBToHex(red, green, blue, alpha)
    if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then
        return nil
    end
    if(alpha) then
        return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha)
    else
        return string.format("#%.2X%.2X%.2X", red,green,blue)
    end
end

--Chats
function MensagemAnon(source, cmd, ...) 
    local MessagemANS = table.concat ( { ... }, " " ); 
for _,v in ipairs(getElementsByType("player")) do 
    outputChatBox("#FFFFFF◈➤ #BDBDBDʙᴄᴄ #FFFFFF◈ #BDBDBDDeepWeb ◈ #BDBDBD "..MessagemANS,v, 255, 255, 255, true) 
    end 
end 
addCommandHandler("Deppweb",  MensagemAnon)

addEventHandler("onPlayerJoin", getRootElement(),  
function() 
  bindKey(source, "", "down", "chatbox", "Deppweb")
end 
) 

addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() 
  for index,player in pairs(getElementsByType("player")) do 
        bindKey(player,"", "down", "chatbox", "Deppweb")
  end 
end 
) 

commands = { -- Aqui vão os comandos que queira deshabilitar

["me"] = true

 


Edited by Lord Henry
Código convertido de texto para Lua
Link to post
  • 3 weeks later...

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