Skip to content

Commit 2efc917

Browse files
authored
fix(logic): optimize client time calculations (#28)
1 parent 7dcf7ba commit 2efc917

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

addons/sourcemod/scripting/Status.sp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public Plugin myinfo =
2929
name = "Status Fixer",
3030
author = "zaCade + BotoX + Obus + .Rushaway",
3131
description = "Fixes the \"status\" command",
32-
version = "2.1.5",
32+
version = "2.1.6",
3333
url = "https://github.com/srcdslab/sm-plugin-Status"
3434
};
3535

@@ -173,9 +173,10 @@ public Action Command_Status(int client, const char[] command, int args)
173173

174174
if (!IsFakeClient(player))
175175
{
176-
int iHours = RoundToFloor((GetClientTime(player) / 3600));
177-
int iMinutes = RoundToFloor((GetClientTime(player) - (iHours * 3600)) / 60);
178-
int iSeconds = RoundToFloor((GetClientTime(player) - (iHours * 3600)) - (iMinutes * 60));
176+
float fTime = GetClientTime(player);
177+
int iHours = RoundToFloor((fTime / 3600));
178+
int iMinutes = RoundToFloor((fTime - (iHours * 3600)) / 60);
179+
int iSeconds = RoundToFloor((fTime - (iHours * 3600)) - (iMinutes * 60));
179180

180181
if (iHours)
181182
FormatEx(sPlayerTime, sizeof(sPlayerTime), "%d:%02d:%02d", iHours, iMinutes, iSeconds);

0 commit comments

Comments
 (0)