Originally Posted By: Funeral
Originally Posted By: MrGuest
Code:
action a_player(){
  while(me){
    if(key_space){
      //Superku's code here
    }
    wait(1);
  }
}



yeah that's exactly what i have but after doing the action once it just doesnt wanna do it again when i press the key again

CODE

if(key_space)
{
while(counter > 0)
{

c_move(me,vector(10*time_step, 0, 0),vector(0, 0, 0), GLIDE);
counter -= time_step;
wait(1);
}
}
That's obviously not exactly what you have otherwise it'd be working
Code:
#include <acknex.h>
#include <default.c>

action a_player(){
	
	my.pan = 45;
	while(me){
		
		if(key_space){
			
			//Superku's code here
			var counter = 48; // 16ticks * 3 = 3 seconds
			while(counter > 0){
				c_move(me, vector(10*time_step, 0, 0), nullvector, NULL);
				counter -= time_step;
				wait(1);
			}
		}
		wait(1);
	}
}

void main(){

	level_load(NULL);
	ent_create(CUBE_MDL, vector(250, -150, 0), a_player);
}

Where's while(me)?