Jump to content

Necesito ayuda con chat PUBLIC


0xCiBeR

Recommended Posts

Posted

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

DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Bien solid, gracias ahora si, pero me da doble mensaje, Uso una funcion para detener el chat por default?

DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp

 
Posted

Si te digo que lo copies de nuevo, a vos que te parece que quiero que copies?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Bueno no sabia de que hablabas

Bien ya me funciono, Gracias

DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp

 
Posted

Yo no veo nada mas para copiar.

De nada.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Solid una consulta, que cambio para que Solo la parte de PUBLIC aparezca del color del Team en que el player esta ??

DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp

 
Posted

Mmm no entiendo como aplicas eso al script que te pase, ocea para que la parte de [PUBLIC] y la de [RADIO] aparezca en el color que corresponde al Color del Team.Agradeceria que me lo demostraras

DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp

 
Posted

El script ese ya lo hace, lo acabo de probar y [PUBLIC] aparece con mi color.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Jo*** xD perdon es que se me olvido de meterme a un team xD Gracias igual

DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp

 
  • Recently Browsing   0 members

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