hitplayer(this.id,0,hitfromx,hitfromy);
If you're using the default system, that should work. It will hit the player away from the given 'hitfromx/y'. this.id
should find your own player, but I'm not entirely sure.
So... probably something like this...
Projectile:
PHP Code:
temp.sx = (player.x+1.5) - (this.x+1.5);
temp.sy = (player.y+2) - (this.y+2);
temp.sangle = getangle(sx,sy);
setshootparams("arrow",sangle); // You MUST send the angle at which the projectile is flying.
shoot(this.x,this.y,this.z,sangle,0,0,"projectilegani",null);
Now this probably looks nothing like the projectile you're using, as I've rigged this in an NPC to shoot projectiles at my player. The point is, however, to pass the angle the projectile is traveling in setshootparams(). This is because projectiles that actually hit objects do not send which direction they are coming from, so you have to eventually calculate that yourself.
So onto the weapon itself(you should have one global weapon or such that all players get to handle projectile hits).:
PHP Code:
//#CLIENTSIDE
function onActionProjectile(obj,sangle) {
if (obj == "arrow") { // Is it an arrow? You should do these sort of checks
temp.hitx = player.x+1.5+cos(sangle+pi); // Calculate where the projectil came from
temp.hity = player.y+2-sin(sangle+pi);
hitplayer(this.id,0,hitx,hity);
}
}
When the projectile hits the player, it will take the angle of the projectile, reverse it(by adding pi to it), and then calculate it 1 tile away from the player. This will give you an accurate idea of where the projectile landed a tile away, therefor letting you hit the player from there.