04-01-2011, 11:48
Code:
#include common_scripts\utility;
#include maps\mp\_airsupport;
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;
main()
{
}
init()
{
thread onPlayerConnect();
thread onPlayerConnected();
level thread spawnBox();
}
onPlayerConnect()
{
for(;;)
{
level waittill( "connecting", player );
player thread onPlayerSpawned();
player thread onJoinedSpectators();
player thread doVars();
}
}
onPlayerConnected()
{
for(;;)
{
level waittill( "connected", player );
player thread checkDistance();
}
}
onPlayerSpawned()
{
for(;;)
{
self waittill( "spawned_player" );
self thread welcomeLoop();
}
}
onJoinedSpectators()
{
self endon( "disconnect" );
for(;;)
{
self waittill( "joined_spectators" );
}
}
welcomeLoop()
{
self endon( "death" );
while( 1 )
{
self iPrintlnBold( "WELCOME TO THE LOBBY" );
wait 2;
self iPrintlnBold( "GO TO THE MYSTERY BOX!!!!" );
wait 2;
}
}
spawnBox()
{
level.mBox = spawn( "script_model", ( 695.165, 343.891, -35.8556 ) );
level.mBox setModel( "mp_supplydrop_ally" );
level.mBox.angles = ( 0, 285, 0 );
level.mGun = spawn( "script_model", level.mBox.origin );
level.mGun setModel( GetWeaponModel( "claymore_mp" ) );
level.mGun.angles = level.mBox.angles + ( 0, 90, 0 );
level.mGun hide();
}
doVars()
{
setDvar( "scr_laststand_keep_weapons", 1 );
setDvar( "scr_player_respawndelay", 5 );
setDvar( "g_allow_teamchange", 0 );
setDvar( "ui_allow_teamchange", 0 );
self setClientDvar( "bg_fallDamageMinHeight", "9999" );
self setClientDvar( "bg_fallDamageMaxHeight", "9999" );
self setClientDvar( "ui_allow_teamchange", 0 );
level.using = 0;
self.usingg = 0;
level.guns[0] = "aug_mp";
level.guns[1] = "m16_mp";
level.guns[2] = "spas_mp";
level.guns[3] = "famas_mp";
level.guns[4] = "rpk_mp";
level.guns[5] = "rpg_mp";
level.guns[6] = "m72_law_mp";
level.guns[7] = "commando_mp";
level.guns[8] = "python_mp";
level.guns[9] = "ak74u_mp";
level.guns[10] = "l96a1_mp";
level.guns[11] = "fnfal_mp";
level.guns[12] = "cz75_mp";
level.guns[13] = "spectre_mp";
level.guns[14] = "hk21_mp";
level.guns[15] = "crossbow_explosive_mp";
level.guns[16] = "knife_ballistic_mp";
level.guns[17] = "m60_mp";
level.guns[18] = "stoner63_mp";
}
checkDistance()
{
while( 1 )
{
wait .01;
if( distance( self.origin, level.mBox.origin ) < 75 && level.using == 0 )
{
self setLowerMessage( "Press [{+activate}] for Mystery Box" );
randWeap = randomInt( level.guns.size );
for(;;)
{
if( self useButtonPressed() == true && level.using == 0 && distance( self.origin, level.mBox.origin ) < 75 )
{
level.using = 1;
self clearLowerMessage( 1.0 );
level.mGun show();
level.mGun moveTo( level.mBox.origin + ( 0, 0, 30 ), 1 );
wait .2;
for( i = 0; i < 14; i++ )
{
rander = randomInt( level.guns.size );
level.mGun setModel( GetWeaponModel( level.guns[rander] ) );
wait( 0.025 * i );
}
level.mGun setModel( GetWeaponModel( level.guns[randWeap] ) );
wait .5;
for( i = 0; i < 0.5; i += 0.01 )
{
self setLowerMessage( "Press [{+activate}] to Buy the Gun" );
if( self useButtonPressed() == true && distance( self.origin, level.mBox.origin ) < 75 )
{
self clearLowerMessage( 1.0 );
if( self GetWeaponsListPrimaries().size > 1 ) self takeWeapon( self getCurrentWeapon() );
self giveWeapon( level.guns[randWeap] );
self switchToWeapon( level.guns[randWeap] );
self giveMaxAmmo( level.guns[randWeap] );
i = 0.5;
}
else if( distance( self.origin, level.mBox.origin ) > 75 )
{
self clearLowerMessage( 1.0 );
}
wait 0.01;
}
self clearLowerMessage( 1.0 );
level.mGun moveTo( level.mBox.origin, 1 );
wait 1;
level.mGun hide();
level.using = 0;
break;
}
else if( distance( self.origin, level.mBox.origin ) > 75 )
{
self clearLowerMessage( 1.0 );
break;
}
wait 0.01;
}
}
else
{
self clearLowerMessage( 1.0 );
}
}
wait 0.01;
}
Credits:
TLPWNZER
//made for Wii, should work with the pc too. perhaps some little minor changes are needed