diff --git a/modules/cstrike/cstrike/CstrikeNatives.cpp b/modules/cstrike/cstrike/CstrikeNatives.cpp index c2c65724..bc2a1d02 100644 --- a/modules/cstrike/cstrike/CstrikeNatives.cpp +++ b/modules/cstrike/cstrike/CstrikeNatives.cpp @@ -1953,11 +1953,20 @@ static cell AMX_NATIVE_CALL cs_get_user_weapon_entity(AMX *amx, cell *params) GET_OFFSET("CBasePlayerItem", m_pNext); int playerIndex = params[1]; - int weaponIndex = params[2]; CHECK_PLAYER(playerIndex); edict_t *pPlayer = MF_GetPlayerEdict(playerIndex); + int paramsCount = *params / sizeof(cell), weaponIndex; + if (paramsCount == 1) + { + weaponIndex = CSW_NONE; + } + else + { + weaponIndex = params[2]; + } + int weaponEntIndex = -1; if (weaponIndex == CSW_NONE) { @@ -1987,7 +1996,6 @@ static cell AMX_NATIVE_CALL cs_get_user_weapon_entity(AMX *amx, cell *params) } pWeapon = TypeConversion.cbase_to_edict(get_pdata(pWeapon, m_pNext)); - } if (foundWeapon)