prototype of sword (this will replace the current sword's damage system only, it's not perfect, it has trouble hurting baddies and NPCs, and yes, i know it has to have an action serverside for other players i'll add that after i get the bugs wirked out with the baddies. the enemies can get too close and the baddies are hurt when im not facing the right direction ( i know why that happens for the player hitting one)
NPC Code:
//#CLIENTSIDE
if(isweapon){
if(keypressed&&strequals(#p(1),F)){
testx = playerx+.5;
testy = playery+2;
setani sword,;
for (i=1; i<playerscount; i++) {
if (abs(testx-(players[i].x+.5))<=2.5 && abs(testy-(players[i].y+1.5))<=3.5) {
hitplayer i,strtofloat(#s(clientr.playerswordlevel)),players[i].x,players[i].y;
}
if (!abs(testx-(players[i].x+.5))<=3.25 &&
!abs(testy-(players[i].y+1.5))<=3.25) {
if(playerdirection==0){hitobjects strtofloat(#s(clientr.playerswordlevel)),playerx+. 5,playery-1;}
if(playerdirection==2){hitobjects strtofloat(#s(clientr.playerswordlevel)),playerx+. 5,playery+3.25;}
if(playerdirection==1){hitobjects strtofloat(#s(clientr.playerswordlevel)),playerx-3,playery+1.5;}
if(playerdirection==3){hitobjects strtofloat(#s(clientr.playerswordlevel)),playerx+3 ,playery+1.5;}
}
}
}
}