Jump to content

Shout all players


Recommended Posts

Hello, i have this script, its working fine but one thing is missing,

When admin do /shoutall "msg" the message must appear in chatbox like that,

SHOUTALL:"msg"

here is the code

function shout(player, cmd, ...) 
local accountname = getAccountName(getPlayerAccount(player)) 
if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ))  then 
for id, players in ipairs(getElementsByType("player")) do 
local message = table.concat({...}," ") 
local textDisplay = textCreateDisplay () 
local nombre = getPlayerName(player) 
local textItem = textCreateTextItem( ""..message, 0.5, 0.5, 2, 205, 0, 0, 255, 3, "center", "center" ) 
textDisplayAddText ( textDisplay, textItem ) 
textDisplayAddObserver ( textDisplay, players ) 
setTimer ( textDestroyTextItem, 5000, 1, textItem ) 
setTimer ( textDestroyDisplay, 5000, 1, textDisplay ) 
end 
else 
outputChatBox("You cannot use this command!",player,255,12,15) 
    end 
end 
  
addCommandHandler("SHOUTALL", shout) 

Thanks for help

Link to comment
function shout ( player, cmd, ... ) 
    local accountname = getAccountName ( getPlayerAccount ( player ) ) 
    if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then 
        local message = table.concat ( { ... }," " ) 
        outputChatBox ( "SHOUTALL: ".. message, root, 205, 0, 0 ) 
    else 
        outputChatBox ( "You cannot use this command!", player, 255, 12, 15 ) 
    end 
end 
addCommandHandler ( "SHOUTALL", shout ) 

Link to comment
function shout ( player, cmd, ... ) 
    local accountname = getAccountName ( getPlayerAccount ( player ) ) 
    if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then 
        local message = table.concat ( { ... }," " ) 
        textDisplay = textCreateDisplay ( ) 
        outputChatBox ( "SHOUTALL: ".. message, root, 205, 0, 0 ) 
        textItem = textCreateTextItem ( message, 0.5, 0.5, 2, 205, 0, 0, 255, 3, "center", "center" ) 
        textDisplayAddText ( textDisplay, textItem ) 
        for _, thePlayer in ipairs ( getElementsByType ( "player" ) ) do 
            textDisplayAddObserver ( textDisplay, thePlayer ) 
        end 
        setTimer ( 
            function ( ) 
                textDestroyTextItem ( textItem ) 
                textDestroyDisplay ( textDisplay ) 
            end 
            ,5000, 1 
        ) 
    else 
        outputChatBox ( "You cannot use this command!", player, 255, 12, 15 ) 
    end 
end 
addCommandHandler ( "SHOUTALL", shout ) 

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