• 3D2D Textscreen logging?
    1 replies, posted
Okay, so if you've ever been a staff member on a Gmod Server you'll see time to time that minging players will attempt to avoid getting caught harassing other players by using voice or textscreens instead of in-game chat. Now, there isn't a way to deal with the voice issue that I know of but with the textscreens there should be a way right? So, I'm using Plogs for Server Administration. Would there be anyway that I could have textscreen text logged like lets say how this is written? plogs 2.7.1\lua\plogs_hooks\tools.lua [code] plogs.Register('Tools', false) plogs.AddHook('CanTool', function(pl, trace, tool) -- Shame there isn't a better hook if (not plogs.cfg.ToolBlacklist[tool]) then plogs.PlayerLog(pl, 'Tools', pl:NameID() .. ' attempted to use tool ' .. tool, { ['Name'] = pl:Name(), ['SteamID'] = pl:SteamID() }) end end) [/code] And then in: plogs 2.7.1\lua\plogs_cfg.lua [code] -- Enable/Disable log types here. Set them to true to disable plogs.cfg.LogTypes = { ['tools'] = false, } [/code] Link to 3D2D Textscreens addon; [url]https://www.dropbox.com/s/v3d34481rravrqx/text_screens.rar?dl=0[/url] I did not write the addon above ofcourse.
You would have to put the logging either where the lines of text are set on the entity or after the entity is created since cantool just says if you can or cannot use the tool The text is stored on the entity with self.lines, you can just insert the logging inside where it tells the players the writing or you can use something like OnEntityCreated if you want to leave it alone [code] hook.Add("OnEntityCreated","LogTextscreens",function(ent) if ent:GetClass() == "sammyservers_textscreen" and ent.lines then local text = {} for k,v in pairs(ent.lines) do if v.text then text[#text+1] = v.text end end if #text > 1 and IsValid(ent:CPPIGetOwner()) then local ply = ent:CPPIGetOwner() plogs.PlayerLog(ply, 'Tools', ply:NameID() .. ' made a textscreen ', { ['Name'] = ply:Name(), ['SteamID'] = ply:SteamID(), ['Lines'] = table.concat(text, " ") }) end end end) [/code] This code is untested though. You would most likely need a delay because the text isn't set on the entity until after it's spawned in. You could just put like a .2 second timer on there and it should log Edit: You also need a reference to the player who created it and since the textscreens don't store the player on them you can use CPPI if you're running DarkRP or simply store the player in a variable on the entity when its created
Sorry, you need to Log In to post a reply to this thread.