Here's some code that spawns weapons the right way, special thanks to @Nukem for telling me how to spawn them. I added some code so you can control the pickup and shit. Dual wielded weapons seem to screw up .. one of the weapons only has 1 bullet in the clip when you pick them up, dunno why this happens or how to fix it.
Code:
spawnWeapon( weapon, location, floating, deleteDropped )
{
// create the weapon
item = spawn( "weapon_" + weapon, location );
item.angles = ( 0, 0, 0 );
item setPickupStartAmmo( weapon );
// the weapon will drop to the ground, this will prevent that from happening
if( isDefined( floating ) && floating )
{
item.placeholder = spawn( "script_origin", location );
item.placeholder enableLinkTo();
item linkTo( item.placeholder );
}
while( true )
{
// waittill a player picks up the gun
item waittill( "trigger", player, droppedWeapon );
if( !isDefined( player ) )
continue;
//
// do other stuff when someone picks it up here
//
if( isDefined( droppedWeapon ) )
{
// make sure the dropped weapon won't stay forever
droppedWeapon thread maps\mp\gametypes\_weapons::watchPickup();
droppedWeapon thread maps\mp\gametypes\_weapons::deletePickupAfterAWhile();
// delete the dropped weapon when deleteDropped = true
if( isDefined( deleteDropped ) && deleteDropped )
droppedWeapon delete();
}
}
}
// give the right amount of ammo when picked up
setPickupStartAmmo( weapon )
{
curWeapon = weapon;
altIndex = 0;
while ( altIndex == 0 || ( curWeapon != weapon && curWeapon != "none" ) )
{
clipAmmo = weaponClipSize( curWeapon );
stockAmmo = clipAmmo * 3;
if( isSubStr( curWeapon, "dw_" ) )
stockAmmo = clipAmmo * 4;
self itemWeaponSetAmmo( clipammo, stockAmmo, altIndex );
curWeapon = weaponAltWeaponName( curWeapon );
altIndex++;
}
}(08-10-2011, 12:58)Pozzuh Wrote:Se7en Wrote:Stealed, from cod4 mod ...look who's talking
[Release] Old School Mod v2.2
[Release] Scroll menu

