11
11
12
12
#include <stocksoup/memory>
13
13
14
- #define PLUGIN_VERSION " 0.9 .0"
14
+ #define PLUGIN_VERSION " 0.10 .0"
15
15
public Plugin myinfo = {
16
16
name = " TF2 Utils" ,
17
17
author = " nosoop" ,
@@ -34,6 +34,8 @@ Handle g_SDKCallWeaponGetSlot;
34
34
Handle g_SDKCallWeaponGetID ;
35
35
Handle g_SDKCallWeaponGetMaxClip ;
36
36
37
+ Handle g_SDKCallPointInRespawnRoom ;
38
+
37
39
Address offs_CTFPlayer_hMyWearables ;
38
40
39
41
public APLRes AskPluginLoad2 (Handle self , bool late , char [] error , int maxlen ) {
@@ -54,6 +56,8 @@ public APLRes AskPluginLoad2(Handle self, bool late, char[] error, int maxlen) {
54
56
55
57
CreateNative (" TF2Util_GetPlayerShootPosition" , Native_GetPlayerShootPosition );
56
58
59
+ CreateNative (" TF2Util_IsPointInRespawnRoom" , Native_IsPointInRespawnRoom );
60
+
57
61
return APLRes_Success ;
58
62
}
59
63
@@ -115,6 +119,14 @@ public void OnPluginStart() {
115
119
PrepSDKCall_SetReturnInfo (SDKType_PlainOldData , SDKPass_Plain );
116
120
g_SDKCallWeaponGetMaxClip = EndPrepSDKCall ();
117
121
122
+ StartPrepSDKCall (SDKCall_Static );
123
+ PrepSDKCall_SetFromConf (hGameConf , SDKConf_Signature , " PointInRespawnRoom()" );
124
+ PrepSDKCall_SetReturnInfo (SDKType_Bool , SDKPass_Plain );
125
+ PrepSDKCall_AddParameter (SDKType_CBaseEntity , SDKPass_Pointer , VDECODE_FLAG_ALLOWNULL );
126
+ PrepSDKCall_AddParameter (SDKType_Vector , SDKPass_ByRef );
127
+ PrepSDKCall_AddParameter (SDKType_Bool , SDKPass_Plain );
128
+ g_SDKCallPointInRespawnRoom = EndPrepSDKCall ();
129
+
118
130
// networked CUtlVector offset support landed in 1.11; try to locate an offset there first
119
131
offs_CTFPlayer_hMyWearables =
120
132
view_as <Address >(FindSendPropInfo (" CTFPlayer" , " m_hMyWearables" ));
@@ -284,6 +296,26 @@ public int Native_GetWeaponMaxClip(Handle plugin, int nParams) {
284
296
return SDKCall (g_SDKCallWeaponGetMaxClip , entity );
285
297
}
286
298
299
+ // bool(const float[3] position, int entity, bool bRestrictToSameTeam)
300
+ public int Native_IsPointInRespawnRoom (Handle plugin , int nParams ) {
301
+ if (IsNativeParamNullVector (1 )) {
302
+ return ThrowNativeError (SP_ERROR_NATIVE , " Cannot use NULL_VECTOR as origin" );
303
+ }
304
+
305
+ float origin [3 ];
306
+ GetNativeArray (1 , origin , sizeof (origin ));
307
+
308
+ int entity = GetNativeCell (2 );
309
+ if (entity != INVALID_ENT_REFERENCE && ! IsValidEntity (entity )) {
310
+ return ThrowNativeError (SP_ERROR_NATIVE , " Entity %d (%d ) is invalid" , entity ,
311
+ EntRefToEntIndex (entity ));
312
+ }
313
+
314
+ bool bRestrictToSameTeam = GetNativeCell (3 );
315
+
316
+ return SDKCall (g_SDKCallPointInRespawnRoom , entity , origin , bRestrictToSameTeam );
317
+ }
318
+
287
319
bool IsEntityWeapon (int entity ) {
288
320
if (! IsValidEntity (entity )) {
289
321
ThrowNativeError (SP_ERROR_NATIVE , " Entity %d (%d ) is invalid" , entity ,
0 commit comments