for a first person shooter, i'm using an entity for the gun in hand, but it doesnt look realistic at all, because it isnt affected by lights and shadows. is there any way to achieve this?

also, i'm using the following code for one of the guns,
and about 1 in 5 shots it plays the shoot animation 2-3 times in a row.
does anyone know why this happens?

thanks

Quote:
entity pistol1
{
layer = 1;
type = <pistol.mdl>;
view = camera;
flags = visible;
x = 15;
y = -8;
z = -5;


}
function run_weapons()
{
wait(1);
var gun_percent = 0;
while(player != NULL)
{

while(key_space)
{
while (int(gun_percent) < 98)
{
ent_animate(pistol1,"shoot",gun_percent,ANM_CYCLE);
gun_percent = (gun_percent+15*time)%100;

wait(1.1);
}
gun_percent = 0;
}
wait(1);
}
}