I started coding an entity spawn logging system and here is the code, it breaks the toolgun to where it does nothing and the tool name is "Print Name" and it is in the first slot next to the phys gun, here is the code
[CODE]function Spawndetection( ply, ent )
file.Append( "sentlogger.txt", os.date("%d-%m-%Y %H:%M:%S")..ply:Nick().." ("..ply:SteamID()..") Spawned SENT "..tostring(ent).."/n")
end
hook.Add( "PlayerSpawnedSENT", "SentLogger", Spawndetection )[/CODE]
[B](And of course, doesn't work at all)[/B]
This is a server side file
You must replace "/n" by "\n" but that's not your problem. When this kind of problem is happening to me, it is when I reach the lua file limit. Try put this script in garrysmod/lua/autorun/server. If it works then it is that you reached this limit too.
[QUOTE=Razr x V3N0M;44701164]I started coding an entity spawn logging system and here is the code, it breaks the toolgun to where it does nothing and the tool name is "Print Name" and it is in the first slot next to the phys gun, here is the code
[CODE]function Spawndetection( ply, ent )
file.Append( "sentlogger.txt", os.date("%d-%m-%Y %H:%M:%S")..ply:Nick().." ("..ply:SteamID()..") Spawned SENT "..tostring(ent).."/n")
end
hook.Add( "PlayerSpawnedSENT", "SentLogger", Spawndetection )[/CODE]
[B](And of course, doesn't work at all)[/B]
This is a server side file[/QUOTE]
Try this instead of the file.Append line,:
[code]
file.Append( "sentlogger.txt", os.date("%d-%m-%Y %H:%M:%S")..ply:Nick()..ply:SteamID().." Spawned SENT "..tostring(ent).."/n")
[/code]
Some of your brackets and concatenations were in the wrong place it seems. Also ensure that there's a blank sentlogger.txt file.
His code is working for me so it's not the problem, also file.Append will create the file if it doesn't exist.
Alright, thanks for the help guys. Giving this a shot, I didn't know there was a lua limit.
[B]Update:[/B] That worked, thanks guys!
[QUOTE=DEFCON1;44702155]His code is working for me so it's not the problem, also file.Append will create the file if it doesn't exist.[/QUOTE]
Didn't know that, I assumed there needed to be a file there as the wiki implies that the file has to exist to append it.
Sorry, you need to Log In to post a reply to this thread.