Code:
function Battleguard(pUnit, Event)
pUnit:RegisterEvent("Lookingforpvpers", 1000, 0)
end
function Lookingforpvpers(pUnit, Event)
local tbl = pUnit:GetInRangeFriends()
for k,v in pairs(tbl) do
if v:IsInCombat() == true and v:IsPlayerAttacking() == true and v:GetDistance(pUnit) <= 1800 then
pUnit:Kill(v)
end
end
end
RegisterUnitEvent(Npc id , 18, "Battleguard")
Code:
local ADG_ID = 13371337
local duelrecord = {}
function ADG_Spawn(ADG, Event)
ADG:RegisterEvent("InRangePlayerCheckForDuels", 2000, 0)
ADG:RegisterEvent("PeriodicPrint", 600000, 0) -- One hour
logcol(13)
print("[Anti-Duel Guard] Loaded Successfully!")
logcol(7)
end
function InRangePlayerCheckForDuels(ADG, Event)
local plrs = ADG:GetInRangePlayers()
for k, v in pairs(plrs) do
if (v:GetDuelState() == 1) then -- duel state started
table.insert(duelrecord, v:GetName())
ADG:Kill(v)
v:BroadcastAreaTriggerMessage("Do not duel in the mall! Your name has been logged!")
end
end
end
local PeriodicPrint = function(ADG, Event)
logcol(13) -- some beautiful magenta
print("[Anti-Duel Guard] These people have dueled within the last server restart:\n"..duelrecord)
logcol(7) -- return to its original grey
end
RegisterUnitEvent(ADG_ID, 18, "ADG_Spawn")