Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Release SD bomb as ammo box
#1
Code:
//level thread doAmmoBomb();
//in init()
doAmmoBomb()
{    
    trigger = getEnt( "sd_bomb_pickup_trig", "targetname" );
    if ( !isDefined( trigger ) )
    {
        maps\mp\_utility::error("No sd_bomb_pickup_trig trigger found in map.");
        return;
    }
    
    visuals[0] = getEnt( "sd_bomb", "targetname" );
    if ( !isDefined( visuals[0] ) )
    {
        maps\mp\_utility::error("No sd_bomb script_model found in map.");
        return;
    }

    precacheModel( "prop_suitcase_bomb" );    
    
    level.bombZones = [];
    
    bombZones = getEntArray( "bombzone", "targetname" );
    
    for ( index = 0; index < bombZones.size; index++ )
    {
        trigger = bombZones[index];
        visuals = getEntArray( bombZones[index].target, "targetname" );
        
        bombZone = maps\mp\gametypes\_gameobjects::createUseObject( "allies", trigger, visuals, (0,0,64) );
        bombZone maps\mp\gametypes\_gameobjects::allowUse( "friendly" );
        bombZone maps\mp\gametypes\_gameobjects::setUseTime( 1.5 );
        bombZone maps\mp\gametypes\_gameobjects::setUseText( "Getting ammo..." );
        bombZone maps\mp\gametypes\_gameobjects::setUseHintText( "Hold ^3[{+activate}]^7 to get Ammo" );
        label = bombZone maps\mp\gametypes\_gameobjects::getLabel();
        bombZone.label = label;
        bombZone maps\mp\gametypes\_gameobjects::set2DIcon( "friendly", "hud_ammo_refill_drop");
        bombZone maps\mp\gametypes\_gameobjects::set3DIcon( "friendly", "hud_ammo_refill_drop" );
        bombZone maps\mp\gametypes\_gameobjects::setVisibleTeam( "any" );
        bombZone.onBeginUse = ::onBeginUse;
        bombZone.onEndUse = ::onEndUse;
        bombZone.onUse = ::onUsePlantObject;
        bombZone.onCantUse = ::onCantUse;
        bombZone.useWeapon = "briefcase_bomb_mp";
        bombZone.visuals[0].killCamEnt = spawn( "script_model", bombZone.visuals[0].origin + (0,0,128) );
        
        for ( i = 0; i < visuals.size; i++ )
        {
            if ( isDefined( visuals[i].script_exploder ) )
            {
                bombZone.exploderIndex = visuals[i].script_exploder;
                break;
            }
        }
        
        level.bombZones[level.bombZones.size] = bombZone;
        
        bombZone.bombDefuseTrig = getent( visuals[0].target, "targetname" );
        assert( isdefined( bombZone.bombDefuseTrig ) );
        bombZone.bombDefuseTrig.origin += (0,0,-10000);
        bombZone.bombDefuseTrig.label = label;
    }
}
onUsePlantObject(player)
{
    if ( !IsDefined( player ) )
        return;
    
    weaponlist = player GetWeaponsList();
    for(i=0;i<weaponlist.size;i++)
    {
        weapon = weaponlist[i];
        switch(weapon)
        {
            case "frag_grenade_mp":
            case "sticky_grenade_mp":
            case "hatchet_mp":
            case "flash_grenade_mp":
            case "concussion_grenade_mp":
            case "tabun_gas_mp":
            case "nightingale_mp":
            case "willy_pete_mp":
                player SetWeaponAmmoStock(weapon,999);
                break;
            default:
                player GiveMaxAmmo(weapon);
                break;
        }
    }
    player iprintlnbold("Enjoy your ammo.");
}

onCantUse( player )
{
    player iPrintLnBold( "You can't use this right now!" );
}

onEndUse( team, player, result )
{
    if ( !IsDefined( player ) )
        return;
}

onBeginUse( player )
{

}

Code:
//enable / disable ammo box
ammoBoxEnable(bool)
{
    if(isDefined(level.bombZones))
    {
        for (i = 0; i < level.bombZones.size; i++ )
        {
            if(!bool)
                level.bombZones[i] maps\mp\gametypes\_gameobjects::disableObject();
            else
                level.bombZones[i] maps\mp\gametypes\_gameobjects::enableObject();
        }
    }
}
[Image: MaEIQ.png]
Reply

#2
I will use this Awesome
Reply

#3
Fuu y u release this now
[Image: lQDUjba.jpg]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Disable Planting on Bomb clemi555 4 3,468 11-04-2013, 07:59
Last Post: clemi555
  [Request] no ammo for infected gamemode ExoGamer* 8 5,576 08-15-2013, 18:59
Last Post: Dr3am95
  M320 and GP25 ammo McKinleySPB 3 3,109 07-06-2013, 12:56
Last Post: archit
Smile [Release] Unlimited ammo v2.3 & @Nukems unlammo hillbilly 40 24,364 06-26-2013, 11:33
Last Post: X-Track
Question can't find it (ammo box) DJSKilly 8 5,306 05-29-2013, 11:27
Last Post: Dr3am95
Wink Help Ammo box Dr3am95 6 4,431 03-31-2013, 15:39
Last Post: NyZzE
  Help Problem unlimited ammo plugin 4nonymous 2 3,134 03-10-2013, 20:14
Last Post: hillbilly
Smile Need Someone to Make an Ammo Replenishing Box SkATerJoN 5 3,996 01-18-2013, 17:31
Last Post: tomglazer
  Help Setting ammo for M320/Shotgun Attachment yokai134 2 2,823 12-12-2012, 07:03
Last Post: yokai134
  [Request] im looking for ammo code pap12322221112 2 2,536 10-22-2012, 08:41
Last Post: AZUMIKKEL

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.