From c206ac30996c669d8e7b9c149f64a758bd55f214 Mon Sep 17 00:00:00 2001 From: Asher Baker Date: Sun, 6 Feb 2022 15:56:52 +0000 Subject: [PATCH] Fix FindSendPropOffs with SendPropArray props (#1708) FindSendPropOffs is deprecated and FindSendPropInfo behaves correctly here, but there are still a lot of old plugins using FindSendPropOffs. One of the SendPropArray props broken by the changes here is m_hViewModel which there are known plugins in the wild accessing. --- core/smn_entities.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/smn_entities.cpp b/core/smn_entities.cpp index eb8fb9f3..5e84755a 100644 --- a/core/smn_entities.cpp +++ b/core/smn_entities.cpp @@ -818,6 +818,12 @@ static cell_t FindSendPropOffs(IPluginContext *pContext, const cell_t *params) return -1; } + // Before we added support for DPT_Array props, FindInSendTable would have given us the inner array prop itself. + // To maintain compatibility with older plugins still using us, pluck out the inner array prop ourselves. + if (pSend->GetType() == DPT_Array && pSend->GetArrayProp()) { + return pSend->GetArrayProp()->GetOffset(); + } + return pSend->GetOffset(); }