fix SSJ printed wrong and (#129)

This commit is contained in:
shavitush 2016-08-03 08:26:30 +03:00
parent 95c850f88a
commit bae6e18322
2 changed files with 19 additions and 15 deletions

View File

@ -253,13 +253,20 @@ stock bool IsValidClient(int client, bool bAlive = false) // when bAlive is fals
// time formatting!
stock void FormatSeconds(float time, char[] newtime, int newtimesize, bool precise = true)
{
int iRounded = RoundToFloor(time);
float fSeconds = (iRounded % 60) + time - iRounded;
float fTempTime = time;
if(fTempTime < 0.0)
{
fTempTime = -fTempTime;
}
int iRounded = RoundToFloor(fTempTime);
float fSeconds = (iRounded % 60) + fTempTime - iRounded;
char[] sSeconds = new char[8];
FormatEx(sSeconds, 8, precise? "%.03f":"%.01f", fSeconds);
if(time < 60.0)
if(fTempTime < 60.0)
{
strcopy(newtime, newtimesize, sSeconds);
}
@ -268,9 +275,9 @@ stock void FormatSeconds(float time, char[] newtime, int newtimesize, bool preci
{
int iMinutes = (iRounded / 60);
if(time < 3600.0)
if(fTempTime < 3600.0)
{
FormatEx(newtime, newtimesize, "%d:%s%s", iMinutes, (fSeconds < 10)? "0":"", sSeconds);
FormatEx(newtime, newtimesize, "%s%d:%s%s", (time < 0.0)? "-":"", iMinutes, (fSeconds < 10)? "0":"", sSeconds);
}
else
@ -278,7 +285,7 @@ stock void FormatSeconds(float time, char[] newtime, int newtimesize, bool preci
iMinutes %= 60;
int iHours = (iRounded / 3600);
FormatEx(newtime, newtimesize, "%d:%s%d:%s%s", iHours, (iMinutes < 10)? "0":"", iMinutes, (fSeconds < 10)? "0":"", sSeconds);
FormatEx(newtime, newtimesize, "-%d:%s%d:%s%s", (time < 0.0)? "-":"", iHours, (iMinutes < 10)? "0":"", iMinutes, (fSeconds < 10)? "0":"", sSeconds);
}
}
}

View File

@ -1217,21 +1217,18 @@ public void Player_Jump(Event event, const char[] name, bool dB)
for(int i = 1; i <= MaxClients; i++)
{
if(i == client)
if(i == client || !IsValidClient(i) || !IsClientObserver(i) || IsFakeClient(i))
{
continue;
}
if(IsValidClient(i) && IsClientObserver(i))
{
int iObserverMode = GetEntProp(i, Prop_Send, "m_iObserverMode");
int iObserverMode = GetEntProp(i, Prop_Send, "m_iObserverMode");
if(iObserverMode >= 3 && iObserverMode <= 5)
if(iObserverMode >= 3 && iObserverMode <= 5)
{
if(GetEntPropEnt(i, Prop_Send, "m_hObserverTarget") == client)
{
if(GetEntPropEnt(i, Prop_Send, "m_hObserverTarget") == client)
{
PrintSSJ(client, i, gain);
}
PrintSSJ(i, client, gain);
}
}
}