can any body make a script that can push players on hit?
i know we have it already but its for zambie mod
i want a sample script that we can paste it in "autorun"folder
[to use it]
did we have?
here.. eat some
! (LOL)
Scripts
Knockback Script?
Knockback Script?
1

! (LOL) addhook("hit", "hithook")
function hithook (id, source, weapon, hpdmg)
	if (weapon < 50 or weapon > 69) then
		knockback(source, id, weapon)
	end
end
function knockcheck (x, y, rotation, knock)
	local breaks, op1, op2
	for distance = 5, math.ceil(knock), 2 do
		op1 = x + math.cos(rotation) * distance
		op2 = y + math.sin(rotation) * distance
		if (not tile(math.ceil(op1 / 32) - 1, math.ceil(op2 / 32) - 1, "walkable")) then
			breaks = true
			break
		end
	end
	return breaks
end
function knockback (id, source, weapon)
	if (weapon < 99) then
		local knock = itemtype(weapon, "dmg") / 2
		local rotation = player(id, "rot")
		if (rotation < -90) then
			rotation = rotation + 360
		end
		local angle = math.rad(math.abs(rotation + 90)) - math.pi
		x = player(source, "x") + math.cos(angle) * knock
		y = player(source, "y") + math.sin(angle) * knock
		if (not knockcheck(player(source, "x"), player(source, "y"), angle, knock)) then
			parse("setpos " .. source .. " " .. x .. " " .. y)
		end
	end
end
N13-SHADOW has written
1
