add: player logs

This commit is contained in:
linventif 2024-06-22 23:56:15 +02:00
parent 691fdab6fc
commit 22649687f1
No known key found for this signature in database
GPG Key ID: 6F2293FC29C31B99

View File

@ -65,59 +65,57 @@ function gmInte.playerInitialSpawn(ply)
) )
end end
-- function gmInte.postLogPlayerHurt(ply, attacker, healthRemaining, damageTaken) function gmInte.postLogPlayerHurt(ply, attacker, healthRemaining, damageTaken)
-- if (!ply:IsValid() || !ply:IsPlayer(ply)) then return end if (!ply:IsValid() || !ply:IsPlayer(ply)) then return end
-- if (!attacker:IsValid() || !attacker:IsPlayer(attacker)) then return end if (!attacker:IsValid() || !attacker:IsPlayer(attacker)) then return end
-- // Wait a second to see if the player is going to be hurt again // Wait a second to see if the player is going to be hurt again
-- ply.gmodInteLastHurt = ply.gmodInteLastHurt || {} ply.gmodInteLastHurt = ply.gmodInteLastHurt || {}
-- local locCurTime = CurTime() local locCurTime = CurTime()
-- ply.gmodInteLastHurt[attacker:SteamID64()] = locCurTime ply.gmodInteLastHurt[attacker:SteamID64()] = locCurTime
-- timer.Simple(1, function() timer.Simple(1, function()
-- if (ply.gmodInteLastHurt[attacker:SteamID64()] != locCurTime) then if (ply.gmodInteLastHurt[attacker:SteamID64()] != locCurTime) then
-- ply.gmodInteTotalDamage = ply.gmodInteTotalDamage || 0 ply.gmodInteTotalDamage = ply.gmodInteTotalDamage || 0
-- ply.gmodInteTotalDamage = ply.gmodInteTotalDamage + damageTaken ply.gmodInteTotalDamage = ply.gmodInteTotalDamage + damageTaken
-- return return
-- end end
-- gmInte.http.post("/logs/playerHurt", gmInte.http.post("/servers/:serverID/players/" .. ply:SteamID64() .. "/hurt",
-- { {
-- ["victim"] = gmInte.getPlayerFormat(ply), ["victim"] = gmInte.getPlayerFormat(ply),
-- ["attacker"] = gmInte.getPlayerFormat(attacker), ["attacker"] = gmInte.getPlayerFormat(attacker),
-- ["healthRemaining"] = healthRemaining, ["healthRemaining"] = healthRemaining,
-- ["damageTaken"] = ply.gmodInteTotalDamage ["damageTaken"] = ply.gmodInteTotalDamage
-- } }
-- ) )
-- end) end)
-- end end
-- function gmInte.postLogPlayerSpawnedSomething(object, ply, ent, model) function gmInte.postLogPlayerSpawnedSomething(object, ply, ent, model)
-- if (!ply:IsValid() || !ply:IsPlayer(ply)) then return end if (!ply:IsValid() || !ply:IsPlayer(ply)) then return end
-- if (!ent:IsValid()) then return end if (!ent:IsValid()) then return end
-- gmInte.http.post("/logs/playerSpawnedSomething", gmInte.http.post("/servers/:serverID/players/" .. ply:SteamID64() .. "/spawn/" .. object,
-- { {
-- ["object"] = object, ["player"] = gmInte.getPlayerFormat(ply),
-- ["player"] = gmInte.getPlayerFormat(ply), ["entity"] = gmInte.getEntityFormat(ent),
-- ["entity"] = gmInte.getEntityFormat(ent), ["model"] = model || ""
-- ["model"] = model || "" }
-- } )
-- ) end
-- end
-- function gmInte.postLogPlayerGivet(ply, class, swep) function gmInte.postLogPlayerGive(ply, class, swep)
-- if (!ply:IsValid() || !ply:IsPlayer(ply)) then return end if (!ply:IsValid() || !ply:IsPlayer(ply)) then return end
-- gmInte.http.post("/logs/playerGive",
-- {
-- ["player"] = gmInte.getPlayerFormat(ply),
-- ["class"] = class,
-- ["swep"] = swep
-- }
-- )
-- end
gmInte.http.post("/servers/:serverID/players/" .. ply:SteamID64() .. "/give",
{
["player"] = gmInte.getPlayerFormat(ply),
["class"] = class,
["swep"] = swep
}
)
end
// //
// Hooks // Hooks
@ -150,42 +148,42 @@ hook.Add("PlayerInitialSpawn", "gmInte:Player:InitialSpawn", function(ply)
gmInte.playerInitialSpawn(ply) gmInte.playerInitialSpawn(ply)
end) end)
-- hook.Add("PlayerGiveSWEP", "gmInte:Player:SWEPs", function( ply, class, swep ) hook.Add("PlayerGiveSWEP", "gmInte:Player:SWEPs", function( ply, class, swep )
-- gmInte.postLogPlayerGivet(ply, class, swep) gmInte.postLogPlayerGive(ply, class, swep)
-- end) end)
hook.Add("PlayerDeath", "gmInte:Player:Death", function(ply, inflictor, attacker) hook.Add("PlayerDeath", "gmInte:Player:Death", function(ply, inflictor, attacker)
gmInte.playerDeath(ply, inflictor, attacker) gmInte.playerDeath(ply, inflictor, attacker)
end) end)
-- hook.Add("PlayerHurt", "gmInte:Player:Hurt", function(ply, attacker, healthRemaining, damageTaken) hook.Add("PlayerHurt", "gmInte:Player:Hurt", function(ply, attacker, healthRemaining, damageTaken)
-- gmInte.postLogPlayerHurt(ply, attacker, healthRemaining, damageTaken) gmInte.postLogPlayerHurt(ply, attacker, healthRemaining, damageTaken)
-- end) end)
-- hook.Add("PlayerSpawnedProp", "gmInte:Player:SpawnedProp", function(ply, model, ent) hook.Add("PlayerSpawnedProp", "gmInte:Player:SpawnedProp", function(ply, model, ent)
-- gmInte.postLogPlayerSpawnedSomething("SENT", ply, ent, model) gmInte.postLogPlayerSpawnedSomething("sent", ply, ent, model)
-- end) end)
-- hook.Add("PlayerSpawnedSENT", "gmInte:Player:SpawnedSENT", function(ply, ent) hook.Add("PlayerSpawnedSENT", "gmInte:Player:SpawnedSENT", function(ply, ent)
-- gmInte.postLogPlayerSpawnedSomething("SENT", ply, ent) gmInte.postLogPlayerSpawnedSomething("sent", ply, ent)
-- end) end)
-- hook.Add("PlayerSpawnedNPC", "gmInte:Player:SpawnedNPC", function(ply, ent) hook.Add("PlayerSpawnedNPC", "gmInte:Player:SpawnedNPC", function(ply, ent)
-- gmInte.postLogPlayerSpawnedSomething("NPC", ply, ent) gmInte.postLogPlayerSpawnedSomething("npc", ply, ent)
-- end) end)
-- hook.Add("PlayerSpawnedVehicle", "gmInte:Player:SpawnedVehicle", function(ply, ent) hook.Add("PlayerSpawnedVehicle", "gmInte:Player:SpawnedVehicle", function(ply, ent)
-- gmInte.postLogPlayerSpawnedSomething("Vehicle", ply, ent) gmInte.postLogPlayerSpawnedSomething("vehicle", ply, ent)
-- end) end)
-- hook.Add("PlayerSpawnedEffect", "gmInte:Player:SpawnedEffect", function(ply, model, ent) hook.Add("PlayerSpawnedEffect", "gmInte:Player:SpawnedEffect", function(ply, model, ent)
-- gmInte.postLogPlayerSpawnedSomething("Effect", ply, ent, model) gmInte.postLogPlayerSpawnedSomething("effect", ply, ent, model)
-- end) end)
-- hook.Add("PlayerSpawnedRagdoll", "gmInte:Player:SpawnedRagdoll", function(ply, model, ent) hook.Add("PlayerSpawnedRagdoll", "gmInte:Player:SpawnedRagdoll", function(ply, model, ent)
-- gmInte.postLogPlayerSpawnedSomething("Ragdoll", ply, ent, model) gmInte.postLogPlayerSpawnedSomething("ragdoll", ply, ent, model)
-- end) end)
-- hook.Add("PlayerSpawnedSWEP", "gmInte:Player:SpawnedSWEP", function(ply, ent) hook.Add("PlayerSpawnedSWEP", "gmInte:Player:SpawnedSWEP", function(ply, ent)
-- gmInte.postLogPlayerSpawnedSomething("SWEP", ply, ent) gmInte.postLogPlayerSpawnedSomething("swep", ply, ent)
-- end) end)