-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfixbombs.sp
88 lines (75 loc) · 1.68 KB
/
fixbombs.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
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
//#include <smlib>
#pragma semicolon 1
#pragma newdecls required
public void OnPluginStart()
{
HookEvent("player_hurt", Event_PlayerHurt);
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i))
{
OnClientPutInServer(i);
}
}
}
public void OnClientPutInServer(int client)
{
SDKHook(client, SDKHook_WeaponCanUse, OnWeaponCanUse);
}
public void OnClientDisconnect(int client)
{
SDKUnhook(client, SDKHook_WeaponCanUse, OnWeaponCanUse);
}
public Action Event_PlayerHurt(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
if (GetClientHealth(client) >= 1)
{
// We only want dead people before death event fires
return Plugin_Continue;
}
int iWeapon = GetPlayerWeaponSlot(client, 4);
if (iWeapon != -1)
{
CS_DropWeapon(client, iWeapon, true, false);
}
return Plugin_Continue;
}
public Action OnWeaponCanUse(int client, int weapon)
{
if(!IsClientInGame(client))
{
return Plugin_Continue;
}
if (!IsPlayerAlive(client))
{
return Plugin_Stop;
}
char sWeapon[32];
GetEntityClassname(weapon, sWeapon, sizeof(sWeapon));
if(StrEqual(sWeapon[7], "c4") && GetPlayerWeaponSlot(client, 4) != -1)
{
return Plugin_Stop;
}
/*if (HasWeapon(client, sWeapon))
{
return Plugin_Stop;
}*/
return Plugin_Continue;
}
/*public bool HasWeapon(int client, char[] searchWeapon)
{
//Client_HasWeapon can replace
new String:szWeapon[32];
LOOP_CLIENTWEAPONS(client, weapon, index) {
GetEntityClassname(weapon, szWeapon, sizeof(szWeapon));
if (StrEqual(searchWeapon, szWeapon, false) == true) {
return true;
}
}
return false;
}*/