Of course; here is the working code:

Code:
define barrel_handle, skill1;

action ent_turret
{
my.barrel_handle = handle(ent_create("turret_barrel.mdl", my.x, NULL));

while(my) {

you = ptr_for_handle(my.barrel_handle);

var vec_to_ent[3];
var ang_to_ent[3];

vec_diff(vec_to_ent, camera.x, my.x); // direction vector

// transform the direction vector into local space via rotating it
// by the turrets inverted angles
vec_rotate(vec_to_ent, vector(-my.pan,0,0));
vec_rotate(vec_to_ent, vector(0,-my.tilt,0));
vec_rotate(vec_to_ent, vector(0,0,-my.roll));

vec_to_angle(ang_to_ent, vec_to_ent); // angle of direction vector

// first rotate the turret's body
ang_rotate(my.pan, vector(ang_to_ent.pan,0,0));

// now rotate the barrel
vec_set(you.pan, my.pan);
ang_rotate(you.pan, vector(0,ang_to_ent.tilt,0));



wait(1);
}
}