-
Notifications
You must be signed in to change notification settings - Fork 4
/
AlertSpammer.cs
68 lines (51 loc) · 1.72 KB
/
AlertSpammer.cs
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using BrokeProtocol.Utility.Networking;
using BrokeProtocolClient.settings;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace BrokeProtocolClient.modules.misc
{
class AlertSpammer : Module
{
NumberSetting delay = new NumberSetting("Delay (seconds)", 0, 10, 0.1, 0.1);
BooleanSetting play = new BooleanSetting("Play alert locally", true);
IEnumerator spammerThread;
public AlertSpammer() : base(Categories.Misc, "Alert Spammer", "Spams alerts")
{
addSetting(delay);
addSetting(play);
}
public override void onActivate()
{
if (spammerThread != null) return;
spammerThread = SpammerThread();
getClient().StartCoroutine(spammerThread);
}
public override void onDeactivate()
{
if (spammerThread == null) return;
getClient().StopCoroutine(spammerThread);
spammerThread = null;
}
public override void onRender()
{
}
public override void onUpdate()
{
}
private IEnumerator SpammerThread()
{
while (true)
{
yield return new WaitForSeconds(delay.getValueFloat());
getClient().ClManager.SendToServer(ENet.PacketFlags.Reliable, SvPacket.Alert, Array.Empty<object>());
if (play.isEnabled())
getClient().ClManager.myPlayer.GetControlled.clMountable.PlayAlert();
}
}
}
}