1
- /* *
2
- * 1.1 添加了丢枪时速度的计算
3
- * 2.0 BOT被击中手臂会掉落武器
4
- * 2.1 修改了检测武器所在槽位的代码
5
- * 添加了输入命令后的反馈提示
6
- * 2.2 底层API改用拓展API
7
- **/
8
-
9
1
#pragma semicolon 1
10
2
#pragma newdecls required
11
3
15
7
16
8
#include "INSExtendAPI"
17
9
18
- #define PLUGIN_NAME " 扔枪增强版 "
19
- #define PLUGIN_AUTHOR " PakuPaku "
20
- #define PLUGIN_DESCRIPTION " 玩家可以扔枪 "
21
- #define PLUGIN_VERSION " 2.5 "
22
- #define PLUGIN_URL " https://github.com/TFXX "
10
+ #define PLUGIN_NAME " Drop Weapon "
11
+ #define PLUGIN_AUTHOR " "
12
+ #define PLUGIN_DESCRIPTION " allow client drop weapon "
13
+ #define PLUGIN_VERSION " "
14
+ #define PLUGIN_URL " "
23
15
24
16
public Plugin myinfo =
25
17
{
@@ -30,45 +22,17 @@ public Plugin myinfo =
30
22
url = PLUGIN_URL
31
23
};
32
24
33
- ConVar g_cvarLogged ;
34
-
35
25
public void OnPluginStart ()
36
- {
37
- PrintToServer (" %s V%s ]正在加载插件..." , PLUGIN_NAME , PLUGIN_VERSION );
38
-
39
- InitPluginConvars ();
40
- hook_events ();
41
- reg_cmds ();
42
-
43
- PrintToServer (" %s V%s ]插件加载完成!" , PLUGIN_NAME , PLUGIN_VERSION );
44
- }
45
-
46
- public void OnPluginEnd ()
47
- {
48
- unhook_events ();
49
- }
50
-
51
- void InitPluginConvars ()
52
- {
53
- g_cvarLogged = CreateConVar (" sm_drop_weapon_ex_logged" , " 0" , " 是否记录" , FCVAR_NONE );
54
- AutoExecConfig (true ," plugin.DropWeaponEx" );
55
- }
56
-
57
- void hook_events ()
58
26
{
59
27
HookEventEx (" player_hurt" , EVENT_POST_player_hurt , EventHookMode_Post );
28
+ RegConsoleCmd (" r" , CMD_drop_weapon );
60
29
}
61
30
62
- static void unhook_events ()
31
+ public void OnPluginEnd ()
63
32
{
64
33
UnhookEvent (" player_hurt" , EVENT_POST_player_hurt , EventHookMode_Post );
65
34
}
66
35
67
- static void reg_cmds ()
68
- {
69
- RegConsoleCmd (" r" , CMD_drop_weapon );
70
- }
71
-
72
36
Action CMD_drop_weapon (int client , int args )
73
37
{
74
38
if (! IsClientInGame (client ))
@@ -127,12 +91,5 @@ Action EVENT_POST_player_hurt(Handle event, const char[] name, bool dontBroadcas
127
91
}
128
92
129
93
SDKHooks_DropWeapon (client , weapon , NULL_VECTOR , NULL_VECTOR );
130
-
131
- if (g_cvarLogged .BoolValue )
132
- {
133
- char weaponName [32 ];
134
- GetEntityClassname (weapon , weaponName , 32 );
135
- PrintToServer (" %s V%s ]%N 被击中丢掉了枪%s (%d )" , PLUGIN_NAME , PLUGIN_VERSION , client , weaponName , weapon );
136
- }
137
94
return Plugin_Continue ;
138
95
}
0 commit comments