Skip to content

Instantly share code, notes, and snippets.

@shanapu
Created August 4, 2019 19:55
Show Gist options
  • Save shanapu/a3553f0626eb98ec06625bf5e0988b3b to your computer and use it in GitHub Desktop.
Save shanapu/a3553f0626eb98ec06625bf5e0988b3b to your computer and use it in GitHub Desktop.
hud ulow
public Plugin myinfo =
{
name = "TimeLeft",
description = "",
author = "? edit by shanapu",
version = "1.2.0",
url = ""
};
public void OnMapStart()
{
CreateTimer(0.1, Timer_UPDATE, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}
public Action Timer_UPDATE(Handle timer)
{
int timeleft;
char sBuf[255];
GetMapTimeLeft(timeleft);
if(timeleft > 0) FormatEx(sBuf, sizeof sBuf, "Timeleft - %d:%02d", timeleft / 60, timeleft % 60);
else sBuf = "Last round";
int R = RoundToNearest(Cosine((GetGameTime() * 1.0) + 0) * 127.5 + 127.5);
int G = RoundToNearest(Cosine((GetGameTime() * 1.0) + 2) * 127.5 + 127.5);
int B = RoundToNearest(Cosine((GetGameTime() * 1.0) + 4) * 127.5 + 127.5);
SetHudTextParams(-1.0, 1.00, 0.2, R, G, B, 255, 0, 0.00, 0.00, 0.00);
for(int iClient = 1; iClient <= MaxClients; iClient++)
{
if( IsClientInGame(iClient) && GetClientButtons(iClient) & IN_SCORE )
{
ShowHudText(iClient, 4, sBuf);
}
}
return Plugin_Continue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment