Logs

Someone know a sweaps logs, i mean when a admin or someone get a gun from the Q menu, it say who spawned it and who receive it.

Thanks for the answer

Before somebody comes in here and mindlessly bitches about bad English, he’s asking for something that will print a message to console every time someone spawns a weapon and every time someone picks up a weapon.

I would like something like this too.

Agree. Someone should make this. :slight_smile:

I can make one print it all in a file.

If you can make it and post it, it will be cool :slight_smile:

[lua]local LOG_CURRENT = “weapon_log.txt”

function WriteToLog( str )
filex.Append( LOG_CURRENT, str … "
" )
end

function ReadLog()
return file.Read( LOG_CURRENT )
end

function ChangeLog( path )
LOG_CURRENT = path
end

hook.Add(“PlayerSpawnedSENT”,“LogWeaponSpawn”,function(pl,wep)
if wep:IsWeapon() then WriteToLog( pl:Name()… " spawned a “… wep:GetClass()…”.") end
end)

hook.Add(“WeaponEquip”,“LogWeaponPickup”,function( wep )
WriteToLog( wep:GetOwner():Name()… " picked up a “…wep:GetClass()…”.")
end)[/lua]

Try that.

I put this script in lua/autorun/server ?