
when i use the sword type weapon it dont do anything so what should i do and heres the codes
weapon
NPC Code:
//#CLIENTSIDE
if (weaponfired){
setani dg_katana_attack,;
freezeplayer 0.25;
triggeraction 0,0,serverattack,;
}
join hpfunctions
hp functions
NPC Code:
function attackplayers() {
pid = playerid;
pindexes = getnearestplayers(this.attackx,this.attacky,player id!=pid);
dist = 0;
for (i=0; i<arraylen(pindexes); i++) {
with (players[pindexes[i]]) {
dx = playerx + 1.5 - this.attackx;
dy = playery + 2 - this.attacky;
dist = (dx*dx + dy*dy)^0.5;
if (dist<=2)
hurtplayer();
}
if (dist>2)
break;
}
}
function hurtplayer() {
newhp = strtofloat(#s(clientr.hp)) - this.attackpower;
if (newhp<=0) {
newhp = 3;
setani dead,;
} else {
setani hurt,;
}
setstring clientr.hp,#v(newhp);
and the action server attack i named the class attack
NPC Code:
if (actionserverattack) {
// A sword-type weapon
// Check for players
this.attackx = playerx + 1.5 + vecx(playerdir)*2;
this.attacky = playery + 2 + vecy(playerdir)*2;
this.attackpower = 1;
attackplayers();
attacknpcs();
}
join hpfunctions;
please tell me why when i hit people with the katana it dont do anything please.