Player's current weapon information (pPlayer->current) not always updated properly.
For exmaple if player is used a player_weaponstrip entity:
Code:
stock fm_strip_user_weapons(index) {
new ent = fm_create_entity("player_weaponstrip")
if (!pev_valid(ent))
return 0
dllfunc(DLLFunc_Spawn, ent)
dllfunc(DLLFunc_Use, ent, index)
engfunc(EngFunc_RemoveEntity, ent)
return 1
}
pPlayer->current isn't updated, so get_user_weapon returned result is equal to previous pPlayer->current.
I'm not sure but i think that the problem is in emsg.cpp:
Code:
void Client_CurWeapon(void* mValue)
{
static int iState;
static int iId;
switch (mState++)
{
case 0:
iState = *(int*)mValue;
break;
case 1:
if (!iState) break;
iId = *(int*)mValue;
break;
case 2:
if (!mPlayer) return;
if (!iState || (iId < 1 || iId >= MAX_WEAPONS)) break;
mPlayer->weapons[iId].clip = *(int*)mValue;
mPlayer->current = iId;
mPlayer->lastHit = mPlayer->lastTrace;
}
}
I think the "case 2" code block should be changed to something like this:
Code:
if (!mPlayer) return;
if (!iState || (iId < 0 || iId >= MAX_WEAPONS)) break;
mPlayer->current = iId;
if (iId == 0) break;
mPlayer->weapons[iId].clip = *(int*)mValue;
mPlayer->lastHit = mPlayer->lastTrace;