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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
|
#if defined _gamechaos_stocks_client_included
#endinput
#endif
#define _gamechaos_stocks_client_included
#define GC_CLIENT_VERSION 0x01_00_00
#define GC_CLIENT_VERSION_STRING "1.0.0"
/**
* Credit: Don't remember.
* Removes a player's weapon from the specified slot.
*
* @param client Client index.
* @param slot Weapon slot.
* @return True if removed, false otherwise.
*/
stock bool GCRemoveWeaponBySlot(int client, int slot)
{
int entity = GetPlayerWeaponSlot(client, slot);
if (IsValidEdict(entity))
{
RemovePlayerItem(client, entity);
AcceptEntityInput(entity, "kill");
return true;
}
return false;
}
/**
* Checks if a client is valid and not the server and optionally, whether he's alive.
*
* @param client Client index.
* @param alive Whether to check alive.
* @return True if valid, false otherwise.
*/
stock bool GCIsValidClient(int client, bool alive = false)
{
return (client >= 1 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && !IsClientSourceTV(client) && (!alive || IsPlayerAlive(client)));
}
/**
* Gets the value of m_flForwardMove.
*
* @param client Client index.
* @return Value of m_flForwardMove.
*/
stock float GCGetClientForwardMove(int client)
{
return GetEntPropFloat(client, Prop_Data, "m_flForwardMove");
}
/**
* Gets the value of m_flSideMove.
*
* @param client Client index.
* @return Value of m_flSideMove.
*/
stock float GCGetClientSideMove(int client)
{
return GetEntPropFloat(client, Prop_Data, "m_flSideMove");
}
/**
* Gets the client's abs origin.
*
* @param client Client index.
* @return result Player's origin.
*/
stock float[] GCGetClientAbsOriginRet(int client)
{
float result[3]
GetClientAbsOrigin(client, result);
return result;
}
/**
* Copies the client's velocity to a vector.
*
* @param client Client index.
* @param result Resultant vector.
*/
stock void GCGetClientVelocity(int client, float result[3])
{
GetEntPropVector(client, Prop_Data, "m_vecVelocity", result);
}
/**
* Gets the client's velocity (m_vecVelocity).
*
* @param client Client index.
* @return result m_vecVelocity.
*/
stock float[] GCGetClientVelocityRet(int client)
{
float result[3]
GetEntPropVector(client, Prop_Data, "m_vecVelocity", result);
return result
}
/**
* Copies the client's basevelocity to a vector.
*
* @param client Client index.
* @param result Resultant vector.
*/
stock void GCGetClientBaseVelocity(int client, float result[3])
{
GetEntPropVector(client, Prop_Data, "m_vecBaseVelocity", result);
}
/**
* Gets the client's basevelocity (m_vecBaseVelocity).
*
* @param client Client index.
* @return result m_vecBaseVelocity.
*/
stock float[] GCGetClientBaseVelocityRet(int client)
{
float result[3];
GetEntPropVector(client, Prop_Data, "m_vecBaseVelocity", result);
return result;
}
/**
* Gets the client's "m_flDuckSpeed" value.
*
* @param client Client index.
* @return "m_flDuckSpeed".
*/
stock float GCGetClientDuckSpeed(int client)
{
return GetEntPropFloat(client, Prop_Send, "m_flDuckSpeed");
}
/**
* Gets the client's "m_flDuckAmount" value.
*
* @param client Client index.
* @return "m_flDuckAmount".
*/
stock float GCGetClientDuckAmount(int client)
{
return GetEntPropFloat(client, Prop_Send, "m_flDuckAmount");
}
/**
* Gets the client's "m_bDucking" value.
*
* @param client Client index.
* @return "m_bDucking".
*/
stock int GCGetClientDucking(int client)
{
return GetEntProp(client, Prop_Data, "m_bDucking");
}
/**
* Gets the client's "m_flMaxspeed" value.
*
* @param client Client index.
* @return "m_flMaxspeed".
*/
stock float GCGetClientMaxspeed(int client)
{
return GetEntPropFloat(client, Prop_Send, "m_flMaxspeed");
}
/**
* Gets the client's "m_afButtonPressed" value.
*
* @param client Client index.
* @return "m_afButtonPressed".
*/
stock int GCGetClientButtonPressed(int client)
{
return GetEntProp(client, Prop_Data, "m_afButtonPressed");
}
/**
* Gets the client's "m_afButtonReleased" value.
*
* @param client Client index.
* @return "m_afButtonReleased".
*/
stock int GCGetClientButtonReleased(int client)
{
return GetEntProp(client, Prop_Data, "m_afButtonReleased");
}
/**
* Gets the client's "m_afButtonLast" value.
*
* @param client Client index.
* @return "m_afButtonLast".
*/
stock int GCGetClientButtonLast(int client)
{
return GetEntProp(client, Prop_Data, "m_afButtonLast");
}
/**
* Gets the client's "m_afButtonForced" value.
*
* @param client Client index.
* @return "m_afButtonForced".
*/
stock int GCGetClientForcedButtons(int client)
{
return GetEntProp(client, Prop_Data, "m_afButtonForced");
}
/**
* Gets the client's "m_flStamina" value.
*
* @param client Client index.
* @return "m_flStamina".
*/
stock float GCGetClientStamina(int client)
{
return GetEntPropFloat(client, Prop_Send, "m_flStamina");
}
/**
* Sets the client's origin.
*
* @param client Client index.
* @param origin New origin.
*/
stock void GCSetClientAbsOrigin(int client, const float origin[3])
{
SetEntPropVector(client, Prop_Data, "m_vecAbsOrigin", origin);
}
/**
* Sets the client's velocity.
*
* @param client Client index.
* @param velocity New velocity.
*/
stock void GCSetClientVelocity(int client, const float velocity[3])
{
SetEntPropVector(client, Prop_Data, "m_vecVelocity", velocity);
}
/**
* Sets the client's "m_vecAbsVelocity".
*
* @param client Client index.
* @param velocity New "m_vecAbsVelocity".
*/
stock void GCSetClientAbsVelocity(int client, const float velocity[3])
{
SetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", velocity);
}
/**
* Sets the client's eye angles.
* Ang has to be a 2 member array or more
*
* @param client Client index.
* @param ang New eyeangles.
*/
stock void GCSetClientEyeAngles(int client, const float[] ang)
{
SetEntPropFloat(client, Prop_Send, "m_angEyeAngles[0]", ang[0]);
SetEntPropFloat(client, Prop_Send, "m_angEyeAngles[1]", ang[1]);
}
/**
* Sets the client's "m_flDuckSpeed".
*
* @param client Client index.
* @param value New "m_flDuckSpeed".
*/
stock void GCSetClientDuckSpeed(int client, float value)
{
SetEntPropFloat(client, Prop_Send, "m_flDuckSpeed", value);
}
stock void GCSetClientDuckAmount(int client, float value)
{
SetEntPropFloat(client, Prop_Send, "m_flDuckAmount", value);
}
stock void GCSetClientForcedButtons(int client, int buttons)
{
SetEntProp(client, Prop_Data, "m_afButtonForced", buttons);
}
stock void GCSetClientStamina(int client, float stamina)
{
SetEntPropFloat(client, Prop_Send, "m_flStamina", stamina)
}
|