Then fix it. I only supplied that code snippet as an example of how it could work.
EDIT: I just did some testing, and it does work, but it puts the weapon pickup right where the player dies, so he picks it up before the death finishes.
Try this instead:
function onPlayerDeath( player , reason )
{
local model = 0;
switch( player.Weapon )
{
case 1:
model = 172;
break;
case 2:
model = 173;
break;
case 3:
model = 178;
break;
case 4:
model = 176;
break;
case 5:
model = 171;
break;
case 6:
model = 180;
break;
case 7:
model = 177;
break;
case 8:
model = 175;
break;
case 9:
model = 181;
break;
case 10:
model = 174;
break;
case 11:
model = 170;
break;
}
if( model != 0 )
{
local pickup = CreatePickup( model , Vector( player.Pos.x + 5 , player.Pos.y , player.Pos.z ) );
if( pickup )
{
pickup.OneTime = true;
}
}
}
function onPickupPickedUp( player , pickup )
{
local weapon = 0;
switch( pickup.Model )
{
case 172:
weapon = 1;
break;
case 173:
weapon = 2;
break;
case 178:
weapon = 3;
break;
case 176:
weapon = 4;
break;
case 171:
weapon = 5;
break;
case 180:
weapon = 6;
break;
case 177:
weapon = 7;
break;
case 175:
weapon = 8;
break;
case 181:
weapon = 9;
break;
case 174:
weapon = 10;
break;
case 175:
weapon = 11;
break;
}
if( weapon != 0 )
{
// I put 999999 ammo due to the Player.WeaponAmmo bug.
player.SetWeapon( weapon , 999999);
}
}