-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblacklist.sp
82 lines (64 loc) · 1.9 KB
/
blacklist.sp
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
#include <sourcemod>
#pragma newdecls required
#pragma semicolon 1
//BLACKLIST FILE PATH
#define BLACKLIST_PATH "configs/blacklist.txt"
//32 PREDEFINED BLACKLISTED STEAMID
ArrayList g_Blacklist;
public Plugin myinfo =
{
name = "Blacklist",
author = "shipy",
description = "blacklist steamid's",
version = "0.0.1",
url = "https://github.com/shipyy/misc_plugins"
};
public void OnMapStart()
{
PrintToConsole(0, "[BlackList] Loading Blacklist...");
LoadBlackList();
}
public void LoadBlackList()
{
char sPath[PLATFORM_MAX_PATH];
BuildPath(Path_SM, sPath, sizeof sPath, "%s", BLACKLIST_PATH);
File blacklist = OpenFile(sPath, "r");
char line[128];
g_Blacklist = new ArrayList(32);
if (blacklist != null) {
while (!IsEndOfFile(blacklist) && ReadFileLine(blacklist, line, sizeof line)) {
if (StrContains(line, "//", false) == 0 || IsNullString(line) || strlen(line) == 0)
continue;
TrimString(line);
g_Blacklist.PushString(line);
}
PrintToConsole(0, "[Blacklist] Printing Blacklist...");
char tempid[32];
for(int i = 0; i < g_Blacklist.Length; i++)
{
g_Blacklist.GetString(i, tempid, sizeof tempid);
PrintToConsole(0, "%s", tempid);
}
}
else {
LogError("Blacklist path [%s] not found", BLACKLIST_PATH);
}
}
public void OnClientPostAdminCheck(int client)
{
char client_steamid[32];
GetClientAuthId(client, AuthId_SteamID64, client_steamid, MAX_NAME_LENGTH, true);
if (g_Blacklist.Length != 0)
if(g_Blacklist.FindString(client_steamid) != -1) {
PrintToConsole(0, "[BlackList] Client (%s) Connected Found in Blacklist!", client_steamid);
KickClient(client, "");
}
}
public void OnPluginEnd()
{
delete g_Blacklist;
}
public void OnMapEnd()
{
delete g_Blacklist;
}