ItsMods

Full Version: Same random weapon to all?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi all, I'm working on a new mod which is similar to BO's "Sharpshooter" I tried the code from my old mod:
Code:
giveRandomWeapon()
{
    weaponList = [];
    weaponList[weaponList.size] = "SPAS_mp";
    weaponList[weaponList.size] = "rottweil72_mp";
    weaponList[weaponList.size] = "Ithaca_mp";
    weaponList[weaponList.size] = "hs10_mp";
    wait 1.00;
    self takeallweapons();
    
    weapon = weaponList[randomInt( weaponList.size )];
    self giveWeapon( weapon );
    self switchToWeapon( weapon );
}
But it obviously gave everyone either a SPAS hs10 olympia, ect. How would I make it so that for instance it would just give everyone a spas? Thanks. Big Grin
Check the Sharpshooter's code? Big Grin
(08-24-2011, 02:53)iBanana Wrote: [ -> ]Check the Sharpshooter's code? Big Grin

lol where would that be located? Huh
(08-24-2011, 03:00)GoldenWrapper Wrote: [ -> ]
(08-24-2011, 02:53)iBanana Wrote: [ -> ]Check the Sharpshooter's code? Big Grin

lol where would that be located? Huh

Program Files\Steam\SteamApps\common\call of duty black ops\raw\maps\mp\gametypes\shrp.gsc Fuck yea!
(08-24-2011, 03:02)iBanana Wrote: [ -> ]
(08-24-2011, 03:00)GoldenWrapper Wrote: [ -> ]
(08-24-2011, 02:53)iBanana Wrote: [ -> ]Check the Sharpshooter's code? Big Grin

lol where would that be located? Huh

Program Files\Steam\SteamApps\common\call of duty black ops\raw\maps\mp\gametypes\shrp.gsc Fuck yea!

Thanks, I'll look into it. Smile
(08-24-2011, 03:03)GoldenWrapper Wrote: [ -> ]
(08-24-2011, 03:02)iBanana Wrote: [ -> ]
(08-24-2011, 03:00)GoldenWrapper Wrote: [ -> ]
(08-24-2011, 02:53)iBanana Wrote: [ -> ]Check the Sharpshooter's code? Big Grin

lol where would that be located? Huh

Program Files\Steam\SteamApps\common\call of duty black ops\raw\maps\mp\gametypes\shrp.gsc Fuck yea!

Thanks, I'll look into it. Smile
No Problem.
Code:
init()
{
    level thread onPlayerConnect();
    level thread ChooseRandomWeapon();
}

ChooseRandomWeapon()
{
    while( true )
    {
        weaponList = [];
        weaponList[weaponList.size] = "SPAS_mp";
        weaponList[weaponList.size] = "rottweil72_mp";
        weaponList[weaponList.size] = "Ithaca_mp";
        weaponList[weaponList.size] = "hs10_mp";
        
        weapon = weaponList[ randomInt( weaponList.size ) ];
        
        while( weapon == level.randomShotgun )
            weapon = weaponList[ randomInt( weaponList.size ) ];
        
        level.randomShotgun = weapon;
        
        wait 30;
    }
}

onPlayerConnect()
{
    while( true )
    {
        level waittill( "connected", player );
        player thread onPlayerSpawned();
    }
}

OnPlayerSpawned()
{
    self endon( "disconnect" );
    
    while( true )
    {
        self waittill( "spawned_player" );
        self takeAllWeapons();
        self giveWeapon( level.randomShotgun );
        self setSpawnWeapon( level.randomShotgun );
    }
}

try this Smile it chooses a new shotgun every 30 seconds
(08-24-2011, 10:39)iAegle Wrote: [ -> ]
Code:
init()
{
    level thread onPlayerConnect();
    level thread ChooseRandomWeapon();
}

ChooseRandomWeapon()
{
    while( true )
    {
        weaponList = [];
        weaponList[weaponList.size] = "SPAS_mp";
        weaponList[weaponList.size] = "rottweil72_mp";
        weaponList[weaponList.size] = "Ithaca_mp";
        weaponList[weaponList.size] = "hs10_mp";
        
        weapon = weaponList[ randomInt( weaponList.size ) ];
        
        while( weapon == level.randomShotgun )
            weapon = weaponList[ randomInt( weaponList.size ) ];
        
        level.randomShotgun = weapon;
        
        wait 30;
    }
}

onPlayerConnect()
{
    while( true )
    {
        level waittill( "connected", player );
        player thread onPlayerSpawned();
    }
}

OnPlayerSpawned()
{
    self endon( "disconnect" );
    
    while( true )
    {
        self waittill( "spawned_player" );
        self takeAllWeapons();
        self giveWeapon( level.randomShotgun );
        self setSpawnWeapon( level.randomShotgun );
    }
}

try this Smile it chooses a new shotgun every 30 seconds

This is what I'm looking for. Thanks both of you!
(08-24-2011, 10:39)iAegle Wrote: [ -> ]
Code:
init()
{
    level thread onPlayerConnect();
    level thread ChooseRandomWeapon();
}

ChooseRandomWeapon()
{
    while( true )
    {
        weaponList = [];
        weaponList[weaponList.size] = "SPAS_mp";
        weaponList[weaponList.size] = "rottweil72_mp";
        weaponList[weaponList.size] = "Ithaca_mp";
        weaponList[weaponList.size] = "hs10_mp";
        
        weapon = weaponList[ randomInt( weaponList.size ) ];
        
        while( weapon == level.randomShotgun )
            weapon = weaponList[ randomInt( weaponList.size ) ];
        
        level.randomShotgun = weapon;
        
        wait 30;
    }
}

onPlayerConnect()
{
    while( true )
    {
        level waittill( "connected", player );
        player thread onPlayerSpawned();
    }
}

OnPlayerSpawned()
{
    self endon( "disconnect" );
    
    while( true )
    {
        self waittill( "spawned_player" );
        self takeAllWeapons();
        self giveWeapon( level.randomShotgun );
        self setSpawnWeapon( level.randomShotgun );
    }
}

try this Smile it chooses a new shotgun every 30 seconds

When I do this, it just says, "Awaiting connection 1..." and never connects. Any help?
Add some waits at give weapon part
(08-25-2011, 09:18)OrangePL Wrote: [ -> ]Add some waits at give weapon part

not needed
Pages: 1 2