Results 1 to 8 of 8

Thread: Spawn "box"

  1. #1
    Private Invictus's Avatar
    Join Date
    Mar 2013
    Location
    Poland
    Posts
    32
    Thanks
    25
    Thanked 13 Times in 6 Posts

    Lightbulb Spawn "box"

    Hi.

    I make a script with spawn a box. When i run map cod2 have crash.

    There is a script :

    PHP Code:
    skrzynka()
    {
        
    precacheModel("xmodel/crate01");
                
        
    skrzynka spawn("script_model", (2206.32411.60954.6547));
        
    skrzynka.angles = (2.21806151.797, -7.6227);
        
    skrzynka setmodel("xmodel/crate01");
            
        while(
    distance(self,skrzynka)<100) if(self usebuttonpressed())
        {
        
    self iprintlnbold("TEST");
        }
        


    THX for help. Invictus

  2. #2
    Private First Class
    Join Date
    Dec 2012
    Posts
    127
    Thanks
    132
    Thanked 114 Times in 63 Posts
    didn't tested but on first sight I see what is wrong.

    self,skrzynka change to self.skrzynka

    P.S. try to use developer-mode to tell what's wrong in future.
    Last edited by Jeplaa; 14th March 2013 at 17:31.

  3. The Following User Says Thank You to Jeplaa For This Useful Post:

    kung foo man (14th March 2013)

  4. #3
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Also try to start the server with: +set developer 1
    timescale 0.01

  5. The Following User Says Thank You to kung foo man For This Useful Post:

    Jeplaa (14th March 2013)

  6. #4
    Private First Class
    Join Date
    Dec 2012
    Posts
    127
    Thanks
    132
    Thanked 114 Times in 63 Posts
    nah already edited my post

  7. #5
    Private Invictus's Avatar
    Join Date
    Mar 2013
    Location
    Poland
    Posts
    32
    Thanks
    25
    Thanked 13 Times in 6 Posts
    type undefined is not a vector :
    while(distance(self.skrzynka)<100) if(self usebuttonpressed())

    There is a problem. How to fix this?

  8. #6
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    You need to make a distance check between 2 points. And then check if its less than 100

  9. The Following User Says Thank You to Ni3ls For This Useful Post:

    kung foo man (14th March 2013)

  10. #7
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    PHP Code:
    distance(self.originskrzynka.origin
    timescale 0.01

  11. #8
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    while(distance(self,skrzynka)<100) if(self usebuttonpressed())
    {
    self iprintlnbold("TEST");
    }
    so many errors...

    you MUST be sure that self is defined and a player first!, you call this upron gamestart (because you precahced the model there...) so there might be NO player -> self is NOT the player there!

    but here is a corrected while-loop..

    Code:
    while( isDefined( self ) && isPlayer( self ) )
    {
            wait( 0.05 );
    
            if( !self useButtonPressed() )
                    continue;
            else if( distanceSquared( self.origin , blabla.origin ) > 100 * 100 )
                    continue;
    
            self iPrintLnBold( "TEST" );
    }

  12. The Following User Says Thank You to serthy For This Useful Post:

    kung foo man (14th March 2013)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •