1LoL1 Posted February 27, 2015 Posted February 27, 2015 Please anyone help me i dont know how to add for only admins can used /ann. function shoutAdmin(plr, cmd, ...) local msg = table.concat({...}, " ") outputChatBox("Admin"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","")..": "..msg, root, 255, 0, 0) end addCommandHandler("ann", shoutAdmin)
DNL291 Posted February 27, 2015 Posted February 27, 2015 https://wiki.multitheftauto.com/wiki/IsObjectInACLGroup See the examples and try it for yourself. Please do not PM me with scripting related question nor support, use the forums instead.
1LoL1 Posted February 27, 2015 Author Posted February 27, 2015 https://wiki.multitheftauto.com/wiki/IsObjectInACLGroupSee the examples and try it for yourself. So this?: function shoutAdmin(plr, cmd, ...) local msg = table.concat({...}, " ") outputChatBox("Admin"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","")..": "..msg, root, 255, 0, 0) end addCommandHandler("ann", shoutAdmin) players = getElementsByType ( "player" ) admins = "" for k,v in ipairs(players) do local accountname = "" if (isGuestAccount(getPlayerAccount(v)) == false) then accountname = getAccountName (getPlayerAccount(v)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then if (admins == "") then admins = getPlayerName(v) else admins = admins .. ", " .. getPlayerName(v) end end end end outputChatBox( "Online Admins:", getRootElement(), 255, 255, 0) outputChatBox( " " .. tostring ( admins ), getRootElement(), 255, 255, 0) Or how to? i am really noob in "isObjectInACLGroup" .
xeon17 Posted February 27, 2015 Posted February 27, 2015 What the hell are you doing? A unique GangWar gamemode waiting for you!Click here for more information.
Death Posted February 28, 2015 Posted February 28, 2015 try this: function shoutAdmin(thePlayer, cmd, ...) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then -- Does he have access to Admin functions? local msg = table.concat({...}, " ") outputChatBox("Admin"..getPlayerName(thePlayer):gsub("#%x%x%x%x%x%x","")..": "..msg, root, 255, 0, 0) end end addCommandHandler("ann", shoutAdmin)
1LoL1 Posted February 28, 2015 Author Posted February 28, 2015 try this: function shoutAdmin(thePlayer, cmd, ...) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then -- Does he have access to Admin functions? local msg = table.concat({...}, " ") outputChatBox("Admin"..getPlayerName(thePlayer):gsub("#%x%x%x%x%x%x","")..": "..msg, root, 255, 0, 0) end end addCommandHandler("ann", shoutAdmin) Errors: ERROR: Loading script failed: ann/ann.lua:8: "" expected near "else" Script: function shoutAdmin(thePlayer, cmd, ...) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then -- Does he have access to Admin functions? local msg = table.concat({...}, " ") outputChatBox("Admin"..getPlayerName(thePlayer):gsub("#%x%x%x%x%x%x","")..": "..msg, root, 255, 0, 0) end end else outputChatBox ( "TesT", thePlayer, 255, 255, 255, true ) end end addCommandHandler("ann", shoutAdmin)
roaddog Posted February 28, 2015 Posted February 28, 2015 function shoutAdmin(thePlayer, cmd, ...) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then -- Does he have access to Admin functions? local msg = table.concat({...}, " ") outputChatBox("Admin"..getPlayerName(thePlayer):gsub("#%x%x%x%x%x%x","")..": "..msg, root, 255, 0, 0) else outputChatBox ( "TesT", thePlayer, 255, 255, 255, true ) end end addCommandHandler("ann", shoutAdmin) I guess this is what you're trying to do. You gone learn today. I work my ass off, but I still can't pay tho.
1LoL1 Posted February 28, 2015 Author Posted February 28, 2015 function shoutAdmin(thePlayer, cmd, ...) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then -- Does he have access to Admin functions? local msg = table.concat({...}, " ") outputChatBox("Admin"..getPlayerName(thePlayer):gsub("#%x%x%x%x%x%x","")..": "..msg, root, 255, 0, 0) else outputChatBox ( "TesT", thePlayer, 255, 255, 255, true ) end end addCommandHandler("ann", shoutAdmin) I guess this is what you're trying to do. Thanks.
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