Jump to content

How i can check if is a admin?


ARares

Recommended Posts

In this code, i want to check if is a admin?, because if is a admin i want to be: "[Admin][Global]"

 

function globalMessage(thePlayer, cmd, ...) 
    local message = table.concat ( { ... }, " " ); 
    local name = getPlayerName(thePlayer); 
for _,v in ipairs(getElementsByType("player")) do 
		outputChatBox("#FF0000[GLOBAL] #FFFFFF"..name..": #FFFFFF"..message,v, 255, 255, 255, true) --00FF00
    end 
end 
addCommandHandler("global",  globalMessage); 
  
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() 
  for index,player in pairs(getElementsByType("player")) do 
        bindKey(player,"b", "down", "chatbox", "global"); 
  end 
end 
) 
  
  
addEventHandler("onPlayerJoin", getRootElement(),  
function() 
  bindKey(source, "b", "down", "chatbox", "global"); 
end 
) 

 

Link to comment
function globalMessage(thePlayer, cmd, ...)
    local message = table.concat({...}, " ")
    local name = getPlayerName(thePlayer)
  
    local account = getPlayerAccount(thePlayer)
    if not isGuestAccount(account) and isObjectInACLGroup ("user."..getAccountName(account), aclGetGroup("Admin")) then
        outputChatBox("#FF0000[Admin][Global]#FFFFFF "..name..": #FFFFFF"..message, root, 255,255,255, true)
    else
        outputChatBox("#FF0000[Global]#FFFFFF "..name..": #FFFFFF"..message, root, 255,255,255, true)
    end
end

 

  • Like 1
Link to comment
4 minutes ago, TRtam said:

function globalMessage(thePlayer, cmd, ...)
    local message = table.concat({...}, " ")
    local name = getPlayerName(thePlayer)
  
    local account = getPlayerAccount(thePlayer)
    if not isGuestAccount(account) and isObjectInACLGroup ("user."..getAccountName(account), aclGetGroup("Admin")) then
        outputChatBox("#FF0000[Admin][Global]#FFFFFF "..name..": #FFFFFF"..message, root, 255,255,255, true)
    else
        outputChatBox("#FF0000[Global]#FFFFFF "..name..": #FFFFFF"..message, root, 255,255,255, true)
    end
end

 

Is working, thanks!

  • Like 1
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...