Feat: add timeLastTeamChange

This commit is contained in:
Linventif 2025-01-28 08:18:30 +00:00
parent 94ebf5cba6
commit 9e9a2dfe01
2 changed files with 9 additions and 1 deletions

View File

@ -11,6 +11,7 @@ function gmInte.getPlayerFormat(ply)
["deaths"] = ply:Deaths(), ["deaths"] = ply:Deaths(),
["customValues"] = ply:gmIntGetCustomValues(), ["customValues"] = ply:gmIntGetCustomValues(),
["connectTime"] = math.Round(math.Round(RealTime() - ply:gmIntGetConnectTime())), ["connectTime"] = math.Round(math.Round(RealTime() - ply:gmIntGetConnectTime())),
["timeLastTeamChange"] = math.Round(RealTime() - ply:gmIntGetTimeLastTeamChange()),
["adjustedTime"] = math.Round(ply:getAdjustedTime()), ["adjustedTime"] = math.Round(ply:getAdjustedTime()),
["ping"] = ply:Ping(), ["ping"] = ply:Ping(),
["fps"] = ply:gmIntGetFPS(), ["fps"] = ply:gmIntGetFPS(),

View File

@ -7,6 +7,10 @@ function ply:gmIntIsVerified()
return self.gmIntVerified || false return self.gmIntVerified || false
end end
function ply:gmIntGetTimeLastTeamChange()
return self.gmIntTimeLastTeamChange || RealTime()
end
function ply:gmInteGetBranch() function ply:gmInteGetBranch()
return CLIENT && BRANCH || self.branch || "unknown" return CLIENT && BRANCH || self.branch || "unknown"
end end
@ -144,3 +148,6 @@ hook.Add("ShutDown", "gmInte:Server:ShutDown:SavePlayer", function()
file.Write("gmod_integration/player_before_map_change.json", util.TableToJSON(oldData, true)) file.Write("gmod_integration/player_before_map_change.json", util.TableToJSON(oldData, true))
end end
end) end)
// on team change reset the time
hook.Add("PlayerChangedTeam", "gmInte:Player:ChangedTeam:ResetTime", function(ply) ply.gmIntTimeLastTeamChange = RealTime() end)