Jump to content

Global Chat Admin TAG


Tekken

Recommended Posts

Hi i use this resource for global cheat and i want when i type on chat to get tag

Server

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ 
-- GlobalChat MTA:DayZ addon 1.1 
-- Made by -ffs-Sniper 
-- You are free to edit this addon 
--/////////////////////////////////// 
  
--Add the resource as addon to DayZ 
function addAddonInfo ( name, description ) 
    return call ( getResourceFromName( "DayZ" ), "addAddonInfo", name, description ) 
end 
  
addAddonInfo ( "GlobalChat", "" ) 
  
-------------------------------------------------------------------- 
--Your Code 
  
--Please edit the settings in the meta.xml or admin panel instead of changing those 
colorCodesDefault = { } 
colorCodesDefault.colorcode1 = "#1FDCF5" 
colorCodesDefault.colorcode3 = "#1FDCF5" 
colorCodesDefault.colorcode2 = "#FFFFFF" 
  
colorCodes = { } 
colorCodes.colorcode1 = get ( "colorcode1" ) or colorCodesDefault.colorcode1 
colorCodes.colorcode2 = get ( "colorcode2" ) or colorCodesDefault.colorcode2 
colorCodes.colorcode3 = get ( "colorcode3" ) or colorCodesDefault.colorcode3 
  
--Check color code on start 
for i, v in pairs ( colorCodes ) do 
    if not getColorFromString ( v ) then 
        colorCodes[i] = colorCodesDefault[i] --if the admin fails to enter a valid hex color code 
        outputChatBox ( "Bad " .. i .. " specified at GlobalChat addon (format: #FFFFFF)", root, 255, 0, 0, false) 
        outputDebugString ( "Bad " .. i .. " specified at GlobalChat addon (format: #FFFFFF)", 2 ) 
    end 
end 
  
outputLimit = 128 --character limit for chatbox outputs (do not change this) 
  
messagePrefix = get ( "prefix" ) or "[GLOBAL]" --prefix for the outputs 
  
onlyLatinCharacters = get ( "latinchars" ) == "true" and true or false 
  
timeBetweenMessages = tonumber ( get ( "messagedelay" ) ) or 1000 --time to wait between chat messages 
playerTickTable = { } --create a table with tick counts of the most recent chat message 
  
--The message output 
function playeGlobalChat ( playersource, cmd, ... ) 
    if cmd == "globalchat" then 
        --Check whether the player is muted first 
        if isPlayerMuted ( playersource ) then 
            outputChatBox ("You are muted!", playersource, 255, 128, 22, true) 
            return 
        end 
         
        local msg = table.concat ( {...} , " " ) --concat the arguments from table to a string seperated by spaces 
        local msg = string.gsub ( msg, '#%x%x%x%x%x%x', '' ) --remove color-codes 
         
        --Anti-spam checks 
        local onlyLettersMsg = string.gsub ( msg , "%A", "" ) --extract letters only 
        if onlyLettersMsg == string.upper ( onlyLettersMsg ) and #onlyLettersMsg > 6 then --check if there are more than 6 uppercase letters without any lowercase letters 
            outputChatBox ( "Turn off your capslock!", playersource, 255, 0, 0 ) 
            return 
        end 
         
        if string.find ( msg, "http://" ) then --disallow links 
            outputChatBox ( "Do not spam the chat with links. Please use a private message instead!", playersource, 255, 0, 0 ) 
            return 
        end 
         
        if onlyLatinCharacters then 
            local noSpacesMsg = string.gsub ( msg, " ", "" ) 
            local onlySpecCharMsg = string.gsub( noSpacesMsg, "[%a%d]", "") --extract special chars only 
            if #onlySpecCharMsg > 10 then --check if there are more than 10 non-latin characters used (including russian, chinese, etc. characters) 
                outputChatBox ( "Do not spam the chat with special (language) characters!", playersource, 255, 0, 0 ) 
                return 
            end 
        end 
         
        local var, spacesCount = string.gsub( msg, " ", "") --get the count of spaces 
        if ( #msg / spacesCount ) > 20 and #msg > 20 then --check if there is at least one space per 20 or less characters 
            outputChatBox ( "Do not spam the chat with long words!", playersource, 255, 0, 0 ) 
            return 
        end 
         
        if playerTickTable[playersource] then --check if a table entry for the player exists 
            local tick = getTickCount ( ) --get the current tick count in ms 
            local timePassed = tick - playerTickTable[playersource] --calculate the time that passed between two messages 
            if timePassed <= timeBetweenMessages then 
                outputChatBox ( "Please refrain from chat spam!", playersource, 255, 0, 0 ) 
                return 
            end 
        else 
            playerTickTable[playersource] = getTickCount ( )  
        end 
        --End of anti-spam checks 
         
        local message = messagePrefix .. colorCodes.colorcode2 .. string.gsub ( ( getPlayerName ( playersource ) .. " : " ), '#%x%x%x%x%x%x', '' ) .. colorCodes.colorcode3 .. msg --precreate the message string 
        local message = string.sub ( message, 1, outputLimit ) --since the chatbox won't display messages with more than 128 characters we just drop the ones at the end 
        local r, g, b = getColorFromString ( colorCodes.colorcode1 )         
        outputChatBox ( message, root, r, g, b, true ) 
         
        playerTickTable[playersource] = getTickCount ( )  
    end 
end 
addCommandHandler ( "globalchat", playeGlobalChat ) 
  
--Admin panel resource settings checks 
addEventHandler ( "onSettingChange", root,  
    function ( setting, oldValue, newValue ) 
        local setting = gettok ( setting, 2, string.byte ( "." ) ) 
        if setting == "colorcode1" or setting == "colorcode2" or setting == "colorcode3" then 
            if getColorFromString ( fromJSON( newValue ) ) then --if the admin fails to enter a valid hex color code 
                colorCodes[setting] = fromJSON( newValue ) 
            else 
                colorCodes[setting] = colorCodesDefault[setting] 
                outputChatBox ( "Bad " .. setting .. " specified at GlobalChat addon (format: #FFFFFF)", root, 255, 0, 0, false) 
                outputDebugString ( "Bad " .. setting .. " specified at GlobalChat addon (format: #FFFFFF)", 2 ) 
            end 
        end 
        if setting == "messagedelay" then --update message delay when changed 
            if tonumber ( fromJSON( newValue ) ) then 
                timeBetweenMessages = tonumber ( fromJSON( newValue ) ) or 1000 --maximum securtiy is usually best 
            end 
        end 
        if setting == "prefix" then --update message prefix when changed 
            if fromJSON( newValue ) then 
                messagePrefix = fromJSON ( newValue ) or "[GLOBAL]" --maximum securtiy is usually best 
            end 
        end 
        if setting == "latinchars" then --update onlyLatinCharacters setting when changed 
            onlyLatinCharacters = fromJSON ( newValue ) == "true" and true or false 
        end 
    end 
) 
  
addEventHandler ( "onPlayerQuit", root, 
    function ( ) 
        playerTickTable[source] = nil --remove a leaving player from our cached table 
    end 
) 

Client

--\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ 
-- GlobalChat MTA:DayZ addon 1.1 
-- Made by -ffs-Sniper 
-- You are free to edit this addon 
--/////////////////////////////////// 
  
--Define your desired chat key 
GlobalChatKey = "x" 
  
addEventHandler( "onClientResourceStart", getResourceRootElement ( ), 
    function ( ) 
        bindKey ( GlobalChatKey, "down", "chatbox", "globalchat" ) 
        outputChatBox ( "Apasati " .. string.upper ( GlobalChatKey ) .. " pentru a folosi chat-ul global." , 255, 255, 255, true ) 
    end 
) 

meta

Edited by Guest
Link to comment
He given you the function you need , this is a scripting forum. If you're just a guy who come here to post leaked code's or community code's and waiting someone do the work for you then go away.

I say this because I screwed something and thought not talk to me and that anyway thanks

Link to comment

So i just found an other one but it only work on press T and i want to press other Lettre so wat to edit ?

Server

-- DISCLAIMER 
--[[ 
    Any user of this resource is allowed to modify the code for personal use, and are not allowed to share their own version with people. Do not attempt to resell this resource as it is avaiblable for FREE. Anyone caught breaking the disclamer will find themselves in trouble with the law under the Copyright Act 2008. You may use / edit only for PERSONAL USE. This code is copyrighted to Christopher Graham Smith (Urangan, Queensland, AUS). 
]] 
  
-- Settings - These settings will change the scripts functions and allow you to disable certain parts. 
settings = { 
['enableTeamChat'] = true, 
['adminTag'] = { 
    ['enabled'] = true, 
    ['ACL'] = { -- A bit more advanced. 
        { 'Admin', '#00B7FF[Admin] ' }, 
        { 'SuperModerator', '#F200FF[s.mod] ' }, 
        { 'Moderator', '#A1FF9C[Mod] ' }, 
        { 'Everyone', ' ' } 
    } 
}, 
['swearFilter'] = { 
    ['enabled'] = true, 
    ['swearCost'] = 0, 
    ['swears'] = { -- Allows you to set the blocked swear words, syntax is ['WORD'] = 'REPLACEMENT' 
        ['asshole'] = '*******', 
        ['fuck'] = '****', 
        ['slut'] = '****', 
        ['bitch'] = '*****', 
        ['cunt'] = '****', 
        ['whore'] = '*****', 
        ['pussy'] = '*****', 
        ['fag'] = '***', 
        ['perro'] = '*****', 
        ['puta'] = '****', 
        ['joder'] = '*****' 
        } 
}, 
['antiSpamFilter'] = { 
    ['enabled'] = true, 
    ['execeptionGroups'] = 'Admin', -- Groups which can spam, eg. 'Admin,SuperModerator,Moderator' 
    ['chatTimeOut'] = 1.5 -- Set in seconds. 
}, 
['freezeChat'] = { 
    ['enabled'] = true, 
    ['command'] = 'freezechat', -- Command to use when activating frozen chat. 
    ['allowedGroups'] = 'Admin,SuperModerator', -- Groups which have access to this command. 
    ['resetTime'] = 5 -- Time in minutes before it automatically resets. 
}, 
['clearChat'] = { 
    ['enabled'] = true, 
    ['command'] = 'clearchat', 
    ['allowedGroups'] = 'Admin,SuperModerator' 
} 
} 
  
-- Required variables 
spam = { } 
stopChat = false 
  
function chatbox(message, msgtype) 
    if stopChat then cancelEvent() outputChatBox('#FF0000[FREEZECHAT] #FFFFFFAn admin has recently frozen chat.', 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 .. ':#FFFFFF ' .. text 
            if 128 <= #message then 
                outputChatBox('#FF0000Error: The message you entered is too big, please lower it!', source, 255, 255, 255, true) 
            else 
                outputChatBox(message, getRootElement(), 255, 255, 255, true) 
                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 isObjectInACLGroup('user.' .. account, aclGetGroup(v[1])) and check == 0 and not spam[serial] then 
                local message = v[2] .. RGBToHex(r, g, b) .. name .. ":#FFFFFF " .. text 
                if 128 <= #message then 
                    outputChatBox('#FF0000Error: The message you entered is too big, please lower it!', 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('#FF0000Error: Please wait '..settings['antiSpamFilter']['chatTimeOut']..' seconds before saying a message!', 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[FREEZECHAT] #FFFFFF'..getPlayerName(player)..' has frozen the chat!', getRootElement(), 255, 255, 255, true) 
        stopChat = true 
        frozenTimer = setTimer(function() stopChat = false end, (settings['freezeChat']['resetTime'] * 60000), 1) 
    else 
        outputChatBox('#FF0000[FREEZECHAT] #FFFFFF'..getPlayerName(player)..' has unfrozen the chat!', 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(' ') 
    end 
    outputChatBox('#FF0000[CLEARCHAT]#FFFFFF '..getPlayerName(player)..'  has cleared the chat', getRootElement(), 255, 255, 255, true) 
end 
) 
  
function RGBToHex(red, green, blue, alpha) 
        return string.format("#%.2X%.2X%.2X", red,green,blue) 
end 

Client

    -- Set chatbox layout data. 
    chatLines = getChatboxLayout()["chat_lines"] 
    setElementData(localPlayer, 'chatLines', chatLines) 

Link to comment

I created one but when I write it write 2 times

mihayy5: mesaj

mihayy5: mesaj

What to do?

Server

function globalMessage(thePlayer, cmd, ...) 
        local message = table.concat ( { ... }, " " ); 
        local name = getPlayerName(thePlayer); 
        local account = getAccountName ( getPlayerAccount ( thePlayer ) ) 
        if isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then 
        outputChatBox("#FF0000<Admin>#00FF00"..name..": #FFFFFF"..message,root, 255, 255, 255, true) 
        else 
        outputChatBox("#FF0000<Global>#00FF00"..name..": #FFFFFF"..message,root, 255, 255, 255, true) 
        end 
          
        local account = getAccountName ( getPlayerAccount ( thePlayer ) ) 
        if isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then 
        outputChatBox("#FF0000<Moderator>#00FF00"..name..": #FFFFFF"..message,root, 255, 255, 255, true) 
        else 
        outputChatBox("#FF0000<Global>#00FF00"..name..": #FFFFFF"..message,root, 255, 255, 255, true) 
        end 
    end 
    addCommandHandler("global",  globalMessage); 
      
    addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() 
        for index,player in pairs(getElementsByType("player")) do 
            bindKey(player,"x", "down", "chatbox", "global"); 
        end 
    end) 

Link to comment
  
function globalMessage(thePlayer, cmd, ...) 
        local message = table.concat ( { ... }, " " ); 
        local name = getPlayerName(thePlayer); 
        local account = getAccountName ( getPlayerAccount ( thePlayer ) ) 
        if isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then 
        outputChatBox("#FF0000#00FF00"..name..": #FFFFFF"..message,root, 255, 255, 255, true) 
             return 
        else 
             outputChatBox("#FF0000#00FF00"..name..": #FFFFFF"..message,root, 255, 255, 255, true) 
             return 
        end 
          
        local account = getAccountName ( getPlayerAccount ( thePlayer ) ) 
        if isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then 
        outputChatBox("#FF0000#00FF00"..name..": #FFFFFF"..message,root, 255, 255, 255, true) 
             return  
       else 
        outputChatBox("#FF0000#00FF00"..name..": #FFFFFF"..message,root, 255, 255, 255, true) 
               return 
         end 
    end 
    addCommandHandler("global",  globalMessage); 
      
    addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() 
        for index,player in pairs(getElementsByType("player")) do 
            bindKey(player,"x", "down", "chatbox", "global"); 
        end 
    end) 
  

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