-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIns-ControlPoints.sp
More file actions
89 lines (79 loc) · 1.88 KB
/
Ins-ControlPoints.sp
File metadata and controls
89 lines (79 loc) · 1.88 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
#include <sdkhooks>
#include <sdktools>
#define MAXCP 20
bool CPCappers[MAXCP][MAXPLAYERS];
public Plugin myinfo =
{
name = "Ins Control Points Fix",
author = "Gunslinger",
description = "Fix Control Points bug for Insurgency",
version = "1.0",
url = "https://new-page.xyz"
};
public void OnPluginStart()
{
HookEvent("controlpoint_captured", CPCapturedPre, EventHookMode_Pre);
HookEvent("controlpoint_starttouch", CPStartTouch, EventHookMode_Post);
HookEvent("controlpoint_endtouch", CPEndTouch, EventHookMode_Post);
}
public void OnMapStart()
{
// Clean array
for (int i = 0; i < MAXCP; i++)
for (int j = 0; j < MAXPLAYERS; j++)
CPCappers[i][j] = false;
}
/*
"controlpoint_captured"
{
"priority" "short"
"cp" "byte"
"cappers" "string"
"cpname" "string"
"team" "byte"
"oldteam" "byte"
}
*/
public Action CPCapturedPre(Handle event, const char[] name, bool dontBroadcast)
{
char FixCappers[MAXPLAYERS];
int cp = GetEventInt(event, "cp");
int team = GetEventInt(event, "team");
for (int capper = 1, index = 0; capper < MaxClients; capper++)
if (IsClientInGame(capper) && GetClientTeam(capper) == team && CPCappers[cp][capper])
FixCappers[index++] = capper;
SetEventString(event, "cappers", FixCappers);
return Plugin_Changed;
}
/*
"controlpoint_starttouch"
{
"area" "byte"
"object" "short"
"player" "short"
"team" "short"
"owner" "short"
"type" "short"
}
*/
public Action CPStartTouch(Handle event, const char[] name, bool dontBroadcast)
{
int area = GetEventInt(event, "area");
int player = GetEventInt(event, "player");
CPCappers[area][player] = true;
}
/*
"controlpoint_endtouch"
{
"owner" "short"
"player" "short"
"team" "short"
"area" "byte"
}
*/
public Action CPEndTouch(Handle event, const char[] name, bool dontBroadcast)
{
int area = GetEventInt(event, "area");
int player = GetEventInt(event, "player");
CPCappers[area][player] = false;
}