-
Notifications
You must be signed in to change notification settings - Fork 7
/
hl_gangs_clantags.sp
84 lines (69 loc) · 1.59 KB
/
hl_gangs_clantags.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
83
84
#include <sourcemod>
#include <cstrike>
#define REQUIRE_PLUGIN
#include <hl_gangs>
#pragma newdecls required
#pragma semicolon 1
public Plugin myinfo =
{
name = "[CS:GO/CS:S] Jailbreak Gangs Clan Tags",
author = "Headline",
description = "Gangs clan tag extension",
version = GANGS_VERSION,
url = "http://michaelwflaherty.com"
};
public void OnPluginStart()
{
HookEvent("player_spawn", Event_PlayerSpawn);
AddCommandListener(Command_JoinTeam, "jointeam");
for (int i = 0; i < MaxClients; i++)
{
if (IsValidClient(i))
{
SetClientClanTag(i);
}
}
}
public void OnClientPutInServer(int client)
{
SetClientClanTag(client);
}
public Action Command_JoinTeam(int client, const char[] command, int argc )
{
SetClientClanTag(client);
}
public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
if (!IsValidClient(client))
{
return Plugin_Continue;
}
SetClientClanTag(client);
return Plugin_Continue;
}
void SetClientClanTag(int client)
{
if (!IsValidClient(client))
{
return;
}
if (Gangs_HasGang(client))
{
char gangName[256];
Gangs_GetGangName(client, gangName, sizeof(gangName));
CS_SetClientClanTag(client, gangName);
}
else
{
CS_SetClientClanTag(client, "");
}
}
bool IsValidClient(int client, bool bAllowBots = false, bool bAllowDead = true)
{
if (!(1 <= client <= MaxClients) || !IsClientInGame(client) || (IsFakeClient(client) && !bAllowBots) || IsClientSourceTV(client) || IsClientReplay(client) || (!bAllowDead && !IsPlayerAlive(client)))
{
return false;
}
return true;
}