Syntax error... why ?

Posts 115 of 21 · Page 1 of 2
Syntax error... why ?
I wanted to give the last human surviving the abillity to freeze all opponents and hide for 30 secs. I came up with the following code which got me a syntax error:
Code:
LastAliveFreeze() {
	
	self endon ( "disconnect" );
	self endon ( "death" );
	
	self notifyOnPlayerCommand( "[{+actionslot 1}]", "+actionslot 1" );
	
	for(;;)

        {

        	self waittill ( "[{+actionslot 1}]" );
		self PlaySoundToPlayer( "item_nightvision_on", self );
		{
		level.attackFreeze = self.team;
		foreach ( player in level.players )
		{	
		if ( player.team != level.attackFreeze )
		{
		level.doFreeze = 1;
		player thread doFreeze();
		self hide();
		wait 30;
		player thread unFreeze();
		self unhide();
		}
	}


doFreeze()
{
	while ( level.doFreeze == true )
		{
		self freezeControls(true);
		wait 0.05;
		}
}
unFreeze()
{
level.doFreeze = 0;
self freezeControls(false);
}
What did i do wrong and how can i make it so he can only do it once ?
Code:
LastAliveFreeze() {
	
	self endon ( "disconnect" );
	self endon ( "death" );
	
	self notifyOnPlayerCommand( "[{+actionslot 1}]", "+actionslot 1" );
	
	for(;;)

        {

        	self waittill ( "[{+actionslot 1}]" );
		self PlaySoundToPlayer( "item_nightvision_on", self );
		{
		     level.attackFreeze = self.team;
		     foreach ( player in level.players )
		     {	
		          if ( player.team != level.attackFreeze )
		          {
		          level.doFreeze = 1;
		          player thread doFreeze();
		          self hide();
		          wait 30;
		          player thread unFreeze();
		          self unhide();
		          }
	          }
          }
     }
}

doFreeze()
{
	while ( level.doFreeze == true )
		{
		self freezeControls(true);
		wait 0.05;
		}
}
unFreeze()
{
level.doFreeze = 0;
self freezeControls(false);
}
Try that... You missed a few '}'
lol i thought i checked em XD thx. Do u know how to make it accessable only once ?
edit:still bad syntax
Quote Originally Posted by kerocx View Post
lol i thought i checked em XD thx. Do u know how to make it accessable only once ?
edit:still bad syntax
You may be able to use a boolean and an if statement...

bool a = true;
if a = true then {
//YOUR CODE
a = false;
}

I highly doubt that thats correct, I dont do C...
You have too many open braces {
Code:
LastAliveFreeze() {
	
	self endon ( "disconnect" );
	self endon ( "death" );
	
	self notifyOnPlayerCommand( "[{+actionslot 1}]", "+actionslot 1" );
	
	for(;;)

        {

        	self waittill ( "[{+actionslot 1}]" );
		self PlaySoundToPlayer( "item_nightvision_on", self );
		{
		level.attackFreeze = self.team;
		foreach ( player in level.players )
		{	
		if ( player.team != level.attackFreeze )
		{
		level.doFreeze = 1;
		player thread doFreeze();
		self hide();
		wait 30;
		player thread unFreeze();
		self unhide();
		}
		}
		}
	}
}


doFreeze()
{
	while ( level.doFreeze == true )
		{
		self freezeControls(true);
		wait 0.05;
		}
}
unFreeze()
{
level.doFreeze = 0;
self freezeControls(false);
}
Thanks that solved the sintax, but now i have an unknown function... what could that be ?
It's probably this:
self notifyOnPlayerCommand( "[{+actionslot 1}]", "+actionslot 1" );
self waittill ( "[{+actionslot 1}]" );
I suggest you turn [{+actionslot 1}] to N instead.
When you get an unknown function, the error says which one.
Check what the error says, and search for that.
it only says script compile error unknown function. And how would the changing actionslot to n change anything ?
Quote Originally Posted by kerocx View Post
it only says script compile error unknown function. And how would the changing actionslot to n change anything ?
Just try it. Its that easy to find out...
I did but its just a label nothing else. Still getting the unknown function error. Is someone willing to rewrite the code for me ? Cause it looks like it sucks
Well first of all, what in the world is level.attackFreeze?
EDIT - Never mind. It's late and I'm not thinking straight.
level.attackFreeze is defined or ? Could it be that there is an issue with for and if ?
No, it's defined. level.attackFreeze = self.team!
I'm just wondering, according to MW2 it says to look at the console (which I did) and this is what I got:

******* script compile error *******
Error: unknown function: Error: @ 148909
************************************
Anyone know what 148909 is supposed to be?
Posts 115 of 21 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?