Eaí pessoal, sou meio novo nesse meio de scripts, porém já consegui fazer muitas coisas, mas estou com uma situação que nao consigo resolver. EX: Um time de 5 pessoas vai fazer um selo do ferumbras (shulgrax), todos ficam nos sqms necessarios para quando, puxar a alavanca, sejam tele-transportados para a sala do boss. O problema é que eles podem ficar o dia todo dentro da sala, e eu queria botar um kick, para que todos players que passarem mais de 15 minutos dentro da sala do boss, sejam tp pra fora.
Estou mandando a Action da alavanca e dois arquivos Shulgrax.lua que encontrei em CreatureScripts. Estou usando o OTX Server Global do malucooo
\Otxserver\data\actions\scripts\Novos\Alavanca7.lua
local function isPlayerInArea(fromPos, toPos)
for _x = fromPos.x, toPos.x do
for _y = fromPos.y, toPos.y do
for _z = fromPos.z, toPos.z do
creatureg = getTopCreature({x = _x, y = _y, z = _z})
if (isPlayer(creatureg.uid)) then
return true
end
end
end
end
return false
end
function onUse(cid, item, fromPosition, itemEx)
local player = Player(cid)
if not player then
return true
end
if(getGlobalStorageValue(93527) < 1) then
if item.itemid == 9825 then
if player:getStorageValue(1) and not isPlayerInArea({x = 33473, y = 32775, z = 13, stackpos = 255}, {x = 33499, y = 32798, z = 13, stackpos = 255}) then
pos1g = {x = 33434, y = 32785, z = getCreaturePosition(cid).z}
pos2g = {x = 33434, y = 32786, z = getCreaturePosition(cid).z}
pos3g = {x = 33434, y = 32787, z = getCreaturePosition(cid).z}
pos4g = {x = 33434, y = 32788, z = getCreaturePosition(cid).z}
pos5g = {x = 33434, y = 32789, z = getCreaturePosition(cid).z}
if(isPlayer(getTopCreature(pos1g).uid)) then
doTeleportThing(getTopCreature(pos1g).uid, {x = 33482, y = 32794, z = 13})
doTeleportThing(getTopCreature(pos2g).uid, {x = 33483, y = 32794, z = 13})
doTeleportThing(getTopCreature(pos3g).uid, {x = 33485, y = 32794, z = 13})
doTeleportThing(getTopCreature(pos4g).uid, {x = 33486, y = 32794, z = 13})
doTeleportThing(getTopCreature(pos5g).uid, {x = 33489, y = 32794, z = 13})
if(doTeleportThing) then
doRemoveCreature("Shulgrax")
--doSummonCreature("Shulgrax", {x = 33484, y = 32787, z = 13})
local monster = Game.createMonster("Shulgrax", Position(33484, 32788, 13))
monster:setReward(true)
--addEvent(AddBossg, 5 * 1000)
--setGlobalStorageValue(93527, 1)
--addEvent(setGlobalStorageValue, 20*60*1000, 93527, 0)
end
end
else doPlayerSendTextMessage(cid,19,"There are players inside the room or is missing players here.")
end
end
else
doPlayerSendCancel(cid, "Please, wait 20 minutes counting the last use to start again.")
end
return true
end
Otxserver\data\creaturescripts\scripts\Novos\shulgrax.lua
local posdotp4 = {x=33487, y=32780, z=13}
local storage = 99332
function MoveStone4() --creates wall back
local criistal4 = getTileItemById(posdotp4, 1353)
if not criistal4 then
Game.createItem(1353,1,posdotp4)-- Stone pos
else
Game.createItem(1353,1,posdotp4)
end
return true
end
function RemoveStone4()
local cristal4 = getTileItemById(posdotp4, 1353) -- Id do cristal azul que some para dar lugar ao tp
if cristal4 then
doRemoveItem(cristal4.uid, 1)
end
return true
end
function onKill(cid, target, damage, flags, corpse)
if(isMonster(target)) then
if(string.lower(getCreatureName(target)) == "shulgrax") then
setPlayerStorageValue(cid, storage, 1)
addEvent(RemoveStone4, 5 * 1000)
addEvent(MoveStone4, 300 * 1000)
end
end
return true
end
Otxserver\data\creaturescripts\scripts\FerumbrasAscedantQuest\Shulgrax.lua
local config = {
position = {x = 33486, y = 32796, z = 13}, -- Posição dos teleports.
position_to_tp_green = {x = 33460, y = 32820, z = 14},
position_to_tp_blue = {x = 33319, y = 32317, z = 13},
id_tp_blue = 1387,
id_tp_green = 25417,
monster_name = "shulgrax",
time = 3,
}
function removeAndCreateTp()
if(getTileItemById(config.position, config.id_tp_blue).itemid == config.id_tp_blue)then
tp = getTileItemById(config.position, config.id_tp_blue)
id = config.id_tp_green
pos = config.position_to_tp_green
else
tp = getTileItemById(config.position, config.id_tp_green)
id = config.id_tp_blue
pos = config.position_to_tp_blue
end
doRemoveItem(tp.uid, 1)
local x = Game.createItem(id, 1, config.position)
if(x:isTeleport())then
x:setDestination(Position(pos.x, pos.y, pos.z))
end
return true
end
function onKill(player, target)
local monster = target:getMonster()
if(not monster or monster:getName():lower() ~= config.monster_name)then
return true
end
removeAndCreateTp()
addEvent(removeAndCreateTp, config.time * 6000)
return true
end