Jump to content

[Problema] Multiples mensajes en chat


UserToDelete

Recommended Posts

Bien, resulta que anduve editando el exquisito Freeroam añadiendo unas tablas, y resulta que ahora me lanza como 15 mensajes (El mismo numero de valores de la tabla que mensajes en chat).

No se porque me da multiples mensajes en chat, y algunos no estan filtrados, aparecen como "fuck" a partir del segundo, en vez de "****".

words = {"fuck","noob","prick","idiot","ass","cum","gay","dick", 
"subnormal","retrasado","follar","idiota","polla","fck","fucking"} 
addEventHandler('onPlayerChat', g_Root, 
    function(msg, type) 
        if type == 0 then 
            cancelEvent() 
            if chatTime[source] and chatTime[source] + tonumber(get("*chat/mainChatDelay")) > getTickCount() then 
                outputChatBox("Stop spamming main chat!", source, 255, 0, 0) 
                return 
            else 
                chatTime[source] = getTickCount() 
            end 
            if get("*chat/blockRepeatMessages") == "true" and lastChatMessage[source] and lastChatMessage[source] == msg then 
                outputChatBox("Stop repeating yourself!", source, 255, 0, 0) 
                return 
            else 
                lastChatMessage[source] = msg 
            end 
            for _,_x in pairs(words) do 
                if string.find(msg,string.lower(_x)) then 
                local msg = string.lower(msg) 
                local _number = string.len(_x) 
                _msg = string.rep("*",tonumber(_number)) 
                    if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("AdminGroup")) then 
                    outputChatBox(admin_Tag.." #FFFFFF" .. getPlayerName ( source ) .. ":#FFFFFF " .. _msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. _msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("SuperModerator")) then 
                    outputChatBox(smod_Tag.." #FFFFFF" .. getPlayerName ( source ) .. ":#FFFFFF " .. _msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. _msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator")) then 
                    outputChatBox(mod_Tag.." #FFFFFF" .. getPlayerName ( source ) .. ":#FFFFFF " .. _msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. _msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Creador")) then 
                    outputChatBox(creador_Tag.." #FFFFFF" .. getPlayerName ( source ) .. "#FFFFFF: " .. _msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. _msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Hoster")) then 
                    outputChatBox(hoster_Tag.." #FFFFFF" .. getPlayerName ( source ) .. "#FFFFFF: " .. _msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. _msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then 
                    local r, g, b = getPlayerNametagColor(source) 
                    outputChatBox(player_Tag.." #FFFFFF"..getPlayerName(source)..': #FFFFFF' .. _msg:gsub('#%x%x%x%x%x%x', ''), g_Root, r, g, b, true) 
                    outputServerLog( "CHAT: " .. getPlayerName(source) .. ": " .. _msg ) 
                    end 
                else 
                    if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("AdminGroup")) then 
                    outputChatBox(admin_Tag.." #FFFFFF" .. getPlayerName ( source ) .. ":#FFFFFF " .. msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("SuperModerator")) then 
                    outputChatBox(smod_Tag.." #FFFFFF" .. getPlayerName ( source ) .. ":#FFFFFF " .. msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator")) then 
                    outputChatBox(mod_Tag.." #FFFFFF" .. getPlayerName ( source ) .. ":#FFFFFF " .. msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Creador")) then 
                    outputChatBox(creador_Tag.." #FFFFFF" .. getPlayerName ( source ) .. "#FFFFFF: " .. msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Hoster")) then 
                    outputChatBox(hoster_Tag.." #FFFFFF" .. getPlayerName ( source ) .. "#FFFFFF: " .. msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then 
                    local r, g, b = getPlayerNametagColor(source) 
                    outputChatBox(player_Tag.." #FFFFFF"..getPlayerName(source)..': #FFFFFF' .. msg:gsub('#%x%x%x%x%x%x', ''), g_Root, r, g, b, true) 
                    outputServerLog( "CHAT: " .. getPlayerName(source) .. ": " .. msg ) 
                    end 
                end 
            end 
        end 
    end 
) 

Link to comment

Intenta con esto.

  
words = {":O","noob","prick","idiot","ass","cum","gay","dick", 
"subnormal","retrasado","follar","idiota","polla","fck",":O"} 
addEventHandler('onPlayerChat', g_Root, 
    function(msg, type) 
        if type == 0 then 
            cancelEvent() 
            if chatTime[source] and chatTime[source] + tonumber(get("*chat/mainChatDelay")) > getTickCount() then 
                outputChatBox("Stop spamming main chat!", source, 255, 0, 0) 
                return 
            else 
                chatTime[source] = getTickCount() 
            end 
            if get("*chat/blockRepeatMessages") == "true" and lastChatMessage[source] and lastChatMessage[source] == msg then 
                outputChatBox("Stop repeating yourself!", source, 255, 0, 0) 
                return 
            else 
                lastChatMessage[source] = msg 
            end 
            for _,_x in pairs(words) do 
                if string.find(msg,string.lower(_x)) then 
                local msg = string.lower(msg) 
                local _number = string.len(_x) 
                _msg = string.rep("*",tonumber(_number)) 
break 
                    if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("AdminGroup")) then 
                    outputChatBox(admin_Tag.." #FFFFFF" .. getPlayerName ( source ) .. ":#FFFFFF " .. _msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. _msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("SuperModerator")) then 
                    outputChatBox(smod_Tag.." #FFFFFF" .. getPlayerName ( source ) .. ":#FFFFFF " .. _msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. _msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator")) then 
                    outputChatBox(mod_Tag.." #FFFFFF" .. getPlayerName ( source ) .. ":#FFFFFF " .. _msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. _msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Creador")) then 
                    outputChatBox(creador_Tag.." #FFFFFF" .. getPlayerName ( source ) .. "#FFFFFF: " .. _msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. _msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Hoster")) then 
                    outputChatBox(hoster_Tag.." #FFFFFF" .. getPlayerName ( source ) .. "#FFFFFF: " .. _msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. _msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then 
                    local r, g, b = getPlayerNametagColor(source) 
                    outputChatBox(player_Tag.." #FFFFFF"..getPlayerName(source)..': #FFFFFF' .. _msg:gsub('#%x%x%x%x%x%x', ''), g_Root, r, g, b, true) 
                    outputServerLog( "CHAT: " .. getPlayerName(source) .. ": " .. _msg ) 
                    end 
                else 
                    if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("AdminGroup")) then 
                    outputChatBox(admin_Tag.." #FFFFFF" .. getPlayerName ( source ) .. ":#FFFFFF " .. msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("SuperModerator")) then 
                    outputChatBox(smod_Tag.." #FFFFFF" .. getPlayerName ( source ) .. ":#FFFFFF " .. msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator")) then 
                    outputChatBox(mod_Tag.." #FFFFFF" .. getPlayerName ( source ) .. ":#FFFFFF " .. msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Creador")) then 
                    outputChatBox(creador_Tag.." #FFFFFF" .. getPlayerName ( source ) .. "#FFFFFF: " .. msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Hoster")) then 
                    outputChatBox(hoster_Tag.." #FFFFFF" .. getPlayerName ( source ) .. "#FFFFFF: " .. msg:gsub('#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true ) 
                    outputServerLog("CHAT: " .. getPlayerName ( source ) .. ": " .. msg) 
                    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then 
                    local r, g, b = getPlayerNametagColor(source) 
                    outputChatBox(player_Tag.." #FFFFFF"..getPlayerName(source)..': #FFFFFF' .. msg:gsub('#%x%x%x%x%x%x', ''), g_Root, r, g, b, true) 
                    outputServerLog( "CHAT: " .. getPlayerName(source) .. ": " .. msg ) 
                    end 
                end 
            end 
        end 
    end 
) 

Link to comment
break 

Me cancela toda la funcion, por lo tanto no funciona nada:

con break puesto:

(Con ese color oscuro tan feo) 
VeNaD: aaaa 
VeNaD: fuck 

sin el break puesto, es decir, la funcion original:

 VeNaD: ass 
 VeNaD: ass 
 VeNaD: ass 
 VeNaD: ass 
 VeNaD: *** 
 VeNaD: ass 
 VeNaD: ass 
 VeNaD: ass 
 VeNaD: ass 
 VeNaD: ass 
 VeNaD: ass 
 VeNaD: ass 
 VeNaD: ass 
 VeNaD: ass 
 VeNaD: ass 

Y solamente he escrito un mensaje.

Link to comment

You use the break statement to finish a loop. This statement breaks the inner loop (for, repeat, or while) that contains it; it cannot be used outside a loop. After the break, the program continues running from the point immediately after the broken loop.

Resumiendo dice que el 'break' se usa para terminar cualquier tipo de loop, luego de que el loop se 'daña' [para] la función continúa normalmente desde el punto donde terminaría.

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...