It looks like setting m_iItemDefinitionIndex before DispatchSpawn fixes almost all problems.
in deathmatch/weapons.sp, stock weapons_GivePlayerItem change this (standard weapons.sp version):
PHP Code:
// Some hacking to bypass inventory
if(weaponId > NO_WEAPON_SELECTED && targetDefinitinIndex != GetEntProp(weaponEntity, Prop_Send, "m_iItemDefinitionIndex"))
{
weapons_RemovePlayerWeapon(weaponEntity, clientIndex);
// Weapon is removed on a timer to prevent crash
CreateTimer(0.2, weapons_Timer_DelayedWeaponKill, EntIndexToEntRef(weaponEntity));
weaponEntity = CreateEntityByName(weaponEntityName);
DispatchSpawn(weaponEntity);
SetEntProp(weaponEntity, Prop_Send, "m_iItemDefinitionIndex", targetDefinitinIndex);
EquipPlayerWeapon(clientIndex, weaponEntity);
}
to this:
PHP Code:
// Some hacking to bypass inventory
if(weaponId > NO_WEAPON_SELECTED && targetDefinitinIndex != GetEntProp(weaponEntity, Prop_Send, "m_iItemDefinitionIndex"))
{
weapons_RemovePlayerWeapon(weaponEntity, clientIndex);
// Weapon is removed on a timer to prevent crash
CreateTimer(0.2, weapons_Timer_DelayedWeaponKill, EntIndexToEntRef(weaponEntity));
weaponEntity = CreateEntityByName(weaponEntityName);
SetEntProp(weaponEntity, Prop_Send, "m_iItemDefinitionIndex", targetDefinitinIndex);
DispatchSpawn(weaponEntity);
EquipPlayerWeapon(clientIndex, weaponEntity);
}
Attached weapons.sp with this modification.
There is one bug however: skins for p2000 won't work if you have usp-s selected in inventory. I haven't tried to fix it yet.
Let me know if it works for you.