Ok, this is code creates an attach a weapon to a model, for thirth person shooter. It`s is supposed to fire bullets too.
thanks to some of you the code is working but I`m having some problems:

When firing the bullets the entity counter of the engine (F11) increases, but I can`t see the bullets, and it seems that they aren`t colliding with the walls as supposed. so they aren`t removed.

The function wich calls the exposion sprite causes syntaxt errors that I can`t see.

Here`s the code, can you give it a look?

Code:
action gun()

{

   gatlin1 =my;
    proc_mode = PROC_LATE;
    set(my,PASSABLE);  // the Gatlin shouldn't slow down the player
        
        while(player != NULL)
        {       
               vec_for_vertex (my.skill1, you, 1446); 
               vec_for_vertex (my.skill4, you, 1447); //special vertex made for this
               
   
               vec_diff (my.skill7, my.skill4, my.skill1);// compute the vector that will be used by the Gatlin
               vec_to_angle (my.pan, my.skill7);      // rotate the Gatlin accordingly
          
               // put the origin of the Gatlin in the vertex that is placed at the bottom of the arm
               vec_set (my.x, my.skill1); 
                          wait (1);
       }
} 


function fire_bullets()
{
	proc_kill(4); // don't allow more than 1 copy of this function to run
	while (mouse_left == 1) // this loop runs for as long as the left mouse button is pressed
	{
		vec_for_vertex (my.skill7, gatlin1, 75); // get the coordinates for the bullets' origin
		 // create the bullet at camera's position and attach it the "move_bullets" function
		ent_create (bullet_mdl, my.skill7, move_bullets);
		ent_create (muzzle_pcx, my.skill7, display_muzzle); // create the gun muzzle
		snd_play (bullet_wav, 100, 0); // play the bullet sound at a volume of 100
		wait (1*time_step); // fire 7 bullets per second (0.14 * 7 = 1 second)
	}
}

function move_bullets()
{
	var bullet_speed; // this var will store the speed of the bullet
	set(my,ENABLE_IMPACT); // the bullet is sensitive to impact
	  my.emask |= ENABLE_IMPACT;
   set(my,ENABLE_ENTITY); // and to other entities
	set(my,ENABLE_BLOCK); // as well as to level blocks
	my.event = remove_bullets; // when it collides with something, its event function (remove_bullets) will run
	my.pan = camera.pan; // the bullet has the same pan
	my.tilt = camera.tilt; // and tilt with the camera
	my.x = 0.1 * time_step; // adjust the speed of the bullet here
	my.y = 0; // the bullet doesn't move sideways
   my.z = 0; // then don't allow the gravity to have its ways with the bullet
	while (my != NULL) // this loop will run for as long as the bullet exists (it isn't "null")
	{
		// move the bullet ignoring the passable entities and store the result in distance_covered
		c_move (my, bullet_speed, nullvector, IGNORE_PASSABLE);
		wait (1);
	}
}

function remove_bullets() // this function runs when the bullet collides with something
{
	wait (1); // wait a frame to be sure (don't trigger engine warnings)
	ent_create (explosion_pcx, my.x, explosion_sprite); // create the explosion sprite
	set(my, PASSABLE); // the bullets becomes passable and invisible now
	set(my, INVISIBLE); // so it can't harm anyone anymore
	wait (-2); // wait until the explosion_sprite() function is over
	ent_remove (my); // and then remove the bullet
}

function display_muzzle()
{
	set(my,PASSABLE); // the muzzle is passable
	set(my,LIGHT); // make the black parts transparent even without using tga files (using a pcx file here)
	set(my,BRIGHT); // the muzzle should be bright
	my.ambient = 100; // and this line makes it even brighter
	set(my,DECAL); // the sprite is oriented
	my.pan = gatlin1.pan; // has the same pan and tilt
	my.tilt = gatlin1.tilt; // with the weapon
	my.roll = random(360); // and a random roll angle (looks nicer)
	my.scale_x = 0.5; // we scale it down
	my.scale_y = my.scale_x; // on all the axis
	my.scale_z = my.scale_z; // this would only be needed for a 3D (model-based) muzzle
	gatlin1.ambient = 100; // highlight the weapon (makes it look more realistic)
	wait (2); // show the muzzle sprite for 2 frames
	gatlin1.ambient = 0; // restore the normal weapon ambient value
	ent_remove (my); // and then remove it
}

//function explosion_sprite() every line gives a syntaxt error, I donīt know why!!?!
//{
//	set(my, PASSABLE); // the explosion sprite is passable
//	my.scale_x = 0.15; // we scale it down to 0.15
//	my.scale_y = my.scale_x; // on both axis
//	set(my, LIGHT)// set its flare
//	set(my,BRIGHT); // and bright flags
//	my.ambient = 100; // and we give it an ambient of 100
//	my.roll = random(360); // and has a random roll angle
//	set(my,TRANSLUCENT); // and make it transparent
//	my.alpha = 100; // but we set it to be completely opaque for now
//	while (my.frame < 5) // go through all the animation frames
//	{
//		my.frame += 2 * time; // animation speed
//      	wait (1);
//	}
//	while (my.alpha > 0) // now fade the last frame quickly
//	{
//		my.alpha -= 50 * time; // 50 = fading speed
//		wait (1);
//	}
//	ent_remove (my);
//}




WRYYYYYYYYYYYYYYYYYY!!!1!!ONE!!11