Jump to content

Necesito ayuda con chat PUBLIC


0xCiBeR

Recommended Posts

  • Administrators

Hola que tal, bueno he sacado la idea del resource de la comunidad orangechat, y pues he diseñado un script para hacer que cuando metes #(seguido de tu mensaje) salga: [PUBLIC](nombre):(Mensaje)

Bueno si no eres del staff todo anda bien, ahora el problema es que quiero que cuando un miembro del staff usa el # aparezca su tag ademas del public.

Aca el script completo

function rangedChat( message, messageType ) 
local r, g, b = getPlayerNametagColor(source) 
local global = string.find(message, "#", 1, true) 
if messageType == 0 then -- If it's normal chat (i.e. not PM or team) 
            if global then 
                local players = getElementsByType("player") 
                message = string.gsub(message, "#", "") 
                for index, player in ipairs ( players ) do 
                    outputChatBox( "[PUBLIC] ".. getPlayerName(source) .. ": " ..message, player, r, g, b, true) 
end 
elseif messageType == 0 and isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Moderator" ) )  then 
    cancelEvent ( ) 
    local r, g, b = getPlayerNametagColor(source) 
    for index, player in ipairs ( players ) do 
    outputChatBox ( "[PUBLIC]""#FF0000[#FF0000[PDz]~Mod#FF0000]#FF0000 " .. getPlayerName(source) .. ": " .. message, getRootElement(), r, g, b, true ) 
end 
elseif messageType == 0 and isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "SuperModerator" ) )  then 
    cancelEvent ( ) 
    local r, g, b = getPlayerNametagColor(source) 
    for index, player in ipairs ( players ) do 
    outputChatBox ( "[PUBLIC]""#FF0000[#FF0000[PDz]~SMod#FF0000]#FF0000 " .. getPlayerName(source) .. ": " .. message, getRootElement(), r, g, b, true ) 
end 
elseif messageType == 0 and isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Admin" ) ) then 
    cancelEvent ( ) 
    local r, g, b = getPlayerNametagColor(source) 
    for index, player in ipairs ( players ) do 
    outputChatBox ("[PUBLIC]""#000000[#000000[PDz]~Admin#000000]#000000 " .. getPlayerName(source) .. ": " .. message, getRootElement(), r, g, b, true ) 
end 
                end 
elseif messageType == 2 then -- If it's team chat 
            local playerTeam = getPlayerTeam(source) -- Find what team the player is 
            local teamMates = getPlayersInTeam( playerTeam ) -- Find his team mates 
            for index, teamMate in ipairs( teamMates ) do -- For each of his team mates, do this: 
outputChatBox( "[RADIO] " .. getPlayerName(source) .. " dice: " ..message, teamMate, r, g, b, true) 
end 
end 
end 
  
end 
end 
end 
addEventHandler ( "onPlayerChat", root, rangedChat ) 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  

Cual sera el error?=0 me ayudan=?

Link to comment
function rangedChat ( message, messageType ) 
    local r, g, b = getPlayerNametagColor ( source ) 
    local accountName = getAccountName ( getPlayerAccount ( source ) ) 
    local playerName = getPlayerName ( source ) 
    local global = string.find ( message, "#", 1, true ) 
    if ( messageType == 0 ) then -- If it's normal chat (i.e. not PM or team) 
        if ( global ) then 
            local message = string.gsub ( message, "#", "", 1 ) 
            if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Moderator" ) ) ) then 
                outputChatBox ( "[PUBLIC]#FF0000[#FF0000[PDz]~Mod#FF0000]#FF0000 ".. playerName ..": ".. message, root, r, g, b, true ) 
            elseif ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "SuperModerator" ) ) ) then 
                outputChatBox ( "[PUBLIC]#FF0000[#FF0000[PDz]~SMod#FF0000]#FF0000 ".. playerName ..": ".. message, root, r, g, b, true ) 
            elseif ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) ) then 
                outputChatBox ("[PUBLIC]#000000[#000000[PDz]~Admin#000000]#000000 ".. playerName ..": ".. message, root, r, g, b, true ) 
            else 
                outputChatBox ( "[PUBLIC] ".. playerName ..": ".. message, root, r, g, b, true ) 
            end 
            cancelEvent ( ) 
        end 
    elseif ( messageType == 2 ) then -- If it's team chat 
        local playerTeam = getPlayerTeam ( source ) -- Find what team the player is 
        local teamMates = getPlayersInTeam ( playerTeam ) -- Find his team mates 
        for _, teamMate in ipairs ( teamMates ) do -- For each of his team mates, do this: 
            outputChatBox ( "[RADIO] ".. playerName .." dice: ".. message, teamMate, r, g, b, true ) 
        end 
        cancelEvent ( ) 
    end 
end 
addEventHandler ( "onPlayerChat", root, rangedChat ) 

Link to comment
  • Recently Browsing   0 members

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