new discord webhook for admin-logs + less precision for console timer
This commit is contained in:
parent
72f2d3168e
commit
c4f31e542f
@ -151,7 +151,7 @@ public Action PointServerCommandForward(const char[] sCommand)
|
||||
{
|
||||
float client_time = GetRoundTimeAtTimerEnd(number);
|
||||
char sTime[32];
|
||||
FormatPlayerTime(client_time, sTime, sizeof(sTime), false, 1);
|
||||
FormatPlayerTime(client_time, sTime, sizeof(sTime));
|
||||
Format(sSecondsAppend, sizeof(sSecondsAppend), " {green}@ %s", sTime);
|
||||
}
|
||||
}
|
||||
@ -197,33 +197,14 @@ public Action PointServerCommandForward(const char[] sCommand)
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
stock void FormatPlayerTime(float Time, char[] result, int maxlength, bool showDash, int precision)
|
||||
stock void FormatPlayerTime(float fTime, char[] sResult, int iMaxlength)
|
||||
{
|
||||
if(Time <= 0.0 && showDash == true)
|
||||
{
|
||||
Format(result, maxlength, "-");
|
||||
return;
|
||||
}
|
||||
int hours = RoundToFloor(Time/3600);
|
||||
Time -= hours*3600;
|
||||
int minutes = RoundToFloor(Time/60);
|
||||
Time -= minutes*60;
|
||||
float seconds = Time;
|
||||
int iMinutes = RoundToFloor(fTime / 60);
|
||||
fTime -= iMinutes * 60;
|
||||
int iSeconds = RoundToFloor(fTime);
|
||||
|
||||
char sPrecision[16];
|
||||
|
||||
if(precision == 0)
|
||||
Format(sPrecision, sizeof(sPrecision), (hours > 0 || minutes > 0)?"%04.1f":"%.1f", seconds);
|
||||
else if(precision == 1)
|
||||
Format(sPrecision, sizeof(sPrecision), (hours > 0 || minutes > 0)?"%06.3f":"%.3f", seconds);
|
||||
else if(precision == 2)
|
||||
Format(sPrecision, sizeof(sPrecision), (hours > 0 || minutes > 0)?"%09.6f":"%.6f", seconds);
|
||||
|
||||
if(hours > 0)
|
||||
Format(result, maxlength, "%d:%02d:%s", hours, minutes, sPrecision);
|
||||
else if(minutes > 0)
|
||||
Format(result, maxlength, "%d:%s", minutes, sPrecision);
|
||||
else
|
||||
Format(result, maxlength, "%s", sPrecision);
|
||||
if(iMinutes)
|
||||
Format(sResult, iMaxlength, "%d:%02d", iMinutes, iSeconds);
|
||||
else
|
||||
Format(sResult, iMaxlength, "%d", iSeconds);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user