Results 1 to 1 of 1
  1. #1
    Banned
    Join Date
    Dec 2011
    Posts
    6
    Points
    21
         User Info     Contact     Gamer ID
    Join Date
    Dec 2011
    Posts
    6
    Points
    21

    Default [SM8E52] Mystery Box Script

    Tested and Working!

    Code:
    SpawnBox()
    {
        Box = spawn( "script_model", self.origin + ( 0, 50, 20 ) );
        Box SetModel( "com_plasticcase_friendly" );
        Box.angles = self.angles;
        Box CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
    
        Box thread monitorDistance();
    }
    
    monitorDistance()
    {
        self.isUsing = false;
        Num = RandomInt( 1000 );
    
        for(;;)
        {
            wait 0.05;
    
            foreach( player in level.players )
            {
                if( Distance( player.origin, self.origin ) < 50 && self.isUsing == false )
                {
                    player setLowerMessage( Num, "Press and Hold [{+activate}] to use Mystery Box" );
    
                    if( player UseButtonPressed() && self.isUsing == false ) wait 0.2;
                    if( player UseButtonPressed() && self.isUsing == false )
                    {
                        self.isUsing = true;
                        player clearLowerMessage( Num, 0.5 );
    
                        Gun = spawn( "script_model", self.origin );
                        Gun SetModel( "" );
                        Gun.angles = self.angles;
    
                        Gun moveTo( self.origin + ( 0, 0, 30 ), 2 );
    
                        Random = 0;
                        Weapon = 0;
    
                        for( i = 0; i < 15; i++ )
                        {
                            Random = randomInt( level.weaponList.size );
                            Weapon = level.weaponList[Random];
                            Gun SetModel( GetWeaponModel( Weapon ) );
                            wait( 0.025 * i );
                        }
    
                        self thread monitorPickupWeapon( Gun, Weapon, player );
    
                        self waittill( "end_box" );
    
                        Gun MoveTo( self.origin, 0.5 );
                        wait 0.5;
                        Gun Delete();
                        Gun Destroy();
    
                        self.isUsing = false;
                    }
                }
                else player clearLowerMessage( Num );
            }
        }
    }
    
    monitorTimeout( Box, Num, Player )
    {
        Box endon( "end_box" );
    
        self moveTo( Box.origin, 11 );
        wait 10;
        Player clearLowerMessage( Num );
    
        Box notify( "end_box" );
    }
    
    monitorPickupWeapon( Gun, Weapon, Player )
    {
        self endon( "end_box" );
    
        Num = randomInt( 1000 );
        Gun thread monitorTimeout( self, Num, Player );
    
        for(;;)
        {
            wait 0.05;
    
            if( distance( self.origin, Player.origin ) < 50 )
            {
                Player setLowerMessage( Num, "Press and Hold [{+activate}] to trade weapons" );
    
                if( Player UseButtonPressed() ) wait 0.2;
                if( Player UseButtonPressed() )
                {
                    Player clearLowerMessage( Num, 0.5 );
    
                    if( Player GetWeaponsListPrimaries().size > 1 ) Player takeWeapon( Player getCurrentWeapon() );
                    Player GiveWeapon( Weapon );
                    Player SwitchToWeapon( Weapon );
                    Player GiveMaxAmmo( Weapon );
    
                    self notify( "end_box" );
                }
            }
            else Player clearLowerMessage( Num );
        }
    }
    Updated: Fixed a few bugs I hadnt noticed before.
    Update yet again: Fixed the take weapon bug

    Created by Tlpwnzer

    0 Not allowed! Not allowed!
    Last edited by KazzababeGamer; 12-31-2011 at 06:10 PM. Reason: Give credit bitch

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -10. The time now is 01:21 PM.
Powered by vBulletin®
Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.