[PXG]Blue Posted October 4, 2015 Share Posted October 4, 2015 Hey, i'm having an issue making a spy tool for Admins in Teamchat, All players can see it, but i defined that only people with the right to ban ips can read it, here my code function getTeamChatTexts(msg,msgtype) if msgtype == 2 then if getTeamName(getPlayerTeam(source)) ~= "Showdown Kings" then players = getElementsByType("player") tcr,tcg,tcb = getTeamColor(getPlayerTeam(source)) for theKey,thePlayer in ipairs(players) do if hasObjectPermissionTo(thePlayer, "command.SuperSecretAdmin",true) then outputChatBox(""..getTeamName(getPlayerTeam(source)).."#FFFFFF:"..getPlayerName(source)..": "..msg.."", thePlayer, tcr,tcg,tcb, true ) end end end end end addEventHandler("onPlayerChat", root, getTeamChatTexts) Link to comment
[PXG]Blue Posted October 4, 2015 Author Share Posted October 4, 2015 I have changed the Topic Name and text as i resolved the first issue. Link to comment
Moderators IIYAMA Posted October 4, 2015 Moderators Share Posted October 4, 2015 Disable the right at the default user group in the acl. (which you probably didn't do) And enable it on your admin group. (which you probably did do) And this to prevent unwanted warnings.(line 5 and 6) local tcr,tcg,tcb = 255,255,255 local players = getElementsByType("player") local team = getPlayerTeam(source) if team then tcr,tcg,tcb = getTeamColor(team) end Link to comment
[PXG]Blue Posted October 5, 2015 Author Share Posted October 5, 2015 Thanks for your Help, just updating this, i fixed my Issues, the Code is available on my github btw ( cough advertisment cough ) function getTeamChatTexts(msg,msgtype) if msgtype == 2 then hisTeam = getPlayerTeam(source) hisTeamName = getTeamName(hisTeam) if getTeamName(getPlayerTeam(source)) ~= "Showdown Kings" then players = getElementsByType("player") tcr,tcg,tcb = getTeamColor(getPlayerTeam(source)) for theKey,thePlayer in ipairs(players) do if ( hasObjectPermissionTo ( thePlayer, "command.SuperSecretAdmin",false ) ) then if hasObjectPermissionTo(thePlayer, "command.SuperSecretAdmin",true) then if hisTeam == getPlayerTeam(thePlayer) then return end outputChatBox(""..getTeamName(getPlayerTeam(source)).."#FFFFFF:"..getPlayerName(source)..": "..msg.."", thePlayer, tcr,tcg,tcb, true ) end end end end end end addEventHandler("onPlayerChat", root, getTeamChatTexts) 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