-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnew_player_experience.sp
166 lines (133 loc) · 3.95 KB
/
new_player_experience.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
156
157
158
159
160
161
162
163
164
165
166
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <cnf_core>
#include <teambalance>
#include <warden>
// @TODO: hook joining guard queue
/*
Show on:
- Attemting to join Guard
- Joining Guard
- Joining Prisoner
- Looking at Guard
- Looking at Warden
- Getting to LR / seeing LR
- Cell doors opening
- Becoming Warden
- On gun pickup
*/
#pragma newdecls required
#pragma semicolon 1
enum NewPlayerExperience
{
b_newplayer = 0,
b_sawguard,
b_sawwarden,
b_sawlastrequest,
b_joinedprisoner,
b_joinedguard,
b_joinguardattempt
}
bool g_bNewPlayer[MAXPLAYERS+1][NewPlayerExperience];
public void OnPluginStart()
{
//HookEvent("cs_prev_next_spectator", Event_Spectate);
//HookEvent("player_team", Event_PlayerTeam);
HookEvent("player_spawn", Event_PlayerSpawn);
}
public void Core_OnClientPutInServer(int client)
{
g_bNewPlayer[client][b_newplayer] = false;
}
public void Core_OnFirstJoin(int client)
{
g_bNewPlayer[client][b_newplayer] = true;
g_bNewPlayer[client][b_sawguard] = false;
g_bNewPlayer[client][b_sawwarden] = false;
g_bNewPlayer[client][b_sawlastrequest] = false;
g_bNewPlayer[client][b_joinedprisoner] = false;
g_bNewPlayer[client][b_joinedguard] = false;
g_bNewPlayer[client][b_joinguardattempt] = false;
}
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 (!g_bNewPlayer[client][b_newplayer])
{
return Plugin_Continue;
}
int target = GetClientAimTarget(client);
if (target > MaxClients || target <= 0 || GetClientTeam(target) != CS_TEAM_CT)
{
return Plugin_Continue;
}
if (warden_iswarden(target))
{
if (!g_bNewPlayer[client][b_sawwarden])
{
g_bNewPlayer[client][b_sawwarden] = true;
PrintHintText(client, "The warden gives commands to T's. Follow them or you will be rebelling!");
}
return Plugin_Continue;
}
// Looking at a guard
if (!g_bNewPlayer[client][b_sawguard])
{
g_bNewPlayer[client][b_sawguard] = true;
PrintHintText(client, "The guard makes sure prisoners follow orders and keeps them from rebelling.");
}
return Plugin_Continue;
}
/*public Action Event_PlayerTeam(Event event, const char[] name, bool dontBroadcast)
{
int iClient = GetClientOfUserId(event.GetInt("userid"));
if (!g_bNewPlayer[iClient][b_newplayer])
{
return Plugin_Continue;
}
int iTeam = event.GetInt("team");
int iOldTeam = event.GetInt("oldteam");
}*/
public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
int iClient = GetClientOfUserId(event.GetInt("userid"));
if (!g_bNewPlayer[iClient][b_newplayer])
{
return Plugin_Continue;
}
int iTeam = GetClientTeam(iClient);
if (iTeam == CS_TEAM_T)
{
if (!g_bNewPlayer[iClient][b_joinedprisoner])
{
g_bNewPlayer[iClient][b_joinedprisoner] = true;
PrintHintText(iClient, "You are a prisoner. Try and survive by any means possible but guards can't kill you if you follow orders.");
}
return Plugin_Continue;
}
if (iTeam == CS_TEAM_CT && !g_bNewPlayer[iClient][b_joinedguard])
{
g_bNewPlayer[iClient][b_joinedguard] = true;
PrintHintText(iClient, "You are a guard. Enforce the warden's commands and defend him from rebellers!");
}
return Plugin_Continue;
}
public Action Teambalance_OnGuardJoinAttempt(int client)
{
if (!g_bNewPlayer[client][b_newplayer] || g_bNewPlayer[client][b_joinguardattempt])
{
return Plugin_Continue;
}
g_bNewPlayer[client][b_joinguardattempt] = true;
PrintHintText(client, "You must have a good microphone and know the rules to be a guard!");
return Plugin_Continue;
}
public void Warden_OnBecomeWarden(int client)
{
if (!g_bNewPlayer[client][b_newplayer] || g_bNewPlayer[client][b_becomewarden])
{
return Plugin_Continue;
}
g_bNewPlayer[client][b_becomewarden] = true;
PrintHintText(client, "As warden you can command the prisoners to do things. Don't kill them if they do it.");
}