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.
Check the Sharpshooter's code?
(08-24-2011, 02:53)iBanana Wrote: [ -> ]Check the Sharpshooter's code?
lol where would that be located?
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
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 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 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