I am fairly new to Lua and am having some trouble with getting the ttt damage log command to execute at either the start or the end of each round. I was hoping for it to be a client script without needing access to the server files or anything like that.
The first thing I tried was:
hook.Add("TTTEndRound", "DamageLog", PrintDamageLog) local function PrintDamageLog(wintype) if wintype == WIN_INNOCENT then RunConsoleCommand("ttt_print_damagelog") elseif wintype == WIN_TRAITOR then RunConsoleCommand("ttt_print_damagelog") elseif wintype == WIN_TIMELIMIT then RunConsoleCommand("ttt_print_damagelog") end end
However, that didn’t seem to work. I pasted that lua script into “garrysmod\garrysmod\lua\autorun” and also “garrysmod\garrysmod\lua\autorun\client” but to no avail.
The second thing I tried was:
hook.Add( "TTTPrepareRound", "Print_Log", function( ply ) print( ply:Name() .. " THIS IS A TEST!" ) end )
which I copied from the Garry’s Mod wiki, but yet again it didn’t work.
I don’t know if what I’m asking is possible, but what I do want is when the round ends, the command “ttt_print_damagelog” is put into the console and reveals the information without the need for me typing it all out. I have seen one other example of what I want, but I don’t think it suits my needs as the script should be able to work for all ranks of people.
Many thanks, Tom.