Ok. I haven't had many server jobs and im not very good at online scripting. So I need help with this fireworks script.
It works just fine for the leader but only he can see the fireworks.
NPC Code:
// NPC made by Rogue Shadow -TT-*C* (TCN)
if (created){this.time=0;timereverywhere;}
if (((playerenters)||timeout)&&this.firing==false){
this.firing=true;
this.red=random(0,1);this.green=random(0,1);this.b lue=random(0,1);
this.on=3;
this.angle = 6.28+random(-(3.14/8),(3.14/8));
this.mag = random(10,26);
this.x=x - (sin(this.angle)*this.mag);
this.y=y - (cos(this.angle)*this.mag);
this.startx=x;
this.starty=y;
geta();
}
function geta(){
this.dx=(this.x-this.startx);
this.dy=(this.y-this.starty);
this.mag = ((this.dx^2+this.dy^2)^.5)*.1;
this.angle=getangle(this.dx,this.dy)+(3.14/2);
this.vel = {sin(this.angle)*this.mag , cos(this.angle)*this.mag };
timeout=.05;
play fire.wav;
}
if (timeout&&this.on==3){
if (lighteffectsenabled){
showimg 5,light2.png,this.startx,this.starty;
changeimgzoom 5,.3;
changeimgcolors 5,1,1,1,.9;
}else{
showimg 5,@arial@o,this.startx,this.starty;
}
this.startx+=this.vel[0];
this.starty+=this.vel[1];
this.vel[1]+=.05;
if ( this.vel[1] > (0+random(0,2)) ){
timeout=0;
this.on=false;
explode();
hideimg 5;
}
timeout=.05;
}
if (timeout&&this.explode==true){
draw_dot();
timeout=.05;
if (this.time>70){
this.firing=false;
this.time=-1;
this.explode=false;
hidestuff();
timeout=random(.5,3);
}
}
function explode(){
this.time=0;
setarray this.vars,int(random(1,200))*6;
for (i=0;i<arraylen(this.vars);i+=6){
this.vars[i+0]=this.startx;
this.vars[i+1]=this.starty;
this.vars[i+2]=random(0,6.28);
this.vars[i+3]=random(.1,1);
}
this.explode=true;
timeout=.05;
play fire.wav;
}
function draw_dot(){
this.time++;
for (i=0;i<arraylen(this.vars);i+=6){
for (i=0;i<arraylen(this.vars);i+=6){
this.vars[i+0]=this.vars[i+0]+this.vars[i+4];
this.vars[i+5]+=(.05*this.time);
this.vars[i+1]=this.vars[i+1]+this.vars[i+5];
if (lighteffectsenabled){
showimg i,light2.png,this.vars[i+0],this.vars[i+1];
changeimgzoom i,.15;
changeimgcolors i,this.red,this.green,this.blue,.9;
}else{
showimg i,@arial@.,this.vars[i+0],this.vars[i+1];
}
vector();
}
}
}
function vector(){
this.dx = (this.vars[i+0] - ((this.vars[i+0] + ( sin(this.vars[i+2])*this.vars[i+3]))));
this.dy = (this.vars[i+1] - ((this.vars[i+1] + ( cos(this.vars[i+2])*this.vars[i+3]))));
this.mag = (this.dx^2+this.dy^2)^.5;
this.vars[i+4] = (this.dx/this.mag)*this.vars[i+3];
this.vars[i+5] = (this.dy/this.mag)*this.vars[i+3];
}
function hidestuff(){
for (this.i=0;this.i<arraylen(this.vars)*4;this.i+=4)h ideimg this.i;
}
It's not the prettiest script in the world I know.
Please don't use this without asking.
But anyhow as I said only first person in the level can see so I guess it wouldn't do you a lot of good except to see for yourself.
I tried everything I can think of. But im not very good at online scripting. This is for a non-npc-server , server.
Also if you wanna post and tell me you like my fireworks that will be cool too.

It makes me happy.