Jump to content

outputchatbox help


Janck7

Recommended Posts

Posted

Hello guys. New on forum. I wrote this script (with help of Zango) :

function kontaktadmina (player, cmd, ...) 
        local text = table.concat ({...}, " ") 
         
        local adminObjects = aclGroupListObjects (aclGetGroup ("Admin")) 
        local admins = {} 
         
        for k,v in ipairs (getElementsByType ("player")) do 
                if isObjectInACLGroup ("user."..getAccountName (getPlayerAccount (v)), aclGetGroup ("Admin")) then 
                        outputChatBox ("#FF7F00* Sporocilo od "..getPlayerName (player)..": #FFFF00"..text, v, 255, 255, 0, true) 
                end 
        end 
           outputChatBox ("Message sent.", thePlayer) 
end 
addCommandHandler ("Admins", kontaktadmina) 
addCommandHandler ("admins", kontaktadmina) 

If you look the last outputchatbox. I want only thePlayer (One who sent message to admin) receive this outputchatbox. Now thePlayer and group Admins get it. Help me please.

Thanks for answers!

Posted

Guys problem solved. I just added 1 more function at the end. Here is the source:

function kontaktadmina (player, cmd, ...) 
        local text = table.concat ({...}, " ") 
         
        local adminObjects = aclGroupListObjects (aclGetGroup ("Admin")) 
        local admins = {} 
         
        for k,v in ipairs (getElementsByType ("player")) do 
                if isObjectInACLGroup ("user."..getAccountName (getPlayerAccount (v)), aclGetGroup ("Admin")) then 
                        outputChatBox ("#FF7F00* Sporocilo od "..getPlayerName (player)..": #FFFF00"..text, v, 255, 255, 0, true) 
                end 
        end 
            outputChatBox ("Message sent.", thePlayer) 
end 
addCommandHandler ("Admins", kontaktadmina) 
addCommandHandler ("admins", kontaktadmina) 
 function message (thePlayer, command) 
        outputChatBox ("Message sent!" , thePlayer) 
end 
addCommandHandler ("admins", message) 
addCommandHandler ("Admins", message) 

  • Moderators
Posted

Or replace thePlayer ( he doesn't defined ) by player like this:

function kontaktadmina (player, cmd, ...) 
    local text = table.concat ({...}, " ") 
      
    local adminObjects = aclGroupListObjects (aclGetGroup ("Admin")) 
    local admins = {} 
     
    for k,v in ipairs (getElementsByType ("player")) do 
        if isObjectInACLGroup ("user."..getAccountName (getPlayerAccount (v)), aclGetGroup ("Admin")) then 
            outputChatBox ("#FF7F00* Sporocilo od "..getPlayerName (player)..": #FFFF00"..text, v, 255, 255, 0, true) 
        end 
    end 
    outputChatBox ("Message sent.", player) 
end 
addCommandHandler ("Admins", kontaktadmina) 
addCommandHandler ("admins", kontaktadmina) 

It's better than make a second function for the same command :roll:

  • Discord Moderators
Posted

by the way Janck7, you can remove the adminObjects and admins tables, I rewrote the snippet and forgot to clean those lines

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