generated from ClaudiuHKS/AdvancedQuakeSounds
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwelcome_players.sp
155 lines (123 loc) · 3.16 KB
/
welcome_players.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/**
* MAIN REQUIREMENTS
*/
#include <sourcemod>
#include <sdktools>
#if !defined CS_TEAM_NONE
#define CS_TEAM_NONE (0)
#endif
#if !defined CS_TEAM_T
#define CS_TEAM_T (2)
#endif
#if !defined CS_TEAM_CT
#define CS_TEAM_CT (3)
#endif
/**
* CUSTOM DEFINITIONS TO BE EDITED
*/
#define _WELCOME_CON_MSG_1_ "Welcome. Committing suicide will not alter your score. Unlimited team changes are allowed. The voting system is enabled."
#define _WELCOME_CON_MSG_2_ "You may /rs, /map, /votemap, /voterr or /voterestart."
#define _WELCOME_MSG_1_ " \x01\x0BWelcome\x01. Committing\x09 suicide\x01 will not alter your\x04 score\x01. Unlimited\x09 team changes\x01 are\x04 allowed\x01. The\x09 voting system\x01 is\x04 enabled\x01."
#define _WELCOME_MSG_2_ " \x01You may\x05 /rs\x01,\x05 /map\x01,\x05 /votemap\x01,\x05 /voterr\x01 or\x05 /voterestart\x01."
/**
* CUSTOM INFORMATION
*/
public Plugin myinfo =
{
name = "Welcome Players",
author = "CARAMEL® HACK",
description = "Welcomes All Players After Joining The Game Server",
version = __DATE__,
url = "https://hattrick.go.ro/",
};
/**
* GLOBAL VARIABLES
*/
static bool g_bMsgShown[MAXPLAYERS] = { false, ... };
static bool g_bPlayerTeamHooked = false;
/**
* CUSTOM PUBLIC FORWARDS
*/
public void OnPluginStart()
{
OnMapStart();
}
public void OnMapStart()
{
if (!g_bPlayerTeamHooked)
{
HookEventEx("player_team", _Player_Team_, EventHookMode_Post);
g_bPlayerTeamHooked = true;
}
}
public void OnMapEnd()
{
if (g_bPlayerTeamHooked)
{
UnhookEvent("player_team", _Player_Team_, EventHookMode_Post);
g_bPlayerTeamHooked = false;
}
}
public void OnPluginEnd()
{
OnMapEnd();
}
public bool OnClientConnect(int nEntity, char[] szError, int nMaxLen)
{
g_bMsgShown[nEntity] = false;
return true;
}
/**
* CUSTOM PUBLIC HANDLERS
*/
public void _Player_Team_(Event hEv, const char[] szName, bool bNoBC)
{
static int nTeam = 0, nEntity = 0;
if
(
(
(
(nTeam = hEv.GetInt("team", CS_TEAM_NONE))
==
(CS_TEAM_T)
)
||
(
(nTeam)
==
(CS_TEAM_CT)
)
)
&&
(
(nEntity = GetClientOfUserId(hEv.GetInt("userid", 0)))
>
(0)
)
&&
(
(g_bMsgShown[nEntity])
==
(false)
)
&&
(
(IsClientConnected(nEntity))
==
(true)
)
&&
(
(IsClientInGame(nEntity))
==
(true)
)
)
{
g_bMsgShown[nEntity] = true;
PrintToConsole(nEntity, _WELCOME_CON_MSG_1_);
PrintToConsole(nEntity, _WELCOME_CON_MSG_2_);
PrintToChat(nEntity, _WELCOME_MSG_1_);
PrintToChat(nEntity, _WELCOME_MSG_2_);
}
}