09-17-2021, 04:36 PM
All makers attack the PK
This script will check if character is being attacked by a PK and write PK id in a file. Every other character that's using this same script will check this file and attack PK.
keywords: attack pk, combo pk, makers pk, makers player killer
This script will check if character is being attacked by a PK and write PK id in a file. Every other character that's using this same script will check this file and attack PK.
local SAFE_LIST = { 'player one', 'pk two', 'another player' }
local RUNE = 'sudden death rune'
local MUST_ATTACK = false -- Should it attack (red-square) either?
local file_name = 'attack_pk'
table.lower(SAFE_LIST)
if connected() then
local player_x = posx()
local player_y = posy()
local player_z = posz()
local attacked_pk = false
local creatures = getcreatures('pfs')
for _, creature in ipairs(creatures) do
if creature.isattackme and (creature.skull == 3 or creature.skull == 4) and (creature.posx ~= player_x or creature.posy ~= player_y) and player_z == creature.posz and table.find(SAFE_LIST, creature.name:lower()) == nil then
attacked_pk = true
file.rewrite(file_name, os.time(os.date("!*t")))
file.writeline(file_name, creature.id)
if MUST_ATTACK then
attack(creature.id)
end
useitemoncreature(RUNE, creature.id)
wait(1000)
break
end
end
if attacked_pk == false then
local time = file.readline(file_name, 0)
local tmp = tonumber(time)
if tmp ~= nil then
if (os.time(os.date("!*t")) - time) <= 30 then
local creature_id = file.readline(file_name, 1)
if MUST_ATTACK then
attack(creature_id)
end
useitemoncreature(RUNE, creature_id)
end
end
end
end
keywords: attack pk, combo pk, makers pk, makers player killer