Quote:
Originally Posted by fowlplay4
Well the use of a timeout and keydown would suffice, here's the basic shell of it.
PHP Code:
//#CLIENTSIDE
function onCreated() {
setTimer(0.05);
}
function onTimeout() {
// Check if weapon currently selected.
if (this.id == selectedweapon) {
// Check if "D" / Weapon key is pressed down
if (keydown(4)) onShoot();
// Loop
setTimer(0.1);
}
else setTimer(0.1);
}
function onShoot() {
// Gun shooting stuff here.
/*
would be your onWeaponFired code.
*/
}
|
Why would you always have a timeout running if not needed? And yeah, I forgot to add if the weapon was selected in mine, oops.
Also, "on" is for events, not for functions
