Jump to content

Admin chatbox


Thivenin

Recommended Posts

addCommandHandler("wss", 
function(sender, command, ...) 
local accName = getAccountName ( getPlayerAccount ( sender ) ) 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) or isObjectInACLGroup ("user."..accName, aclGetGroup ( "Moderator" ) ) then 
    local message = table.concat( {...} , " " ) 
        if message ~= "" then 
        local sendTo = aclGroupListObjects(aclGetGroup("Admin")) or aclGroupListObjects(aclGetGroup("Moderator")) 
            for i,b in ipairs(sendTo) do 
                if not getElementData(b, getRootElement(), "wssChatDisable") then 
                    outputChatBox("WSS Chat: ".. getPlayerName(sender) ..":".. message, b, 255, 0, 0, true) 
                end 
            end 
        end 
    end 
end 
) 

Hey guys, I want to create a new chatbox for Mods and Admins but it's spamming the message to everyone and colorcodes aren't appearing

I want colorcode to be there, stop the spamming message and the message visible by admins and mods only

line 9 :

expected element at argument 1, got string 'user.Diesulke'

expected element at argument 1, got string 'user.Thivenin'

doing it to every admin/mods

Link to comment

Better way to do it is inserting players, who are admins or moderators, into a table when they log in and removing them when they log out. So you don't have to loop through aclGroupListObjects every time some admin or moderator uses this command.

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