1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
addhook("hit","knockback") function knockback(id,source,weapontype) if player(id,"team")==1 and player(id,"team")~=player(source,"team") then local DMG = (itemtype(weapontype,"dmg") / 2) local ROT = math.rad(player(source,"rot") - 90) local NX = player(id,"x") + (math.cos(ROT) * DMG) local NY = player(id,"y") + (math.sin(ROT) * DMG) if tile(NX / 32 - 1,NY / 32 - 1,"walkable") then parse(string.format("setpos %s %s %s",id,NX,NY)) end end end