This repository was archived by the owner on Jul 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdrop.sp
More file actions
54 lines (46 loc) · 1.27 KB
/
Copy pathdrop.sp
File metadata and controls
54 lines (46 loc) · 1.27 KB
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
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
public Plugin:myinfo =
{
name = "[INS] Drop Items",
author = "Neko-",
description = "Drop the weapon or item you are holding",
version = "1.0.0",
}
new const String:BlacklistWeaponNames[][] =
{
"weapon_kabar",
"weapon_gurkha",
"weapon_knife",
"weapon_kukri",
"weapon_katana"
}
public OnPluginStart()
{
RegConsoleCmd("drop", Drop_Stuff, "Drop the item in your hand");
}
public Action:Drop_Stuff(client,args)
{
new health = GetClientHealth(client);
if (health > 0)
{
new CurrentUserWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
if (CurrentUserWeapon < 0) {
return Plugin_Continue;
}
decl String:User_Weapon[32];
GetEdictClassname(CurrentUserWeapon, User_Weapon, sizeof(User_Weapon));
new AdminId:admin = GetUserAdmin(client);
for (new count=0; count<5; count++)
{
//If player not admin, prevent user from dropping knife
if (StrEqual(User_Weapon, BlacklistWeaponNames[count]) && (admin == INVALID_ADMIN_ID) && (GetAdminFlag(admin, Admin_Generic, Access_Effective) == false))
{
return Plugin_Continue;
}
}
SDKHooks_DropWeapon(client, CurrentUserWeapon, NULL_VECTOR, NULL_VECTOR);
}
return Plugin_Handled;
}