Bom no evento que são dois times, só que os players escolhem em qual time querem entrar através de dois teleports, eu queria botar um teleport só, aí iriam aleatoriamente para os times
Porque ficam fazendo panela e entrando em 1 time só
OTX 2 [8.6]
WarLIB
WAR_Lib_Config = {
Time = 3, -- tempo em minutos para comecar o evento
Kills = 500, -- quantos kills para ganhar o evento
Award = {11459,1}, -- recompensa {id do item, quantidade}
TeamYondaime = {name = "Yondaime", storage = 7800, outfit = 1182, pos = {x=1011, y=640, z=7}},
TeamTobi = {name = "Tobi", storage = 7801, outfit = 1220, pos = {x=1012, y=587, z=7}},
TemplePos = {x=1026, y=910, z=7},
WarArea = {from = {x=984, y=578, z=5}, to = {x=1044, y=652, z=7}},
}
function ShinobiWarCheck()
check = 0
for a, b in pairs(getPlayersOnline()) do
if getPlayerStorageValue(b, WAR_Lib_Config.TeamYondaime.storage) > 0 then
check = check + 1
break
end
end
for c, d in pairs(getPlayersOnline()) do
if getPlayerStorageValue(d, WAR_Lib_Config.TeamTobi.storage) > 0 then
check = check + 1
break
end
end
if check >= 2 then
ShinobiWarClose()
ShinobiWarOpenGates()
doBroadcastMessage("Evento Shinobi War começou!", MESSAGE_EVENT_ADVANCE)
else
ShinobiWarCancel()
doBroadcastMessage("Evento Shinobi War cancelado por falta de participantes.", MESSAGE_EVENT_ADVANCE)
end
end
function ShinobiWarOpenGates()
local config = {
[1] = getTileItemById({x=1013, y=583, z=7}, 6247).uid,
[2] = getTileItemById({x=1013, y=590, z=7}, 6247).uid,
[3] = getTileItemById({x=1012, y=637, z=7}, 6247).uid,
[4] = getTileItemById({x=1012, y=644, z=7}, 6247).uid,
[5] = getTileItemById({x=1017, y=586, z=7}, 6245).uid,
[6] = getTileItemById({x=1008, y=586, z=7}, 6245).uid,
[7] = getTileItemById({x=1007, y=640, z=7}, 6245).uid,
[8] = getTileItemById({x=1016, y=640, z=7}, 6245).uid,
}
for i = 1, #config do
if config[i] > 0 then
doRemoveItem(config[i])
end
end
end
function ShinobiWarCloseGates()
local config = {
[1] = getTileItemById({x=1013, y=583, z=7}, 6247).uid,
[2] = getTileItemById({x=1013, y=590, z=7}, 6247).uid,
[3] = getTileItemById({x=1012, y=637, z=7}, 6247).uid,
[4] = getTileItemById({x=1012, y=644, z=7}, 6247).uid,
[5] = getTileItemById({x=1017, y=586, z=7}, 6245).uid,
[6] = getTileItemById({x=1008, y=586, z=7}, 6245).uid,
[7] = getTileItemById({x=1007, y=640, z=7}, 6245).uid,
[8] = getTileItemById({x=1016, y=640, z=7}, 6245).uid,
}
if config[1] < 1 then
doCreateItem(6247,1,{x=1013, y=583, z=7})
end
if config[2] < 1 then
doCreateItem(6247,1,{x=1013, y=590, z=7})
end
if config[3] < 1 then
doCreateItem(6247,1,{x=1012, y=637, z=7})
end
if config[4] < 1 then
doCreateItem(6247,1,{x=1012, y=644, z=7})
end
if config[5] < 1 then
doCreateItem(6245,1,{x=1017, y=586, z=7})
end
if config[6] < 1 then
doCreateItem(6245,1,{x=1008, y=586, z=7})
end
if config[7] < 1 then
doCreateItem(6245,1,{x=1007, y=640, z=7})
end
if config[8] < 1 then
doCreateItem(6245,1,{x=1016, y=640, z=7})
end
end
function ShinobiWarClose()
if getTileItemById({x=1017, y=905, z=7}, 1028).uid < 1 then
doCreateItem(1028,1,{x=1017, y=905, z=7})
end
if getTileItemById({x=1025, y=670, z=7}, 1026).uid < 1 then
doCreateItem(1026,1,{x=1025, y=670, z=7})
end
if getTileItemById({x=1028, y=670, z=7}, 1026).uid < 1 then
doCreateItem(1026,1,{x=1028, y=670, z=7})
end
local mob1 = getTopCreature({x=1017, y=905, z=7}).uid
local mob2 = getTopCreature({x=1025, y=670, z=7}).uid
local mob3 = getTopCreature({x=1028, y=670, z=7}).uid
if isPlayer(mob1) then
doTeleportThing(mob1, {x=1017, y=905+1, z=7})
end
if isPlayer(mob2) then
doTeleportThing(mob2, {x=1025, y=670+1, z=7})
end
if isPlayer(mob3) then
doTeleportThing(mob3, {x=1028, y=670+1, z=7})
end
end
function ShinobiWarCancel()
ShinobiWarClose()
ShinobiWarCloseGates()
setGlobalStorageValue(WAR_Lib_Config.TeamYondaime.storage, -1)
setGlobalStorageValue(WAR_Lib_Config.TeamTobi.storage, -1)
for x = WAR_Lib_Config.WarArea.from.x, WAR_Lib_Config.WarArea.to.x do
for y = WAR_Lib_Config.WarArea.from.y, WAR_Lib_Config.WarArea.to.y do
for z = WAR_Lib_Config.WarArea.from.z, WAR_Lib_Config.WarArea.to.z do
local mob = getTopCreature({x=x, y=y, z=z}).uid
if isPlayer(mob) then
setPlayerStorageValue(mob, WAR_Lib_Config.TeamYondaime.storage, -1)
setPlayerStorageValue(mob, WAR_Lib_Config.TeamTobi.storage, -1)
doRemoveCondition(mob, CONDITION_POISON)
doRemoveCondition(mob, CONDITION_PARALYZE)
doRemoveCondition(mob, CONDITION_OUTFIT)
doRemoveCondition(mob, CONDITION_INFIGHT)
doCreatureAddHealth(mob, getCreatureMaxHealth(mob))
doTeleportThing(mob, getClosestFreeTile(mob, WAR_Lib_Config.TemplePos))
end
end
end
end
end
function ShinobiWarOpen()
local config = {
[1] = getTileItemById({x=1017, y=905, z=7}, 1028).uid,
[2] = getTileItemById({x=1025, y=670, z=7}, 1026).uid,
[3] = getTileItemById({x=1028, y=670, z=7}, 1026).uid,
}
for i = 1, #config do
if config[i] > 0 then
doRemoveItem(config[i])
end
end
end
Movements teleport:
function onStepIn(cid, item, position, fromPosition)
if item.actionid == 11230 then
if getPlayerAccess(cid) > 1 then
return doTeleportThing(cid, getClosestFreeTile(cid, WAR_Lib_Config.TeamTobi.pos))
end
doSetCreatureOutfit(cid, {lookType = WAR_Lib_Config.TeamTobi.outfit}, -1)
setPlayerStorageValue(cid, WAR_Lib_Config.TeamTobi.storage, 1)
doTeleportThing(cid, getClosestFreeTile(cid, WAR_Lib_Config.TeamTobi.pos))
elseif item.actionid == 11231 then
if getPlayerAccess(cid) > 1 then
return doTeleportThing(cid, getClosestFreeTile(cid, WAR_Lib_Config.TeamYondaime.pos))
end
doSetCreatureOutfit(cid, {lookType = WAR_Lib_Config.TeamYondaime.outfit}, -1)
setPlayerStorageValue(cid, WAR_Lib_Config.TeamYondaime.storage, 1)
doTeleportThing(cid, getClosestFreeTile(cid, WAR_Lib_Config.TeamYondaime.pos))
elseif item.actionid == 11232 then
doRemoveCondition(cid, CONDITION_OUTFIT)
setPlayerStorageValue(cid, WAR_Lib_Config.TeamYondaime.storage, -1)
setPlayerStorageValue(cid, WAR_Lib_Config.TeamTobi.storage, -1)
doTeleportThing(cid, WAR_Lib_Config.TemplePos)
end
return true
end
@xWhiteWolf @Breno Neves@Vodkart