0% found this document useful (0 votes)
19 views2 pages

RunFromPK Lua

Jwjsnns

Uploaded by

mendezjuanh965
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views2 pages

RunFromPK Lua

Jwjsnns

Uploaded by

mendezjuanh965
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

local config = {

mainName = "Abagael",
keyWord = "Run, players detected!",
sayDelay = 5000,
groups = {
{minLevel = 0, maxLevel = 100, qty = 3},
{minLevel = 101, maxLevel = 200, qty = 2},
{minLevel = 201, maxLevel = 300, qty = 1},
{minLevel = 301, maxLevel = 9999, qty = 100},
},
detectionTimeOut = 5000, -- time to erase a detected player from memory.
ignoreFriends = true
}

-----------------------------------------------------------------------------------
---

local script = {}

addLabel()
addSeparator()
addLabel("","PK Detector"):setColor("green")
addSeparator()
addLabel()

[Link] = {}

[Link] = function(message)
modules.game_textmessage.displayGameMessage("[PK-Detector]: "..message)
end

[Link] = function(name)
schedule([Link] + 50, function()
if (now - [Link][name].detectTime) > [Link] then
[Link][name] = nil
end
end)
end

[Link] = function(name, level)


[Link][name] = {level = level, detectTime = now }
[Link](name)
end

[Link] = function(text)
return tonumber(text:match("(%d+)"))
end

[Link] = function(player)
local text = player:getText()
if text:len() > 0 then
local level = [Link](text)
return level
end
end

[Link] = 0
[Link] = function()
if now > [Link] then
[Link] = now + [Link]
talkPrivate([Link], [Link])
[Link]("Sending Message to main...")
end
end

script.m_process = macro(1000, "PK Detector", function()


for _, group in ipairs([Link]) do
local minLevel = [Link]
local maxLevel = [Link]
local qty = [Link]

local detecteds = 0
for _, player in pairs([Link]) do
local pLevel = [Link]
if pLevel >= minLevel and pLevel <= maxLevel then
detecteds = detecteds + 1
end
end
if detecteds >= qty then
return [Link]()
end
end
end)

onCreatureAppear(function(creature)
if script.m_process.isOff() then return end
schedule(100, function()
if creature:isPlayer() then
local name = creature:getName()
local isFriendOk = not [Link] or not
[Link]([Link], name, true)
if isFriendOk then
local level = [Link](creature)
if level then
[Link](name, level)
[Link]("Player detected: "..name..", tracking this
player now / detect timeout reseted!")
end
end
end
end)
end)

You might also like