Jump to content

All players can read it?


[PXG]Blue

Recommended Posts

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
  • Moderators

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

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

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...