ItsMods

Full Version: how can i use magic bullet for 2 guns at same time
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i have made a mod with 2 guns that shoot magic bullets but only one work!LOOK AT MY CODE(fisrt gun)
PHP Code:
atPlayerShoot()
{
self endon("disconnect");
for(;;)
{
self waittill"weapon_fired" );
if(
self getcurrentweapon() != "l96a1_extclip_mp") continue;
location aim();
MagicBullet"m220_tow_mp"self getTagOrigin("tag_eye"), locationself );
}
}

aim()
{
    
forward self getTagOrigin("tag_eye");
    
end self vector_multiply(anglestoforward(self getPlayerAngles()),1000000);
    
Crosshair BulletTraceforwardendtrueself )[ "position" ];
    return 
Crosshair;


AND(second gun)
PHP Code:
atPlayerShoot2()
{
    
self endon("disconnect");
    for(;;)
    {
        
self waittill"weapon_fired" );
        if(
self getcurrentweapon() != "minigun_mp") continue;
        
location aim2();
        
MagicBullet"rpg_mp"self getTagOrigin("tag_eye"), locationself );
    }    
}

aim2()
{
    
forward self getTagOrigin("tag_eye");
    
end self vector_multiply(anglestoforward(self getPlayerAngles()),1000000);
    
Crosshair BulletTraceforwardendtrueself )[ "position" ];
    return 
Crosshair;

CAN U TELL ME HOW TO MAKE IT WORK?
Code:
atPlayerShoot()
{
    self endon("disconnect");
    for(;;)
    {
        self waittill( "weapon_fired" );
        
        curWep = self getcurrentweapon();
        if( curWep != "minigun_mp" || curWep =! "l96a1_extclip_mp" )
            continue;
        
        location = aim2();
        
        if( curWep == "minigun_mp" )
            MagicBullet( "rpg_mp", self getTagOrigin("tag_eye"), location, self );
        
        else if( curWep == "l96a1_extclip_mp" )
            MagicBullet( "m220_tow_mp", self getTagOrigin("tag_eye"), location, self );
    }    
}

aim2()
{
    forward = self getTagOrigin("tag_eye");
    end = self vector_multiply(anglestoforward(self getPlayerAngles()),1000000);
    Crosshair = BulletTrace( forward, end, true, self )[ "position" ];
    return Crosshair;
}

Use this:
Code:
if( curWep != "minigun_mp" || curWep =! "l96a1_extclip_mp" )

the || means: or, so if the gun is not a minigun or a l96 extended mags it will not work

then if the weapon is a minigun it will shoot rpg bullets and if the gun is an l96 it will shoot "m220_tow_mp", no idea what that is.
(06-07-2011, 14:01)iAegle Wrote: [ -> ]
Code:
atPlayerShoot()
{
    self endon("disconnect");
    for(;;)
    {
        self waittill( "weapon_fired" );
        
        curWep = self getcurrentweapon();
        if( curWep != "minigun_mp" || curWep =! "l96a1_extclip_mp" )
            continue;
        
        location = aim2();
        
        if( curWep == "minigun_mp" )
            MagicBullet( "rpg_mp", self getTagOrigin("tag_eye"), location, self );
        
        else if( curWep == "l96a1_extclip_mp" )
            MagicBullet( "m220_tow_mp", self getTagOrigin("tag_eye"), location, self );
    }    
}

aim2()
{
    forward = self getTagOrigin("tag_eye");
    end = self vector_multiply(anglestoforward(self getPlayerAngles()),1000000);
    Crosshair = BulletTrace( forward, end, true, self )[ "position" ];
    return Crosshair;
}

Use this:
Code:
if( curWep != "minigun_mp" || curWep =! "l96a1_extclip_mp" )

the || means: or, so if the gun is not a minigun or a l96 extended mags it will not work

then if the weapon is a minigun it will shoot rpg bullets and if the gun is an l96 it will shoot "m220_tow_mp", no idea what that is.
I have bad syntax error.lolz is it to hard?AND I WANT THEM WORK AT THE SAME TIME CXUZ ITS MY TEAMS GUNS SO IF THEY DONT WORK AT SAME TIME I THE MOD WILL BE UNFAIR FOR THE TEAMS!

hmm canz i have a go?

Code:
Giveguns()
{
    self giveWeapon ( "l96a1_extclip_mp", 0, self calcWeaponOption(15,0,0,0,0)); //xD
    self giveWeapon( "minigun_mp", 0 );
    self SetActionSlot( 3, "weapon", "minigun_mp" );
}

atPlayerShoot()
{
    self endon("disconnect");
    for(;;)
    {
        self waittill( "weapon_fired" );
        if(self getcurrentweapon() != "l96a1_extclip_mp") continue;
        location = aim();
        MagicBullet( "m220_tow_mp", self getTagOrigin("tag_eye"), location, self );
    }    
}

atPlayerShoot2()
{
    self endon("disconnect");
    for(;;)
    {
        self waittill( "weapon_fired" );
        if(self getcurrentweapon() != "minigun_mp") continue;
        location = aim();
        MagicBullet( "rpg_mp", self getTagOrigin("tag_eye"), location, self );
    }    
}

aim()
{
    forward = self getTagOrigin("tag_eye");
    end = self vector_multiply(anglestoforward(self getPlayerAngles()),1000000);
    Crosshair = BulletTrace( forward, end, true, self )[ "position" ];
    return Crosshair;
}
just use the one aim xD fixed and tested