Code: Select all
{
lbutton [false]
reloading [false]
bullets [5]
clipsize [30]
Spawn[ ()
{
Console(true);
HideFromRadar(true);
LowLevel("setup");
} ]
setup[ ()
{
self.think = "idle";
PawnRender(false);
} ]
idle[ ()
{
self.ThinkTime = 0;
if(self.lbutton_pressed and (lbutton = false))
{
if(bullets > 0)
{
fire();
AnimateHold(SHOOT);
self.think = "shoot";
return 0;
}
else
{
PlaySound(emptysound);
firetime = self.time + firerate;
if(fullauto = 0)
{
lbutton = true;
}
}
}
if(self.animate_at_end)
{
AnimateHold(IDLE);
}
if(((bullets = 0) or ((bullets < clipsize) and IsKeyDown(17))) and (GetAttribute(ammoattribute,"Player") > 0))
{
reloading = true;
}
if(reloading)
{
zoom = 1;
reloading = false;
AnimateHold(RELOAD);
self.think = "reload";
return 0;
}
} ]
fire[ ()
{
FireProjectile(rifle_shell, BIP01, 25, 25, 25, enemy_health;
} ]
}