diff --git a/scripting/tf2attribute_support.sp b/scripting/tf2attribute_support.sp index 38940c0..63403db 100644 --- a/scripting/tf2attribute_support.sp +++ b/scripting/tf2attribute_support.sp @@ -1151,8 +1151,11 @@ MRESReturn OnPlayerKilledPre(int client, Handle hParams) { int weapon = DHookGetParamObjectPtrVar(hParams, 1, offs_CTakeDamageInfo_hWeapon, ObjectValueType_Ehandle); - g_bShouldTurnToIce[client] = IsValidEntity(weapon) - && TF2Attrib_HookValueInt(0, "set_turn_to_ice", weapon); + if (!IsValidEntity(weapon) || !weapon) { + return MRES_Ignored; + } else if (TF2Util_IsEntityWeapon(weapon) || TF2Util_IsEntityWearable(weapon)) { + g_bShouldTurnToIce[client] = TF2Attrib_HookValueInt(0, "set_turn_to_ice", weapon) != 0; + } return MRES_Ignored; }