Created
April 23, 2014 17:05
-
-
Save CapsAdmin/11223749 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Log(fmt, ...) | |
| str = os.date("[%H:%M:%S] ") .. fmt:format(...) .. "\n" | |
| file.Append(os.date("log/%m-%d-%y.txt"), str) | |
| end | |
| hook.Add("Initialize", "log", function() | |
| Log("New map: %s", game.GetMap()) | |
| end) | |
| hook.Add("ShutDown", "log", function() | |
| Log("Server is shutting down/changing levels.") | |
| end) | |
| hook.Add("PlayerSay", "log", function(ply, str) | |
| Log("%s: %s", ply:GetName(), str) | |
| end) | |
| hook.Add("PlayerConnect", "log", function(name, ip) | |
| Log("Client %q connected (%s).", name, ip) | |
| end) | |
| hook.Add("PlayerInitialSpawn", "log", function(ply) | |
| if ply:IsValid() then | |
| Log("Client %q spawned in server (%s)<%s>.", ply:GetName(), ply:IPAddress(), ply:SteamID()) | |
| end | |
| end) | |
| hook.Add("EntityRemoved", "log", function(ent) | |
| if ent:IsValid() and ent:IsPlayer() then | |
| Log("Dropped %q from server <%s>", ent:GetName(), ent:SteamID()) | |
| end | |
| end) | |
| -- prop spawn | |
| hook.Add("PlayerSpawnedProp", "log", function(ply, str) | |
| Log("%s<%s>: spawned model %s", ply:GetName(), ply:SteamID(), str) | |
| end) | |
| hook.Add("PlayerSpawnedRagdoll", "log", function(ply, str) | |
| Log("%s<%s>: spawned ragdoll %s", ply:GetName(), ply:SteamID(), str) | |
| end) | |
| hook.Add("PlayerSpawnedEffect", "log", function(ply, str) | |
| Log("%s<%s>: spawned effect %s", ply:GetName(), ply:SteamID(), str) | |
| end) | |
| hook.Add("PlayerSpawnedSENT", "log", function(ply, ent) | |
| Log("%s<%s>: spawned sent %s", ply:GetName(), ply:SteamID(), ent:GetClass()) | |
| end) | |
| hook.Add("PlayerSpawnedNPC", "log", function(ply, ent) | |
| Log("%s<%s>: spawned npc %s", ply:GetName(), ply:SteamID(), ent:GetClass()) | |
| end) | |
| hook.Add("PlayerSpawnedVehicle", "log", function(ply, ent) | |
| Log("%s<%s>: spawned vehicle %s", ply:GetName(), ply:SteamID(), ent:GetClass()) | |
| end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment