Thanks for the awesome explanation Chris and Dusty. I have another question, is there a better way to have a more accurate hit detection? I tried making a showpoly that would show me the area being hit but it doesn't seem to hit correctly in the box.
PHP Code:
function onActionServerSide(hittx, hitty) {
this.range = - 3;
for (pl: findNearestPlayers(player.x, player.y)) {
if (pl.account != player.account) {
if (pl.x in | hittx + this.range, hittx | && pl.y in | hitty + this.range, hitty | ) {
//Do stuff
}
}
}
}
//#CLIENTSIDE
function onKeyPressed() {
if (keydown(6)) {
temp.hitx = player.x + 1.4 + vecx(player.dir) * 2;
temp.hity = player.y + 1.5 + vecy(player.dir) * 2;
test.lol = showpoly(200, {
temp.hitx - 1.5, temp.hity - 1.5,
temp.hitx + 1.5, temp.hity - 1.5,
temp.hitx + 1.5, temp.hity + 1.5,
temp.hitx - 1.5, temp.hity + 1.5});
test.lol.mode = 1;
test.lol.alpha = .5;
triggerserver("gui", name, temp.hitx, temp.hity);
}
}