you need a panel for that
panel crosshair_pan
{
bmp = "croshair.bmp";
my.visible = on;
}
Code:
function waepon
{
crosshair_pan.pos_x = (screen_size.x + crosshair_pan.size_x)/ 2;
// the crosshair has 16x16 pixels
crosshair_pan.pos_y = (screen_size.y + crosshair_pan.size_y)/ 2;
var mousel;
while(my != null)
{
vec_set(temp,vector(10000,0,0));//10000 ore longer
vec_rotate(temp,camera.pan);
vec_add(temp,camera.pan);
c_trace(camera.x,temp,ignore_me);// knows where the camera looks to
vec_set(temp,target.x);
vec_sub(temp,my.x);
vec_to_angle(my.pan,temp);//turns the weapon to the target
// close to the wall turns the weapon much
if(mouse_left == on && mousel == 1)
{
you = ent_create("bullet.mdl",nullvector,bullet_func);
vec_for_vertex(temp,my,22);//vertex(22) on the end of the loop
vec_set(you.x,temp);
vec_set(you.pan,my.pan);
mousel ==0;
}
if(mouse_left == off)
{
mousel = 1;
}
wait(1);
}
}