Because you're using = as comparison, you have 2 onCreated's
Also, your script is 10x longer than it needs to be
edit: Why are you even using a timeout?
PHP Code:
function onCreated(){
this.on = false;
}
function onWeaponFired(){
this.on = !this.on;
player.alpha = (this.on) ? 50 : 100;
}