From b04498cddb4c3bdf8cd425eb9829cf7a8d6bb71c Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 17 Aug 2005 17:32:51 +0000 Subject: [PATCH] Experimental fix for bug at16815 (karlos) --- amxmodx/amxmodx.cpp | 19 ++++++++++++++----- amxmodx/emsg.cpp | 11 ----------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index 6b8b1af3..31150b16 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -515,8 +515,10 @@ static cell AMX_NATIVE_CALL get_user_weapons(AMX *amx, cell *params) /* 3 param cell *cpIds = get_amxaddr(amx,params[2]); *cpIds = 0; int weapons = pPlayer->pEdict->v.weapons & ~(1<<31); // don't count last element - for(int i = 1; i < MAX_WEAPONS; ++i){ - if (weapons & (1< gpGlobals->maxClients){ + if (index < 1 || index > gpGlobals->maxClients) + { LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); return 0; } CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); - if (pPlayer->ingame){ - int wpn = pPlayer->current; + if (pPlayer->ingame) + { + int wpn = pPlayer->current; + if ( !(pPlayer->pEdict->v.weapons & (1<current = 0; + return 0; + } cell *cpTemp = get_amxaddr(amx,params[2]); *cpTemp = pPlayer->weapons[wpn].clip; cpTemp = get_amxaddr(amx,params[3]); diff --git a/amxmodx/emsg.cpp b/amxmodx/emsg.cpp index ec8223d4..fbf3c35f 100755 --- a/amxmodx/emsg.cpp +++ b/amxmodx/emsg.cpp @@ -153,17 +153,6 @@ void Client_WeaponList(void* mValue) break; case 7: int iId = *(int*)mValue; - /*int* blocker; - - int iwpn = iId; - - if (iId > 31) { - iwpn -= 31; - blocker = &wpnList2; - } - else - blocker = &wpnList;*/ - if ( (iId < 0 || iId >= MAX_WEAPONS ) || (wpnList & (1<