This is the WHOLE guns.c script:
Code:
ENTITY* weap_uzi;
ENTITY* weap_m4a1;
ENTITY* hand_weap_uzi;
ENTITY* hand_weap_m4a1;
ENTITY* current_weapon;
ENTITY* muzzle_uzi;
SOUND* shot = "shot1.wav";
var muzzledistance;
var shot_handle;
// Weapon thumnails on screen when weapon is in hand
BMAP* uzi_tga = "uzi_icon.tga";
PANEL* uzi_icon ={pos_x = 885;pos_y = 598;layer = 10;bmap = uzi_tga;alpha = 25;}
// Muzzle images
BMAP* muzzle_uzi_tga = "muzzle.tga";
PANEL* muzzle_uzi_pan ={layer = 30;bmap = muzzle_uzi_tga;alpha = 100;}
// Crosshairs
BMAP* pointer1_tga = "pointer.tga";
PANEL* pointer1_pan ={pos_x = 487;pos_y = 359;layer = 2;bmap = pointer1_tga;alpha = 100;}
// General
BMAP* hand_tga = "hand.tga"; // Hand icon if close to weapon
PANEL* hand_pan ={pos_x = 462;pos_y = 334;layer = 3;bmap = hand_tga;alpha = 100;flags = OVERLAY;}
TEXT* hand_txt={alpha = 100;pos_x = 10;pos_y = 450;font = arial_font;string("Pickup Weapon (E)");}
function remove_guns(){
ent_remove(hand_weap_uzi);
ent_remove(hand_weap_m4a1);
}
function muzzle(){
if(automatic == 1){
while(mouse_left){
if(bullets > 0){
shot_handle = snd_play(shot, 100, 0);
current_weapon.tilt = camera.tilt + 13;
bullets = bullets - 1;
debug_muzzle_show = 1;
muzzle_uzi = ent_create("muzzle2.tga",vector(300,300,300),NULL);
muzzle_uzi.alpha = 40;
muzzle_uzi.flags = VISIBLE | OVERLAY | BRIGHT | TRANSLUCENT | PASSABLE;
muzzle_uzi.x = current_weapon.x + muzzledistance;
muzzle_uzi.y = current_weapon.y + 0;
muzzle_uzi.z = current_weapon.z;
var tmpx = random(0.1)+0.1;
var tmppan = random(359);
muzzle_uzi.scale_x = tmpx;
muzzle_uzi.scale_y = tmpx;
muzzle_uzi.roll = tmppan;
vec_diff(temp1,muzzle_uzi.x,current_weapon.x);
vec_set(muzzle_uzi.x,temp1.x);
vec_rotate(muzzle_uzi.x,current_weapon.pan);
vec_add(muzzle_uzi.x,current_weapon.x);
muzzle_uzi.ambient = 100;
wait(-0.1);
muzzle_uzi.flags = 0;
ent_remove(muzzle_uzi);
debug_muzzle_show = 0;
current_weapon.tilt = camera.tilt + 10;
shot_handle = snd_stop(shot, 100, 0);
}
wait(1);
}
}else{
if(bullets > 0){
bullets = bullets - 1;
debug_muzzle_show = 1;
muzzle_uzi = ent_create("muzzle2.tga",vector(300,300,300),NULL);
muzzle_uzi.alpha = 40;
muzzle_uzi.flags = VISIBLE | OVERLAY | BRIGHT | TRANSLUCENT | PASSABLE;
muzzle_uzi.x = weap_uzi.x + muzzledistance;
muzzle_uzi.y = weap_uzi.y + 0;
muzzle_uzi.z = weap_uzi.z;
var tmpx = random(0.1)+0.1;
var tmppan = random(359);
muzzle_uzi.scale_x = tmpx;
muzzle_uzi.scale_y = tmpx;
muzzle_uzi.roll = tmppan;
vec_diff(temp1,muzzle_uzi.x,weap_uzi.x);
vec_set(muzzle_uzi.x,temp1.x);
vec_rotate(muzzle_uzi.x,weap_uzi.pan);
vec_add(muzzle_uzi.x,weap_uzi.x);
muzzle_uzi.ambient = 100;
wait(-0.1);
muzzle_uzi.flags = 0;
ent_remove(muzzle_uzi);
debug_muzzle_show = 0;
}
}
}
//Dynamic gun actions, attached to gun in your hand
action uzi_action(){
muzzledistance = 50;
current_weapon = me;
debug_has_gun = 1;
bullets = 20;
automatic = 1;
pointer1_pan.flags = VISIBLE | OVERLAY;
hand_txt.flags = 0;
hand_pan.flags = 0;
me.scale_x = 0.5;
me.scale_y = 0.5;
me.scale_z = 0.5;
current_weapon.tilt = camera.tilt + 10;
while(1){
current_weapon.x = camera.x + 100;
current_weapon.y = camera.y - 40;
current_weapon.z = camera.z - 30;
vec_diff(temp1,current_weapon.x,camera.x);
vec_set(current_weapon.x,temp1.x);
vec_rotate(current_weapon.x,camera.pan);
vec_add(current_weapon.x,camera.x);
current_weapon.pan = camera.pan + 10;
uzi_icon.flags = VISIBLE | OVERLAY;
wait(1);
}
}
action m4a1_action(){
muzzledistance = 210;
current_weapon = me;
debug_has_gun = 1;
bullets = 35;
automatic = 1;
pointer1_pan.flags = VISIBLE | OVERLAY;
hand_txt.flags = 0;
hand_pan.flags = 0;
me.scale_x = 3;
me.scale_y = 3;
me.scale_z = 3;
while(1){
current_weapon.x = camera.x + 100;
current_weapon.y = camera.y - 40;
current_weapon.z = camera.z - 30;
vec_diff(temp1,current_weapon.x,camera.x);
vec_set(current_weapon.x,temp1.x);
vec_rotate(current_weapon.x,camera.pan);
vec_add(current_weapon.x,camera.x);
current_weapon.pan = camera.pan + 10;
current_weapon.tilt = camera.tilt + 10;
if(bullets > 0 && bullets < 11){
uzi_icon.flags = VISIBLE | OVERLAY;
wait(1);
}
}
//function func_get_uzi;
//function func_get_m4a1;
// Gun functions
function func_get_uzi(){
if(debug_has_gun == 1){ent_remove(current_weapon);debug_has_gun = 0;debug_tmp = 1;}
muzzledistance = 50;
current_weapon = me;
debug_has_gun = 1;
bullets = 20;
automatic = 1;
pointer1_pan.flags = VISIBLE | OVERLAY;
hand_txt.flags = 0;
hand_pan.flags = 0;
me.scale_x = 0.5;
me.scale_y = 0.5;
me.scale_z = 0.5;
current_weapon.tilt = camera.tilt + 10;
while(1){
current_weapon.x = camera.x + 100;
current_weapon.y = camera.y - 40;
current_weapon.z = camera.z - 30;
vec_diff(temp1,current_weapon.x,camera.x);
vec_set(current_weapon.x,temp1.x);
vec_rotate(current_weapon.x,camera.pan);
vec_add(current_weapon.x,camera.x);
current_weapon.pan = camera.pan + 10;
uzi_icon.flags = VISIBLE | OVERLAY;
wait(1);
}
}
function func_get_m4a1(){
if(debug_has_gun == 1){ent_remove(current_weapon);debug_has_gun = 0;debug_tmp = 1;}
muzzledistance = 210;
current_weapon = me;
debug_has_gun = 1;
bullets = 35;
automatic = 1;
pointer1_pan.flags = VISIBLE | OVERLAY;
hand_txt.flags = 0;
hand_pan.flags = 0;
me.scale_x = 3;
me.scale_y = 3;
me.scale_z = 3;
while(1){
current_weapon.x = camera.x + 100;
current_weapon.y = camera.y - 40;
current_weapon.z = camera.z - 30;
vec_diff(temp1,current_weapon.x,camera.x);
vec_set(current_weapon.x,temp1.x);
vec_rotate(current_weapon.x,camera.pan);
vec_add(current_weapon.x,camera.x);
current_weapon.pan = camera.pan + 10;
current_weapon.tilt = camera.tilt + 10;
if(bullets > 0 && bullets < 11){
uzi_icon.flags = VISIBLE | OVERLAY;
wait(1);
}
}
// Static Guns
action gun_uzi(){
c_setminmax(my);
weap_uzi = my;
my.emask |= ENABLE_IMPACT;
my.event = func_get_uzi;
while(1){
if(vec_dist(weap_uzi.x,player.x)<120){
debug_gun_range = 1;
hand_pan.flags = VISIBLE;
hand_txt.pos_x = screen_size.x / 2;
hand_txt.flags = VISIBLE | CENTER_X;
}else{
debug_gun_range = 0;
hand_pan.flags = 0;
hand_txt.flags = 0;
}
my.pan = my.pan + 0.5;
wait(1);
}
}
action gun_m4a1(){
c_setminmax(my);
weap_m4a1 = my;
my.emask |= ENABLE_IMPACT;
my.event = func_get_m4a1;
while(1){
if(vec_dist(weap_m4a1.x,player.x)<120){
debug_gun_range = 1;
hand_pan.flags = VISIBLE;
hand_txt.pos_x = screen_size.x / 2;
hand_txt.flags = VISIBLE | CENTER_X;
}else{
debug_gun_range = 0;
hand_pan.flags = 0;
hand_txt.flags = 0;
}
my.pan = my.pan + 0.5;
wait(1);
}
}
I can't find any missing semicolons or brackets...