Sparrow Posted January 6, 2012 Posted January 6, 2012 I do admin chat script hours ago, it work well but my problem is how set the text in admin chat showed only for admins (admin and moderators) I try but I fail, nothing won't work, what is the function needed for this? thanks
Castillo Posted January 6, 2012 Posted January 6, 2012 Post your code, how do you expect us to help you if you don't. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Sparrow Posted January 6, 2012 Author Posted January 6, 2012 this is it: function adminChat(thePlayer,_,...) local text = table.concat({...}, "") local name = getPlayerName(thePlayer) local accName = getAccountName (getPlayerAccount (thePlayer)) if (isObjectInACLGroup ("user." .. accName, aclGetGroup("Admin")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("SuperModerator")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("Moderator")) ) then outputChatBox ("#FF0000(Admin Chat) "..name..": #FFFFFF"..text, getRootElement(), 255, 255, 255, true) end end addCommandHandler("ac", adminChat)
Castillo Posted January 6, 2012 Posted January 6, 2012 function adminChat(thePlayer,_,...) local text = table.concat({...}, " ") local name = getPlayerName(thePlayer) local accName = getAccountName (getPlayerAccount (thePlayer)) if ( isObjectInACLGroup ("user.".. accName, aclGetGroup("Admin")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("SuperModerator")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("Moderator")) ) then for index, player in ipairs(getElementsByType("player")) do local accName = getAccountName (getPlayerAccount (player)) if ( isObjectInACLGroup ("user." .. accName, aclGetGroup("Admin")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("SuperModerator")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("Moderator")) ) then outputChatBox ("#FF0000(Admin Chat) "..tostring(name)..": #FFFFFF"..tostring(text), player, 255, 255, 255, true) end end end end addCommandHandler("ac", adminChat) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Sparrow Posted January 6, 2012 Author Posted January 6, 2012 I test this, players also can see what I write
Castillo Posted January 6, 2012 Posted January 6, 2012 My bad, I forgot to change something, copy it again. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Kenix Posted January 6, 2012 Posted January 6, 2012 Try function adminChat( thePlayer,_,... ) local text = table.concat( {...}, "" ) local name = getPlayerName( thePlayer ) for _,v in pairs( getPlayersInGroup( accName ) ) do outputChatBox ("#FF0000(Admin Chat) "..tostring( name )..": #FFFFFF"..tostring( text ), v, 255, 255, 255, true) end end addCommandHandler("ac", adminChat) function getPlayersInGroup( accName ) local Table = { } for _,v in pairs( getElementsByType( "player" ) ) do local accName = getAccountName ( getPlayerAccount ( v ) ) if isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup( "Admin" ) ) or isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup ( "SuperModerator" ) ) or isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup ( "Moderator" ) ) then table.insert( Table,v ) end end return Table end Code updated recheck it http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
TwiX! Posted January 6, 2012 Posted January 6, 2012 this code.. will not work "spaces" "I will kill u" only - "iwillkillu" - Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]
Castillo Posted January 6, 2012 Posted January 6, 2012 True, use this: function adminChat( thePlayer,_,... ) local text = table.concat( {...}, " " ) local name = getPlayerName( thePlayer ) for _,v in pairs( getPlayersInGroup( accName ) ) do outputChatBox ("#FF0000(Admin Chat) "..tostring( name )..": #FFFFFF"..tostring( text ), v, 255, 255, 255, true) end end addCommandHandler("ac", adminChat) function getPlayersInGroup( accName ) local Table = { } for _,v in pairs( getElementsByType( "player" ) ) do local accName = getAccountName ( getPlayerAccount ( v ) ) if isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup( "Admin" ) ) or isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup ( "SuperModerator" ) ) or isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup ( "Moderator" ) ) then table.insert( Table,v ) end end return Table end San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
TwiX! Posted January 6, 2012 Posted January 6, 2012 now it works ,ty - Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]
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