ARares Posted July 29, 2017 Share Posted July 29, 2017 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
TRtam Posted July 29, 2017 Share Posted July 29, 2017 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 1 Link to comment
ARares Posted July 29, 2017 Author Share Posted July 29, 2017 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! 1 Link to comment
ARares Posted July 29, 2017 Author Share Posted July 29, 2017 30 minutes ago, TRtam said: You're welcome But is a problem, the message is sent twice, like: [Admin][Global]....: dsadas [Admin][Global]....: dsadas Link to comment
TRtam Posted July 29, 2017 Share Posted July 29, 2017 Maybe is another script, i tried in my local server and it working normally 1 Link to comment
ARares Posted July 29, 2017 Author Share Posted July 29, 2017 2 minutes ago, TRtam said: Maybe is another script, i tried in my local server and it working normally Oh, yeah, i changed, the key to X, and i had 2 binds, :)), Thanks again! 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now