From 9f3584a05670286713475417f11f44bd03b0d842 Mon Sep 17 00:00:00 2001 From: 1mpulse <34376386+1mpulse@users.noreply.github.com> Date: Sat, 1 Jun 2024 16:57:07 +0300 Subject: [PATCH] fix VDECODE_FLAG_ALLOWNOTINGAME flag (#2000) Corrects the check for the VDECODE_FLAG_ALLOWNOTINGAME flag --- extensions/sdktools/vdecoder.cpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/extensions/sdktools/vdecoder.cpp b/extensions/sdktools/vdecoder.cpp index 7bdf2ef0..881fa667 100644 --- a/extensions/sdktools/vdecoder.cpp +++ b/extensions/sdktools/vdecoder.cpp @@ -396,15 +396,17 @@ DataStatus DecodeValveParam(IPluginContext *pContext, if (index >= 1 && index <= playerhelpers->GetMaxClients()) { IGamePlayer *player = playerhelpers->GetGamePlayer(index); - if ((data->decflags & VDECODE_FLAG_ALLOWNOTINGAME) - && !player->IsConnected()) - { + + if(!player->IsConnected()) { pContext->ThrowNativeError("Client %d is not connected", param); return Data_Fail; - } else if (!player->IsInGame()) { + } + + if(!(data->decflags & VDECODE_FLAG_ALLOWNOTINGAME) && !player->IsInGame()) { pContext->ThrowNativeError("Client %d is not in game", param); return Data_Fail; } + pEntity = gamehelpers->ReferenceToEntity(param); } else if (param == -1) { if (data->decflags & VDECODE_FLAG_ALLOWNULL) @@ -441,15 +443,17 @@ DataStatus DecodeValveParam(IPluginContext *pContext, if (index >= 1 && index <= playerhelpers->GetMaxClients()) { IGamePlayer *player = playerhelpers->GetGamePlayer(index); - if ((data->decflags & VDECODE_FLAG_ALLOWNOTINGAME) - && !player->IsConnected()) - { + + if(!player->IsConnected()) { pContext->ThrowNativeError("Client %d is not connected", param); return Data_Fail; - } else if (!player->IsInGame()) { + } + + if(!(data->decflags & VDECODE_FLAG_ALLOWNOTINGAME) && !player->IsInGame()) { pContext->ThrowNativeError("Client %d is not in game", param); return Data_Fail; } + pEntity = gamehelpers->ReferenceToEntity(param); } else if (param == -1) { if (data->decflags & VDECODE_FLAG_ALLOWNULL) @@ -493,15 +497,17 @@ DataStatus DecodeValveParam(IPluginContext *pContext, if (param >= 1 && param <= playerhelpers->GetMaxClients()) { IGamePlayer *player = playerhelpers->GetGamePlayer(param); - if ((data->decflags & VDECODE_FLAG_ALLOWNOTINGAME) - && !player->IsConnected()) - { + + if(!player->IsConnected()) { pContext->ThrowNativeError("Client %d is not connected", param); return Data_Fail; - } else if (!player->IsInGame()) { + } + + if(!(data->decflags & VDECODE_FLAG_ALLOWNOTINGAME) && !player->IsInGame()) { pContext->ThrowNativeError("Client %d is not in game", param); return Data_Fail; } + pEdict = player->GetEdict(); } else if (param == -1) { if (data->decflags & VDECODE_FLAG_ALLOWNULL)