-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTextDisplayHelper.cs
More file actions
34 lines (29 loc) · 984 Bytes
/
Copy pathTextDisplayHelper.cs
File metadata and controls
34 lines (29 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
namespace ArcadeScripts;
public static class TextDisplayHelper
{
public static string[] MessageText = new string[Server.MaxPlayers];
public static int[] HoldTimeTicks = new int[Server.MaxPlayers];
public static void SetMessage(int index, string text, float time)
{
HoldTimeTicks[index] = (int)(time * 64);
MessageText[index] = text;
}
public static void OnTick()
{
foreach (CCSPlayerController player in Utilities.GetPlayers())
{
int slot = player.Slot;
if (player.PawnIsAlive && !string.IsNullOrEmpty(MessageText[slot]))
{
player.PrintToCenterHtml(MessageText[slot]);
}
}
for (int i = 0 ; i < Server.MaxPlayers ; i++)
{
HoldTimeTicks[i] -= 1;
if (HoldTimeTicks[i] <= 0) MessageText[i] = "";
}
}
}