Skip to content

OnMeleeHitZone

A player’s swing reached a target zone.

Half a second after the swing began, the server reaches from the player’s chest along their facing as far as the drawn weapon reaches (a fist about a metre) and calls this for every zone marked with SetZoneHittable the reach enters. It is a reach, not the blade’s path: a training post or a straw dummy, not a duel.

function OnMeleeHitZone(pid, zone, weapon, x, y, z)
-- ...
end
Parameter Type
pid number the player
zone number the zone reached
weapon string the drawn weapon by its table name; "fists" without one
x number where the reach entered the zone, metres
y number metres
z number metres

nothing

-- a pell to practise on: count the blows
local pell = CreateZone(1280, 1100, 26, 1280.4, 1100.4, 28)
SetZoneHittable(pell, true)
function OnMeleeHitZone(pid, zone, weapon)
if zone == pell then SendClientMessage(pid, COLOR_GREY, "A clean hit with your " .. weapon) end
end

SetZoneHittable · OnProjectileHitZone · the Zones group of the index