Hi all!

I try to write a code for my gun. And now I have a problem with my code(what else? )

If press <ctrl> for shot, not the ball moves but my gun!
Plz help me!


Code:

function fWeapon_fire() I think it s correct...
{
Weapon_fire=1;
while(key_ctrl==1 || mouse_left==1){wait(1);}
Weapon_fire=0;
}

function fShoot(shot_speed,shot_gravity)
{

while(1)
{
c_move(me,vector(0,shot_speed*time,0),vector(0,0,shot_gravity*time),ignore_models);Here is my bug....?
shot_gravity-=0.05;
wait(1);
}
}

action aPlayer
{
ePlayer=me;

my._health=100;
my._shot_damage=25;
my._shot_speed=85;
my._shot_gravity=-0.1;
my._shots_per_sec=3;

var shot_speed;
var shot_gravity;

while(1)
{
if(Weapon_fire==1)
{
ent_create(sShot, vector(my.x+65,my.y, my.z+5),fShoot(my._shot_speed,my._shot_gravity)); or is it here...?
}
sleep(1/my._shots_per_sec);
}

}




thx nipx


PS: plz dont deride my code, I'm still a newbie!

Last edited by nipx; 04/21/06 01:51.