Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Same random weapon to all?
#1
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
[Image: mca.png]
Add me on steam! otterm
Reply

#2
Check the Sharpshooter's code? Big Grin
Reply

#3
(08-24-2011, 02:53)iBanana Wrote: Check the Sharpshooter's code? Big Grin

lol where would that be located? Huh
[Image: mca.png]
Add me on steam! otterm
Reply

#4
(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!
Reply

#5
(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
[Image: mca.png]
Add me on steam! otterm
Reply

#6
(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.
Reply

#7
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-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#8
(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?
[Image: mca.png]
Add me on steam! otterm
Reply

#9
Add some waits at give weapon part
[Image: lQDUjba.jpg]
Reply

#10
(08-25-2011, 09:18)OrangePL Wrote: Add some waits at give weapon part

not needed
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Release] [SOURCE] Random Weapons. [HARD] Tony. 1 3,895 11-08-2013, 11:11
Last Post: Nekochan
  Help source random weapons [HARD] Tony. 4 4,349 11-08-2013, 05:25
Last Post: [HARD] Tony.
Question Help Mw2 weapon skin question FroxIVx4 1 2,772 10-13-2013, 16:54
Last Post: hmann
Question Help Weapon Name iRoNinja 8 6,061 10-08-2013, 08:31
Last Post: iRoNinja
  Mw2 weapon porting? Cuddlyedits 3 4,376 09-15-2013, 16:43
Last Post: DidUknowiPwn
  Help choose 2 random players?(1 each team) 26hz 6 4,338 09-12-2013, 17:32
Last Post: Yamato
Rainbow [Release] MW3: Random Weapon Plugin V1 Nekochan 50 30,722 09-11-2013, 15:11
Last Post: EnVi Sweden Rocks
Exclamation [Request] Random Weapon At Spawn Scripts18 3 4,431 07-27-2013, 23:53
Last Post: DidUknowiPwn
  Help Receiving a random primary & secondary DidUknowiPwn 5 4,097 07-22-2013, 09:47
Last Post: Yamato
  Help Mw2 weapon skin question FroxIVx4 1 2,702 07-06-2013, 19:22
Last Post: surtek

Forum Jump:


Users browsing this thread:
1 Guest(s)

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