Hello gents. I'm trying to give a player a weapon when he walks over it; normally he'd be able to pick it up like normal, but he already has a primary weapon so I'm going around it with hamsandwich.
The giving part works fine, but the ammo doesn't go with it. The clip ammo does, but not the backpack ammo. So if I drop an SMG for example, with 23 rounds in the clip and 4 extra magazines, I go to pick it back up and only get those 23 rounds total - no extra magazines.
Code:
// Adapted from XxAvalanchexX's stock
stock ham_give_weapon_entity( id, wpnent ) {
if( !pev_valid(wpnent) ) return 0;
if(!ExecuteHamB(Ham_AddPlayerItem,id,any:wpnent) || !ExecuteHamB(Ham_Item_AttachToPlayer,wpnent,any:id))
{
if(pev_valid(wpnent)) set_pev(wpnent,pev_flags,pev(wpnent,pev_flags) & FL_KILLME);
return 0;
}
return 1;
}
So my question is, first of all, if anyone knows a better way around this.
But assuming no one does, does anyone know where backpack ammo is stored? Is it on the person, or in the gun (which would be logical). If it's in the gun, where? Pdata (I've looked through some offsets to no avail)?
Thanks in advance
__________________