11
11
12
12
#include <stocksoup/memory>
13
13
14
- #define PLUGIN_VERSION " 0.7 .0"
14
+ #define PLUGIN_VERSION " 0.8 .0"
15
15
public Plugin myinfo = {
16
16
name = " TF2 Utils" ,
17
17
author = " nosoop" ,
@@ -31,6 +31,7 @@ Handle g_SDKCallPlayerSharedGetMaxHealth;
31
31
Handle g_SDKCallIsEntityWeapon ;
32
32
Handle g_SDKCallWeaponGetSlot ;
33
33
Handle g_SDKCallWeaponGetID ;
34
+ Handle g_SDKCallWeaponGetMaxClip ;
34
35
35
36
Address offs_CTFPlayer_hMyWearables ;
36
37
@@ -48,6 +49,7 @@ public APLRes AskPluginLoad2(Handle self, bool late, char[] error, int maxlen) {
48
49
CreateNative (" TF2Util_IsEntityWeapon" , Native_IsEntityWeapon );
49
50
CreateNative (" TF2Util_GetWeaponSlot" , Native_GetWeaponSlot );
50
51
CreateNative (" TF2Util_GetWeaponID" , Native_GetWeaponID );
52
+ CreateNative (" TF2Util_GetWeaponMaxClip" , Native_GetWeaponMaxClip );
51
53
52
54
return APLRes_Success ;
53
55
}
@@ -99,6 +101,11 @@ public void OnPluginStart() {
99
101
PrepSDKCall_SetReturnInfo (SDKType_PlainOldData , SDKPass_Plain );
100
102
g_SDKCallWeaponGetID = EndPrepSDKCall ();
101
103
104
+ StartPrepSDKCall (SDKCall_Entity );
105
+ PrepSDKCall_SetFromConf (hGameConf , SDKConf_Virtual , " CTFWeaponBase::GetMaxClip1()" );
106
+ PrepSDKCall_SetReturnInfo (SDKType_PlainOldData , SDKPass_Plain );
107
+ g_SDKCallWeaponGetMaxClip = EndPrepSDKCall ();
108
+
102
109
// networked CUtlVector offset support landed in 1.11; try to locate an offset there first
103
110
offs_CTFPlayer_hMyWearables =
104
111
view_as <Address >(FindSendPropInfo (" CTFPlayer" , " m_hMyWearables" ));
@@ -247,6 +254,16 @@ public int Native_GetWeaponID(Handle plugin, int nParams) {
247
254
return SDKCall (g_SDKCallWeaponGetID , entity );
248
255
}
249
256
257
+ // int(int entity);
258
+ public int Native_GetWeaponMaxClip (Handle plugin , int nParams ) {
259
+ int entity = GetNativeCell (1 );
260
+ if (! IsEntityWeapon (entity )) {
261
+ ThrowNativeError (SP_ERROR_NATIVE , " Entity index %d (%d ) is not a weapon" , entity ,
262
+ EntRefToEntIndex (entity ));
263
+ }
264
+ return SDKCall (g_SDKCallWeaponGetMaxClip , entity );
265
+ }
266
+
250
267
bool IsEntityWeapon (int entity ) {
251
268
if (! IsValidEntity (entity )) {
252
269
ThrowNativeError (SP_ERROR_NATIVE , " Entity %d (%d ) is invalid" , entity ,
0 commit comments