-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcute-ghost.sp
More file actions
104 lines (77 loc) · 2.7 KB
/
cute-ghost.sp
File metadata and controls
104 lines (77 loc) · 2.7 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include <sourcemod>
#include <sdktools>
#include <clientprefs>
#include <shavit>
#pragma semicolon 1
#pragma newdecls required
#define PLUGIN_VERSION "1337"
bool g_bDisabled[MAXPLAYERS + 1];
bool g_bReplayAvailable = false;
int g_iBeam;
ArrayList g_aFrames = null;
Handle g_hGhostEnabled;
public Plugin myinfo =
{
name = "cute-ghost",
author = "may",
description = "i love kaworu",
version = PLUGIN_VERSION,
url = "https://github.com/lilac1337"
};
public void OnPluginStart()
{
RegConsoleCmd("sm_ghost", Command_Ghost, "i'm gay");
RegConsoleCmd("sm_beam", Command_Ghost, "i'm gay");
g_hGhostEnabled = RegClientCookie("cuteghost_enabled", "Ghost Enabled", CookieAccess_Protected);
}
public void OnMapStart()
{
g_iBeam = PrecacheModel("materials/shavit/zone_beam.vmt", true);
}
public void OnClientCookiesCached(int client)
{
char sCookieValue[12];
GetClientCookie(client, g_hGhostEnabled, sCookieValue, sizeof(sCookieValue));
g_bDisabled[client] = view_as<bool>(StringToInt(sCookieValue));
}
public void Shavit_OnReplaysLoaded()
{
g_aFrames = Shavit_GetReplayFrames(0, 0);
g_bReplayAvailable = (g_aFrames != null);
}
public void Shavit_OnWorldRecord(int client, int style, float time, int jumps, int strafes, float sync, int track, float oldwr, float oldtime, float perfs, float avgvel, float maxvel, int timestamp)
{
if (style == 0 && track == 0)
{
g_aFrames = Shavit_GetReplayFrames(style, track);
g_bReplayAvailable = true;
}
}
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2])
{
if (!(cmdnum % 10) && !g_bDisabled[client] && g_bReplayAvailable)
{
int baseFrame = RoundToNearest(Shavit_GetClosestReplayTime(client) / GetTickInterval());
baseFrame += 125;
for (int i = 0; i <= 10; i++)
{
frame_t frame, nextFrame;
g_aFrames.GetArray(baseFrame + i * 5, frame, sizeof(frame_t));
g_aFrames.GetArray(baseFrame + i * 5 + 5, nextFrame, sizeof(frame_t));
TE_SetupBeamPoints(frame.pos, nextFrame.pos, g_iBeam, 0, 0, 10, GetTickInterval() * 10.0, 1.0, 1.0, 0, 0.0, { 207, 159, 255, 124 }, 15);
TE_SendToClient(client, 0.0);
}
}
}
public Action Command_Ghost(int client, int args)
{
if (AreClientCookiesCached(client))
{
char sCookieValue[12];
g_bDisabled[client] = !g_bDisabled[client];
Shavit_PrintToChat(client, "Ghost has been %s.", (g_bDisabled[client]) ? "disabled" : "enabled");
IntToString(g_bDisabled[client], sCookieValue, sizeof(sCookieValue));
SetClientCookie(client, g_hGhostEnabled, sCookieValue);
}
return Plugin_Handled;
}