formatted/compacted better:
NPC Code:
//NPC made By Excaliber
//edited by Torankusu
if (playerenters){
playermp +=100;
toweapons Lightning 2;
}
//#CLIENTSIDE
//Checking to see if the weapon should be fired when the
//left mouse button is clicked down or not.
if(isweapon){
if (strequals(#w,Lightning 2)){
if (weaponfired && playermp>4 || mousedown && playermp>4){
set shooting;
timeout=.05;
}
}
}
if (timeout){
if (shooting){
disabledefmovement;
showimg 300,dr-crosshairs.png,mousex-.5,mousey-.35;
}
if (shooting){
if (keypressed){
if (strequals(#p(1),a)){
unset shooting;
hideimg 300;
enabledefmovement;
setani idle,;
}
}
}
timeout=.05;
}
if (mousedown && leftmousebutton && shooting){
unset shooting;
playermp=playermp-5; //remember to do this serverside.
newx2 = mousex;
newy2 = mousey;
putexplosion2 3,4,mousex-.75,mousey-.75;
for(i=1;i<100;i=i+25){
changeimgpart 400,0,0,35,i;
sleep .05;
}
hideimg 400;
hideimg 300;
setani idle,;
enabledefmovement;
hideimg 302;
sleep 3;
hideimg 301;
}
It won't shoot lightning online, but it works fine offline.