Jump to content

Necesito ayuda con chat global


Recommended Posts

Hola amigos, tengo un resource de chat global para roleplays pero escribo el comando que le puse y no funciona

function globalOOC( thePlayer, commandName, ... ) 
    if getElementData(thePlayer, "loggedin") == true then 
        if getElementData( thePlayer, "ooc" ) == 1 then 
        local message = table.concat( { ... }, " " ) 
            if #message > 0 then 
                outputChatBox( "" .. string.gsub(getPlayerName( thePlayer ), "_", " ") ..  " [GlobalOOC]: " .. message .. "", root, 0, 104, 139 ) 
            else 
                outputChatBox( "Usage: /" .. commandName .. " [OOC text]", thePlayer, 255, 255, 255 ) 
            end 
        end 
    end 
end 
addCommandHandler("u", globalOOC) 
addCommandHandler("GlobalOOC", globalOOC) 

lo que pasa en el server:

Say: /u Estoesunaprueba 
                                              

Link to comment
No me entendiste, me refiero si sale algun error en el debugscript.

Ya lo resolví ahora tengo otra duda

-- Anuncios para ventas u demas cosas 
-- Ejemplo: /an Vendo Bullet barato #49546566 
function publicChat(thePlayer, commandName, ...) 
        local players = getElementsByType("player") 
        local playerName = getClientName ( thePlayer ) 
        local chatContent = {...} 
        for index, player in ipairs ( players ) do 
            outputChatBox( "[Anuncio] ".. playerName.. ": " ..table.concat ( chatContent, " "), player, 50, 200, 100) 
        end 
    end 
addCommandHandler( "an", publicChat ) 

¿como puedo sacar el playerName de la linea 8? así nadie sabe quien envió el anuncio

Link to comment

Intenta esto

-- Anuncios para ventas u demas cosas 
-- Ejemplo: /an Vendo Bullet barato #49546566 
function publicChat(thePlayer, commandName, ...) 
        local players = getElementsByType("player") 
        local chatContent = {...} 
        for index, player in ipairs ( players ) do 
            outputChatBox( "[Anuncio]:" ..table.concat ( chatContent, " "), player, 50, 200, 100) 
        end 
    end 
addCommandHandler( "an", publicChat ) 

Link to comment

... ?

-- Anuncios para ventas u demas cosas 
-- Ejemplo: /an Vendo Bullet barato #49546566 
function publicChat(thePlayer, commandName, ...) 
        local players = getElementsByType("player") 
        local chatContent = {...} 
        for index, player in ipairs ( players ) do 
            outputChatBox( "[Anuncio] " ..table.concat ( chatContent, " "), player, 50, 200, 100) 
        end 
    end 
addCommandHandler( "an", publicChat ) 

Link to comment
  • Recently Browsing   0 members

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