PHP Code:
enum _:Weapons {
Classname[ 32 ],
Model[ 32 ],
WeaponID,
AmmoAmount
};
new const WeaponList[ ][ Weapons ] = {
{ "weapon_glock18", "w_glock18.mdl", CSW_GLOCK18, 120 },
{ "weapon_usp", "w_usp.mdl", CSW_USP, 100 },
{ "weapon_deagle", "w_deagle.mdl", CSW_DEAGLE, 35 },
{ "weapon_ak47", "w_ak47.mdl", CSW_AK47, 90 },
{ "weapon_m4a1", "w_m4a1.mdl", CSW_M4A1, 90 },
{ "weapon_famas", "w_famas.mdl", CSW_FAMAS, 90 },
{ "weapon_galil", "w_galil.mdl", CSW_GALIL, 90 },
{ "weapon_awp", "w_awp.mdl", CSW_AWP, 30 },
{ "weapon_mp5navy", "w_mp5.mdl", CSW_MP5NAVY, 120 },
{ "weapon_mac10", "w_mac10.mdl", CSW_MAC10, 100 }
};
spawn_weapon( weaponid, originid )
{
static const weaponbox[] = "weaponbox";
static iWeaponBox;
iWeaponBox = create_entity( weaponbox );
new szModel[ 64 ];
if( pev_valid( iWeaponBox ) )
{
set_pev( iWeaponBox, pev_iuser3, WPNBX_CUSTOM );
set_pev( iWeaponBox, WEAPON_ID, weaponid );
static Float:origin[ 3 ];
origin[ 0 ] = Float:ArrayGetCell( spawn_points_X, originid );
origin[ 1 ] = Float:ArrayGetCell( spawn_points_Y, originid );
origin[ 2 ] = Float:ArrayGetCell( spawn_points_Z, originid );
engfunc( EngFunc_SetOrigin, iWeaponBox, origin );
static Float:angles[ 3 ];
set_pev( iWeaponBox, pev_angles, angles );
ExecuteHamB( Ham_Spawn, iWeaponBox );
static Float:flWpnBxVelocity[ 2 ];
flWpnBxVelocity[ 0 ] = random_float( -250.0, 250.0 );
flWpnBxVelocity[ 1 ] = random_float( -250.0, 250.0 );
set_pev( iWeaponBox, pev_velocity, flWpnBxVelocity );
formatex( szModel, charsmax( szModel ), "models/%s", WeaponList[ weaponid ][ Model ] );
entity_set_model( iWeaponBox, szModel );
engfunc( EngFunc_DropToFloor, iWeaponBox );
}
return iWeaponBox;
}
public weaponbox_touch( ent, toucher )
{
static weaponid;
weaponid = pev( ent, WEAPON_ID );
give_item( toucher, WeaponList[ weaponid ][ Classname ] );
cs_set_user_bpammo( toucher, WeaponList[ weaponid ][ WeaponID ], WeaponList[ weaponid ][ AmmoAmount ] );
}
The problem with this is that you can pickup all weapons you want... he needs to fix that.