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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
#include <sourcemod>
#include <sdktools>
new g_iNextPAttO = -1;
new g_iVMStartTimeO = -1;
new g_iShotStartDurO = -1;
new g_iShotInsertDurO = -1;
new g_iShotEndDurO = -1;
new g_iPlayRateO = -1;
new g_iShotRelStateO = -1;
new g_iNextAttO = -1;
new g_iTimeIdleO = -1;
new g_iActiveWO = -1;
new g_iViewModelO = -1;
const Float: g_flSoHAutoS = 0.666666;
const Float: g_flSoHAutoI = 0.4;
const Float: g_flSoHAutoE = 0.675;
const Float: g_flSoHSpasS = 0.5;
const Float: g_flSoHSpasI = 0.375;
const Float: g_flSoHSpasE = 0.699999;
const Float: g_flSoHPumpS = 0.5;
const Float: g_flSoHPumpI = 0.5;
const Float: g_flSoHPumpE = 0.6;
new slaptimer[MAXPLAYERS+1] = 0;
new Float: hunmanspeed[MAXPLAYERS+1] = 1.0;
new bool: speedchange[MAXPLAYERS+1] = false;
new bool: weaponspeed[MAXPLAYERS+1] = false;
new bool: reloadspeed[MAXPLAYERS+1] = false;
new Handle: g_cvarevent_random = INVALID_HANDLE;
new Handle: g_cvarevent_1 = INVALID_HANDLE;
new Handle: g_cvarevent_2 = INVALID_HANDLE;
new Handle: g_cvarevent_3 = INVALID_HANDLE;
new Handle: g_cvarevent_4 = INVALID_HANDLE;
new Handle: g_cvarevent_5 = INVALID_HANDLE;
new Handle: g_cvarevent_6 = INVALID_HANDLE;
new Handle: g_cvarevent_7 = INVALID_HANDLE;
new Handle: g_cvarevent_8 = INVALID_HANDLE;
new Handle: g_cvarevent_9 = INVALID_HANDLE;
new Handle: g_cvarevent_10 = INVALID_HANDLE;
new Handle: g_cvarevent_11 = INVALID_HANDLE;
new Handle: g_cvarevent_12 = INVALID_HANDLE;
new Handle: g_cvarhpback = INVALID_HANDLE;
new Handle: g_cvarspeedupsp = INVALID_HANDLE;
new Handle: g_cvarspeeddownsp = INVALID_HANDLE;
new Handle: g_cvarspeedchangetimer = INVALID_HANDLE;
new Handle: g_cvarfreezetimer = INVALID_HANDLE;
new Handle: g_cvargodtimer = INVALID_HANDLE;
new Handle: g_cvarslaptimer = INVALID_HANDLE;
new Handle: g_cvarweaponspeeduptimer = INVALID_HANDLE;
new Handle: g_cvarreloadspeeduptimer = INVALID_HANDLE;
new Handle: g_cvarweaponspeedupsp = INVALID_HANDLE;
new Handle: g_cvarreloadspeedupsp = INVALID_HANDLE;
//插件信息
public Plugin:myinfo =
{
name = "服用药丸/服用肾上腺/拉人/电起队友/帮队友打包触发RP事件",
author = "非本龟",
description = "救援副作用",
version = "0.0.2",
url = "http://bbs.jumpgame.net",
};
//设置CFG选项
public OnPluginStart()
{
g_cvarevent_random = CreateConVar("sm_drug_used_event_random", "35", "触发救援副作用的概率(0~100)");
g_cvarevent_1 = CreateConVar("sm_drug_used_event_1", "1", "救援副作用是否允许事件回血");
g_cvarevent_2 = CreateConVar("sm_drug_used_event_2", "1", "救援副作用是否允许事件加速");
g_cvarevent_3 = CreateConVar("sm_drug_used_event_3", "1", "救援副作用是否允许事件减速");
g_cvarevent_4 = CreateConVar("sm_drug_used_event_4", "1", "救援副作用是否允许事件冰冻");
g_cvarevent_5 = CreateConVar("sm_drug_used_event_5", "1", "救援副作用是否允许事件眩晕");
g_cvarevent_6 = CreateConVar("sm_drug_used_event_6", "1", "救援副作用是否允许事件亮灯");
g_cvarevent_7 = CreateConVar("sm_drug_used_event_7", "1", "救援副作用是否允许事件无敌");
g_cvarevent_8 = CreateConVar("sm_drug_used_event_8", "1", "救援副作用是否允许事件拍打");
g_cvarevent_9 = CreateConVar("sm_drug_used_event_9", "1", "救援副作用是否允许事件获得燃烧弹");
g_cvarevent_10 = CreateConVar("sm_drug_used_event_10", "1", "救援副作用是否允许事件获得高爆弹");
g_cvarevent_11 = CreateConVar("sm_drug_used_event_11", "1", "救援副作用是否允许事件武器攻击速度提升");
g_cvarevent_12 = CreateConVar("sm_drug_used_event_12", "1", "救援副作用是否允许事件武器上弹速度提升");

g_cvarhpback = CreateConVar("sm_drug_used_event_hpback", "40", "救援副作用回血的血量");
g_cvarspeedupsp = CreateConVar("sm_drug_used_event_speedupsp", "1.3", "救援副作用加速的速度");
g_cvarspeeddownsp = CreateConVar("sm_drug_used_event_speeddownsp", "0.7", "救援副作用减速的速度");
g_cvarspeedchangetimer = CreateConVar("sm_drug_used_event_speedchangetimer", "20.0", "救援副作用速度改变的时间");
g_cvarfreezetimer = CreateConVar("sm_drug_used_event_freezetimer", "7", "救援副作用冰冻的时间");
g_cvargodtimer = CreateConVar("sm_drug_used_event_godtimer", "20.0", "救援副作用无敌的时间");
g_cvarslaptimer = CreateConVar("sm_drug_used_event_slaptimer", "5", "救援副作用拍打的时间");
g_cvarweaponspeeduptimer = CreateConVar("sm_drug_used_event_weaponspeeduptimer", "30.0", "救援副作用武器攻击速度提升时间");
g_cvarreloadspeeduptimer = CreateConVar("sm_drug_used_event_reloadspeeduptimer", "30.0", "救援副作用武器上弹速度提升时间");
g_cvarweaponspeedupsp = CreateConVar("sm_drug_used_event_weaponspeedupsp", "1.2", "救援副作用武器攻击的速度");
g_cvarreloadspeedupsp = CreateConVar("sm_drug_used_event_reloadspeedupsp", "0.5", "救援副作用武器上弹的速度");
AutoExecConfig(true, "rescued_rp_event_0_0_2");

HookEvents();

g_iNextPAttO = FindSendPropInfo("CBaseCombatWeapon","m_flNextPrimaryAttack");
g_iShotStartDurO = FindSendPropInfo("CBaseShotgun","m_reloadStartDuration");
g_iShotInsertDurO = FindSendPropInfo("CBaseShotgun","m_reloadInsertDuration");
g_iShotEndDurO = FindSendPropInfo("CBaseShotgun","m_reloadEndDuration");
g_iPlayRateO = FindSendPropInfo("CBaseCombatWeapon","m_flPlaybackRate");
g_iShotRelStateO = FindSendPropInfo("CBaseShotgun","m_reloadState");
g_iNextAttO = FindSendPropInfo("CTerrorPlayer","m_flNextAttack");
g_iTimeIdleO = FindSendPropInfo("CTerrorGun","m_flTimeWeaponIdle");
g_iVMStartTimeO = FindSendPropInfo("CTerrorViewModel","m_flLayerStartTime");
g_iActiveWO = FindSendPropInfo("CBaseCombatCharacter","m_hActiveWeapon");
g_iViewModelO = FindSendPropInfo("CTerrorPlayer","m_hViewModel");
}
//定义事件
HookEvents()
{
HookEvent("heal_success", Event_Rescued_RP);
HookEvent("adrenaline_used", Event_Rescued_RP);
HookEvent("pills_used", Event_Rescued_RP);
HookEvent("defibrillator_used", Event_Rescued_RP);
HookEvent("revive_success", Event_Rescued_RP);
HookEvent("weapon_reload", Event_Reload);
}
//药物副作用事件
public Action:Event_Rescued_RP(Handle:event, String:event_name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if(!client || !IsClientInGame(client) || !IsPlayerAlive(client) || IsFakeClient(client)) return;
new random = GetRandomInt(1, 100);
if(GetConVarInt(g_cvarevent_random) >= random)
{
new rp = GetRandomInt(0, 11);
switch(rp)
{
case 0:
{
if(GetConVarInt(g_cvarevent_1))
{
if(!GetEntProp(client, Prop_Send, "m_isIncapacitated"))
{
SetEntProp(client,Prop_Send,"m_iHealth",GetEntProp(client,Prop_Send,"m_iHealth") + GetConVarInt(g_cvarhpback));
PrintToChat(client,"*你引发了救援的副作用:回血%d.", GetConVarInt(g_cvarhpback));
}
}
}
case 1:
{
if(GetConVarInt(g_cvarevent_2) && speedchange[client] == false)
{
speedchange[client] = true;
hunmanspeed[client] = GetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue");
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", GetConVarFloat(g_cvarspeedupsp) * hunmanspeed[client]);
PrintToChat(client,"*你引发了救援的副作用:速度加快%d秒.", GetConVarInt(g_cvarspeedchangetimer));
CreateTimer(GetConVarFloat(g_cvarspeedchangetimer), Event_Speed_End, client);
}
}
case 2:
{
if(GetConVarInt(g_cvarevent_3) && speedchange[client] == false)
{
speedchange[client] = true;
hunmanspeed[client] = GetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue");
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", GetConVarFloat(g_cvarspeeddownsp) * hunmanspeed[client]);
PrintToChat(client,"*你引发了救援的副作用:速度减慢%d秒.", GetConVarInt(g_cvarspeedchangetimer));
CreateTimer(GetConVarFloat(g_cvarspeedchangetimer), Event_Speed_End, client);
}
}
case 3:
{
if(GetConVarInt(g_cvarevent_4))
{
ServerCommand("sm_freeze \"%N\" \"%d\"",client,GetConVarInt(g_cvarfreezetimer));
PrintToChat(client,"*你引发了救援的副作用:冰冻%d秒.", GetConVarInt(g_cvarfreezetimer));
PrintToChatAll("\x05【%N】\x04 触发了牛逼的副作用:\x03冰冻%d秒", client), GetConVarInt(g_cvarfreezetimer);
}
}
case 4:
{
if(GetConVarInt(g_cvarevent_5))
{
ServerCommand("sm_drug \"%N\" \"10\"",client);
PrintToChat(client,"*你引发了救援的副作用:眩晕.");
PrintToChatAll("\x05【%N】\x04 触发了牛逼的副作用:\x03眩晕", client);
}
}
case 5:
{
if(GetConVarInt(g_cvarevent_6))
{
ServerCommand("sm_beacon \"%N\"",client);
ServerCommand("sm_beacon_radius \"80\"");
PrintToChat(client,"*你引发了救援的副作用:亮灯.");
PrintToChatAll("\x05【%N】\x04 触发了牛逼的副作用:\x03亮灯", client);
}
}
case 6:
{
if(GetConVarInt(g_cvarevent_7))
{
SetEntProp(client, Prop_Data, "m_takedamage", 0, 1);
PrintToChat(client,"*你引发了救援的副作用:无敌%d秒.", GetConVarInt(g_cvargodtimer));
PrintToChatAll("\x05【%N】\x04 触发了牛逼的副作用:\x03无敌%d秒", client, GetConVarInt(g_cvargodtimer));
CreateTimer(GetConVarFloat(g_cvargodtimer), Event_God_End, client);
}
}
case 7:
{
if(GetConVarInt(g_cvarevent_8))
{
slaptimer[client] = GetConVarInt(g_cvarslaptimer);
ServerCommand("sm_slap \"%N\" \"1\"",client);
PrintToChat(client,"*你引发了救援的副作用:拍打%d秒.", GetConVarInt(g_cvarslaptimer));
CreateTimer(1.0, Event_Slap, client);
}
}
case 8:
{
if(GetConVarInt(g_cvarevent_9))
{
CheatCommand(client, "upgrade_add", "INCENDIARY_AMMO");
PrintToChat(client,"*你引发了救援的副作用:获得燃烧弹.");
}
}
case 9:
{
if(GetConVarInt(g_cvarevent_10))
{
CheatCommand(client, "upgrade_add", "EXPLOSIVE_AMMO");
PrintToChat(client,"*你引发了救援的副作用:获得高爆弹.");
}
}
case 10:
{
if(GetConVarInt(g_cvarevent_11))
{
weaponspeed[client] = true;
PrintToChat(client,"*你引发了救援的副作用:武器攻击速度上升%d秒.", GetConVarInt(g_cvarweaponspeeduptimer));
CreateTimer(GetConVarFloat(g_cvarweaponspeeduptimer), Event_Weapon_Speed_Up_End, client);
}
}
case 11:
{
if(GetConVarInt(g_cvarevent_12))
{
reloadspeed[client] = true;
PrintToChat(client,"*你引发了救援的副作用:武器上弹速度上升%d秒.", GetConVarInt(g_cvarreloadspeeduptimer));
CreateTimer(GetConVarFloat(g_cvarreloadspeeduptimer), Event_Reload_Speed_Up_End, client);
}
}
}
}
}
//武器攻击速度和上弹速度
public Event_Reload(Handle:event, const String:name[], bool:dontBroadcast)
{
new iCid = GetClientOfUserId(GetEventInt(event, "userid"));
if(iCid == 0) return;
if(reloadspeed[iCid] == true) SoH_OnReload(iCid);
}
SoH_OnReload(iCid)
{
if(GetClientTeam(iCid) == 2)
{
new iEntid = GetEntDataEnt2(iCid,g_iActiveWO);
if (IsValidEntity(iEntid) == false) return;
decl String:stClass[32];
GetEntityNetClass(iEntid,stClass,32);
if(StrContains(stClass,"shotgun",false) == -1)
{
SoH_MagStart(iEntid,iCid);
return;
}
else if(StrContains(stClass,"autoshotgun",false) != -1)
{
new Handle:hPack = CreateDataPack();
WritePackCell(hPack, iCid);
WritePackCell(hPack, iEntid);
CreateTimer(0.1,SoH_AutoshotgunStart,hPack);
return;
}
else if(StrContains(stClass,"shotgun_spas",false) != -1)
{
new Handle:hPack = CreateDataPack();
WritePackCell(hPack, iCid);
WritePackCell(hPack, iEntid);
CreateTimer(0.1,SoH_SpasShotgunStart,hPack);
return;
}
else if(StrContains(stClass,"pumpshotgun",false) != -1 || StrContains(stClass,"shotgun_chrome",false) != -1)
{
new Handle:hPack = CreateDataPack();
WritePackCell(hPack, iCid);
WritePackCell(hPack, iEntid);
CreateTimer(0.1,SoH_PumpshotgunStart,hPack);
return;
}
}
}
SoH_MagStart(iEntid, iCid)
{
new Float:flGameTime = GetGameTime();
new Float:flNextTime_ret = GetEntDataFloat(iEntid,g_iNextPAttO);
new Float:flNextTime_calc = (flNextTime_ret - flGameTime) * GetConVarFloat(g_cvarreloadspeedupsp);
SetEntDataFloat(iEntid, g_iPlayRateO, 1.0/GetConVarFloat(g_cvarreloadspeedupsp), true);
CreateTimer(flNextTime_calc, SoH_MagEnd, iEntid);
new Handle:hPack = CreateDataPack();
WritePackCell(hPack, iCid);
new Float:flStartTime_calc = flGameTime - (flNextTime_ret - flGameTime) * (1 - GetConVarFloat(g_cvarreloadspeedupsp)) ;
WritePackFloat(hPack, flStartTime_calc);
if((flNextTime_calc - 0.4) > 0) CreateTimer(flNextTime_calc - 0.4, SoH_MagEnd2, hPack);
flNextTime_calc += flGameTime;
SetEntDataFloat(iEntid, g_iTimeIdleO, flNextTime_calc, true);
SetEntDataFloat(iEntid, g_iNextPAttO, flNextTime_calc, true);
SetEntDataFloat(iCid, g_iNextAttO, flNextTime_calc, true);
}
public Action:SoH_AutoshotgunStart(Handle:timer, Handle:hPack)
{
KillTimer(timer);
if(IsServerProcessing() == false) return Plugin_Stop;
ResetPack(hPack);
new iCid = ReadPackCell(hPack);
new iEntid = ReadPackCell(hPack);
CloseHandle(hPack);
hPack = CreateDataPack();
WritePackCell(hPack, iCid);
WritePackCell(hPack, iEntid);
if(iCid <= 0
|| iEntid <= 0
|| IsValidEntity(iCid) == false
|| IsValidEntity(iEntid) == false
|| IsClientInGame(iCid) == false)
return Plugin_Stop;

SetEntDataFloat(iEntid, g_iShotStartDurO, g_flSoHAutoS*GetConVarFloat(g_cvarreloadspeedupsp), true);
SetEntDataFloat(iEntid, g_iShotInsertDurO, g_flSoHAutoI*GetConVarFloat(g_cvarreloadspeedupsp), true);
SetEntDataFloat(iEntid, g_iShotEndDurO, g_flSoHAutoE*GetConVarFloat(g_cvarreloadspeedupsp), true);
SetEntDataFloat(iEntid, g_iPlayRateO, 1.0/GetConVarFloat(g_cvarreloadspeedupsp), true);
CreateTimer(0.3,SoH_ShotgunEnd,hPack,TIMER_REPEAT);
return Plugin_Stop;
}
public Action:SoH_SpasShotgunStart(Handle:timer, Handle:hPack)
{
KillTimer(timer);
if(IsServerProcessing()==false) return Plugin_Stop;
ResetPack(hPack);
new iCid = ReadPackCell(hPack);
new iEntid = ReadPackCell(hPack);
CloseHandle(hPack);
hPack = CreateDataPack();
WritePackCell(hPack, iCid);
WritePackCell(hPack, iEntid);
if(iCid <= 0
|| iEntid <= 0
|| IsValidEntity(iCid)==false
|| IsValidEntity(iEntid)==false
|| IsClientInGame(iCid)==false)
return Plugin_Stop;

SetEntDataFloat(iEntid, g_iShotStartDurO, g_flSoHSpasS*GetConVarFloat(g_cvarreloadspeedupsp), true);
SetEntDataFloat(iEntid, g_iShotInsertDurO, g_flSoHSpasI*GetConVarFloat(g_cvarreloadspeedupsp), true);
SetEntDataFloat(iEntid, g_iShotEndDurO, g_flSoHSpasE*GetConVarFloat(g_cvarreloadspeedupsp), true);
SetEntDataFloat(iEntid, g_iPlayRateO, 1.0/GetConVarFloat(g_cvarreloadspeedupsp), true);
CreateTimer(0.3,SoH_ShotgunEnd,hPack,TIMER_REPEAT);
return Plugin_Stop;
}
public Action:SoH_PumpshotgunStart(Handle:timer, Handle:hPack)
{
KillTimer(timer);
if(IsServerProcessing() == false) return Plugin_Stop;
ResetPack(hPack);
new iCid = ReadPackCell(hPack);
new iEntid = ReadPackCell(hPack);
CloseHandle(hPack);
hPack = CreateDataPack();
WritePackCell(hPack, iCid);
WritePackCell(hPack, iEntid);
if(iCid <= 0
|| iEntid <= 0
|| IsValidEntity(iCid)==false
|| IsValidEntity(iEntid)==false
|| IsClientInGame(iCid)==false)
return Plugin_Stop;
SetEntDataFloat(iEntid, g_iShotStartDurO, g_flSoHPumpS*GetConVarFloat(g_cvarreloadspeedupsp), true);
SetEntDataFloat(iEntid, g_iShotInsertDurO, g_flSoHPumpI*GetConVarFloat(g_cvarreloadspeedupsp), true);
SetEntDataFloat(iEntid, g_iShotEndDurO, g_flSoHPumpE*GetConVarFloat(g_cvarreloadspeedupsp), true);
SetEntDataFloat(iEntid, g_iPlayRateO, 1.0/GetConVarFloat(g_cvarreloadspeedupsp), true);
CreateTimer(0.3,SoH_ShotgunEnd,hPack,TIMER_REPEAT);
return Plugin_Stop;
}
public Action:SoH_MagEnd(Handle:timer, any:iEntid)
{
KillTimer(timer);
if(IsServerProcessing() == false) return Plugin_Stop;
if(iEntid <= 0 || IsValidEntity(iEntid) == false) return Plugin_Stop;
SetEntDataFloat(iEntid, g_iPlayRateO, 1.0, true);
return Plugin_Stop;
}
public Action:SoH_MagEnd2(Handle:timer, Handle:hPack)
{
KillTimer(timer);
if(IsServerProcessing() == false)
{
CloseHandle(hPack);
return Plugin_Stop;
}
ResetPack(hPack);
new iCid = ReadPackCell(hPack);
new Float:flStartTime_calc = ReadPackFloat(hPack);
CloseHandle(hPack);
if(iCid <= 0
|| IsValidEntity(iCid)==false
|| IsClientInGame(iCid)==false)
return Plugin_Stop;

new iVMid = GetEntDataEnt2(iCid,g_iViewModelO);
SetEntDataFloat(iVMid, g_iVMStartTimeO, flStartTime_calc, true);
return Plugin_Stop;
}
public Action:SoH_ShotgunEnd (Handle:timer, Handle:hPack)
{
ResetPack(hPack);
new iCid = ReadPackCell(hPack);
new iEntid = ReadPackCell(hPack);
if(IsServerProcessing() == false
|| iCid <= 0
|| iEntid <= 0
|| IsValidEntity(iCid) == false
|| IsValidEntity(iEntid) == false
|| IsClientInGame(iCid) == false)
{
KillTimer(timer);
return Plugin_Stop;
}
if (GetEntData(iEntid,g_iShotRelStateO) == 0)
{
SetEntDataFloat(iEntid, g_iPlayRateO, 1.0, true);
new Float:flTime = GetGameTime() + 0.2;
SetEntDataFloat(iCid, g_iNextAttO, flTime, true);
SetEntDataFloat(iEntid, g_iTimeIdleO, flTime, true);
SetEntDataFloat(iEntid, g_iNextPAttO, flTime, true);
KillTimer(timer);
CloseHandle(hPack);
return Plugin_Stop;
}
return Plugin_Continue;
}
public Action:SoH_ShotgunEndCock (Handle:timer, any:hPack)
{
ResetPack(hPack);
new iCid = ReadPackCell(hPack);
new iEntid = ReadPackCell(hPack);
if(IsServerProcessing() == false
|| iCid <= 0
|| iEntid <= 0
|| IsValidEntity(iCid) == false
|| IsValidEntity(iEntid) == false
|| IsClientInGame(iCid) == false)
{
KillTimer(timer);
return Plugin_Stop;
}
if(GetEntData(iEntid,g_iShotRelStateO) == 0)
{
SetEntDataFloat(iEntid, g_iPlayRateO, 1.0, true);
new Float:flTime = GetGameTime() + 1.0;
SetEntDataFloat(iCid, g_iNextAttO, flTime, true);
SetEntDataFloat(iEntid, g_iTimeIdleO, flTime, true);
SetEntDataFloat(iEntid, g_iNextPAttO, flTime, true);
KillTimer(timer);
CloseHandle(hPack);
return Plugin_Stop;
}
return Plugin_Continue;
}
public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
if(IsClientInGame(client) && !IsFakeClient(client) && IsPlayerAlive(client) && GetClientTeam(client) == 2 && weaponspeed[client] == true)
{
if(buttons & IN_ATTACK || buttons & IN_ATTACK2)
{
new String:name[64];
GetClientWeapon(client, name, sizeof(name));
if(StrEqual(name, "weapon_smg") || StrEqual(name, "weapon_smg_silenced") || StrEqual(name, "weapon_smg_mp5")
|| StrEqual(name, "weapon_rifle") || StrEqual(name, "weapon_rifle_sg552") || StrEqual(name, "weapon_rifle_ak47")
|| StrEqual(name, "weapon_autoshotgun") || StrEqual(name, "weapon_shotgun_spas") || StrEqual(name, "weapon_rifle_m60")
|| StrEqual(name, "weapon_sniper_awp") || StrEqual(name, "weapon_sniper_military") || StrEqual(name, "weapon_sniper_scout")
|| StrEqual(name, "weapon_hunting_rifle") || StrEqual(name, "weapon_pumpshotgun") || StrEqual(name, "weapon_shotgun_chrome"))
{
AdjustWeaponSpeed(client, GetConVarFloat(g_cvarweaponspeedupsp), 0);
}
else if(StrEqual(name, "weapon_melee"))
{
AdjustWeaponSpeed(client, GetConVarFloat(g_cvarweaponspeedupsp), 1);
}
}
}
return Plugin_Continue;
}
stock AdjustWeaponSpeed(client, Float:Amount, slot)
{
if(GetPlayerWeaponSlot(client, slot) > 0)
{
new Float:m_flNextPrimaryAttack = GetEntPropFloat(GetPlayerWeaponSlot(client, slot), Prop_Send, "m_flNextPrimaryAttack");
new Float:m_flNextSecondaryAttack = GetEntPropFloat(GetPlayerWeaponSlot(client, slot), Prop_Send, "m_flNextSecondaryAttack");
new Float:m_flCycle = GetEntPropFloat(GetPlayerWeaponSlot(client, slot), Prop_Send, "m_flCycle");
new m_bInReload = GetEntProp(GetPlayerWeaponSlot(client, slot), Prop_Send, "m_bInReload");
if(m_flCycle == 0.000000 && m_bInReload < 1)
{
SetEntPropFloat(GetPlayerWeaponSlot(client, slot), Prop_Send, "m_flPlaybackRate", Amount);
SetEntPropFloat(GetPlayerWeaponSlot(client, slot), Prop_Send, "m_flNextPrimaryAttack", m_flNextPrimaryAttack - ((Amount - 1.0) / 2));
SetEntPropFloat(GetPlayerWeaponSlot(client, slot), Prop_Send, "m_flNextSecondaryAttack", m_flNextSecondaryAttack - ((Amount - 1.0) / 2));
}
}
}
//结束事件
public Action:Event_Speed_End(Handle:timer, any:client)
{
speedchange[client] = false;
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", hunmanspeed[client]);
PrintToChat(client,"*救援的副作用速度改变事件结束.");
}
public Action:Event_God_End(Handle:timer, any:client)
{
SetEntProp(client, Prop_Data, "m_takedamage", 2, 1);
PrintToChat(client,"*救援的副作用无敌事件结束.");
}
public Action:Event_Slap(Handle:timer, any:client)
{
if(slaptimer[client] > 0)
{
slaptimer[client] --;
ServerCommand("sm_slap \"%N\" \"1\"",client);
CreateTimer(1.0, Event_Slap, client);
}
else PrintToChat(client,"*救援的副作用拍打事件结束.");
}
public Action:Event_Weapon_Speed_Up_End(Handle:timer, any:client)
{
weaponspeed[client] = false;
PrintToChat(client,"*救援的副作用武器攻击速度加快事件结束.");
}
public Action:Event_Reload_Speed_Up_End(Handle:timer, any:client)
{
reloadspeed[client] = false;
PrintToChat(client,"*救援的副作用武器上弹速度加快事件结束.");
}
//作弊指令
stock CheatCommand(Client, const String:command[], const String:arguments[])
{
if (!Client) return;
new admindata = GetUserFlagBits(Client);
SetUserFlagBits(Client, ADMFLAG_ROOT);
new flags = GetCommandFlags(command);
SetCommandFlags(command, flags & ~FCVAR_CHEAT);
FakeClientCommand(Client, "%s %s", command, arguments);
SetCommandFlags(command, flags);
SetUserFlagBits(Client, admindata);
}