Jump to content

Shout all players


Recommended Posts

Posted

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

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

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

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

Thanks working fine :D

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

You're welcome.

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

Worked fine. but when i restarted server it wont show The message, it show only in chat box.

Thanks for youre help

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

I don't understand.

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

It wont show the message in screen, but it show in the chatbox.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Isn't that what you wanted?

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

nope i want it to show in screen & chatbox.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

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

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

Warning: Shoutall/shoutall.lua:14: Bad argument@ 'testDisplayAddObServer'

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Copy it again.

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

Working perfect thanks :D

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

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