Skip to content

Commit be04177

Browse files
committed
Verify that wearables have been initialized before equipping
Other plugins ruin my day. Gonna need more coffee after this one. See nosoop/SM-TFCWXBaseAttributes#9.
1 parent 653a131 commit be04177

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scripting/tf2utils.sp

+8-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#include <stocksoup/memory>
1313

14-
#define PLUGIN_VERSION "0.14.0"
14+
#define PLUGIN_VERSION "0.14.1"
1515
public Plugin myinfo = {
1616
name = "TF2 Utils",
1717
author = "nosoop",
@@ -332,6 +332,13 @@ public int Native_EquipPlayerWearable(Handle plugin, int numParams) {
332332
ThrowNativeError(SP_ERROR_NATIVE, "Entity index %d is not a wearable",
333333
EntRefToEntIndex(wearable));
334334
}
335+
336+
if (GetEntPropEnt(wearable, Prop_Send, "m_hOuter") != wearable) {
337+
ThrowNativeError(SP_ERROR_NATIVE,
338+
"Wearable entity index %d is not initialized correctly - was it not spawned?",
339+
wearable);
340+
}
341+
335342
SDKCall(g_SDKCallPlayerEquipWearable, client, wearable);
336343

337344
if (GetEntPropEnt(wearable, Prop_Send, "m_hOwnerEntity") != client) {

0 commit comments

Comments
 (0)