Sparkles
snek
I think I might be blind, but eh.
Im trying to kick players from the Demon Oak area after x amount of seconds, so they dont block it for others.
Somehow, using the normal axe on the tree after entering doesn't stop the event, can someone please tell me what im doing wrong here?
lua:
Im trying to kick players from the Demon Oak area after x amount of seconds, so they dont block it for others.
Somehow, using the normal axe on the tree after entering doesn't stop the event, can someone please tell me what im doing wrong here?
lua:
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local specs, spec = Game.getSpectators(DEMON_OAK_POSITION, false, false, 9, 9, 6, 6)
for i = 1, #specs do
spec = specs[i]
if player:getStorageValue(Storage.DemonOak.Progress) < 1 or player:getStorageValue(Storage.DemonOak.Progress) == 2 then
if spec:isPlayer() then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "Someone is already in there!")
return true
end
end
if spec:isMonster() then
spec:remove()
end
end
local function kickbois(cid)
local player = Player(cid)
if player then
player:teleportTo(DEMON_OAK_KICK_POSITION)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You should discuss your findings with Oldrak.')
end
end
if target.actionid == 50250 and target.itemid == 2709 and player:getStorageValue(Storage.DemonOak.Progress) < 1 then
if player:getLevel(cid) >= 120 then
player:teleportTo(DEMON_OAK_ENTER_POSITION)
addEvent(kickbois, 20000, player.uid)
player:setStorageValue(Storage.DemonOak.Progress, 1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It seems that you have discovered an Ultimate Challenge.')
else
player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You need to advance to level 120 before going into this place.')
end
elseif target.actionid == 50250 and target.itemid == 2709 and player:getStorageValue(Storage.DemonOak.Progress) == 1 then
player:teleportTo(DEMON_OAK_KICK_POSITION)
stopEvent(kickbois)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You should discuss your findings with Oldrak.')
end
end