View Full Version : Spawn "box"
Invictus
14th March 2013, 17:26
Hi.
I make a script with spawn a box. When i run map cod2 have crash.
There is a script :
skrzynka()
{
precacheModel("xmodel/crate01");
skrzynka = spawn("script_model", (2206.32, 411.609, 54.6547));
skrzynka.angles = (2.21806, 151.797, -7.6227);
skrzynka setmodel("xmodel/crate01");
while(distance(self,skrzynka)<100) if(self usebuttonpressed())
{
self iprintlnbold("TEST");
}
}
THX for help. Invictus
Jeplaa
14th March 2013, 17:29
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.
kung foo man
14th March 2013, 17:31
Also try to start the server with: +set developer 1
Jeplaa
14th March 2013, 17:32
nah already edited my post :)
Invictus
14th March 2013, 17:37
type undefined is not a vector :
while(distance(self.skrzynka)<100) if(self usebuttonpressed())
There is a problem. How to fix this?
Ni3ls
14th March 2013, 17:43
You need to make a distance check between 2 points. And then check if its less than 100
kung foo man
14th March 2013, 17:49
distance(self.origin, skrzynka.origin)
serthy
14th March 2013, 18:18
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..
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" );
}
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.