Postado Abril 28, 2014 11 anos Quando o evento não inicia por falta de player o evento é desativado, o problema é que os players que já estão na arena não sao teleportados pro templo ficam la. -- CONFIG ZE_DEFAULT_NUMBER_OF_PLAYERS = 10 ZE_ACCESS_TO_IGNORE_ARENA = 3 -- POSITIONS ZE_blockEnterItemPosition = {x= 31993, y=32353, z=6} ZE_enterPosition = {x = 31987, y = 32378, z = 7} ZE_kickPosition = {x=32369, y=32241, z=7} ZE_spawnFromPosition = {x = 31968, y = 32376, z = 7} ZE_spawnToPosition = {x = 32010, y = 32376, z = 7} -- ITEM IDS ZE_blockEnterItemID = 2555 -- STORAGES -- - player ZE_isOnZombieArea = 34370 -- - global ZE_STATUS = 34370 -- =< 0 - off, 1 - waiting for players, 2 - is running ZE_PLAYERS_NUMBER = 34371 ZE_ZOMBIES_TO_SPAWN = 34372 ZE_ZOMBIES_SPAWNED = 34373 -- FUNCTION function setZombiesEventPlayersLimit(value) doSetStorage(ZE_PLAYERS_NUMBER, value) end function getZombiesEventPlayersLimit() return getStorage(ZE_PLAYERS_NUMBER) end function addPlayerToZombiesArea(cid) doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT) doTeleportThing(cid, ZE_enterPosition, true) doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT) if(getPlayerAccess(cid) < ZE_ACCESS_TO_IGNORE_ARENA) then setPlayerZombiesEventStatus(cid, os.time()) end end function kickPlayerFromZombiesArea(cid) doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT) doTeleportThing(cid, ZE_kickPosition, true) doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT) setPlayerZombiesEventStatus(cid, 0) end function getPlayerZombiesEventStatus(cid) return getCreatureStorage(cid, ZE_isOnZombieArea) end function setPlayerZombiesEventStatus(cid, value) doCreatureSetStorage(cid, ZE_isOnZombieArea, value) end function getZombiesEventPlayers() local players = {} for i, cid in pairs(getPlayersOnline()) do if(getPlayerZombiesEventStatus(cid) > 0) then table.insert(players, cid) end end return players end function getZombiesCount() return getStorage(ZE_ZOMBIES_SPAWNED) end function addZombiesCount() doSetStorage(ZE_ZOMBIES_SPAWNED, getStorage(ZE_ZOMBIES_SPAWNED)+1) end function resetZombiesCount() doSetStorage(ZE_ZOMBIES_SPAWNED, 0) end function getZombiesToSpawnCount() return getStorage(ZE_ZOMBIES_TO_SPAWN) end function setZombiesToSpawnCount(count) doSetStorage(ZE_ZOMBIES_TO_SPAWN, count) end function addZombiesEventBlockEnterPosition() if(getTileItemById(ZE_blockEnterItemPosition, ZE_blockEnterItemID).uid == 0) then doCreateItem(ZE_blockEnterItemID, 1, ZE_blockEnterItemPosition) end end function removeZombiesEventBlockEnterPosition() local item = getTileItemById(ZE_blockEnterItemPosition, ZE_blockEnterItemID) if(item.uid ~= 0) then doRemoveItem(item.uid) end end function spawnNewZombie() local posx = {} local posy = {} local posz = {} local pir = {} for i=1, 5 do local posx_tmp = math.random(ZE_spawnFromPosition.x ,ZE_spawnToPosition.x) local posy_tmp = math.random(ZE_spawnFromPosition.y ,ZE_spawnToPosition.y) local posz_tmp = math.random(ZE_spawnFromPosition.z ,ZE_spawnToPosition.z) local pir_tmp = 0 local spec = getSpectators({x=posx_tmp, y=posy_tmp, z=posz_tmp}, 3, 3, false) if(spec and #spec > 0) then for z, pid in pairs(spec) do if(isPlayer(pid)) then pir_tmp = pir_tmp + 1 end end end posx[i] = posx_tmp posy[i] = posy_tmp posz[i] = posz_tmp pir[i] = pir_tmp end local lowest_i = 1 for i=2, 5 do if(pir[i] < pir[lowest_i]) then lowest_i = i end end local ret = (type(doCreateMonster("Zombie Event", {x=posx[lowest_i], y=posy[lowest_i], z=posz[lowest_i]}, false)) == 'number') if(ret) then addZombiesCount() end return retend function onTime(interval, lastExecution) local players_on_arena_count = #getZombiesEventPlayers() local function start() if players_on_arena_count <= 1 then doBroadcastMessage("Zombie Couldn't Start Because there was few numbers ona rena") doSetStorage(ZE_STATUS, 0) addZombiesEventBlockEnterPosition() return true end setZombiesEventPlayersLimit(players_on_arena_count) addZombiesEventBlockEnterPosition() doSetStorage(ZE_STATUS, 2) doBroadcastMessage("Zombie Arena Event started") return true end setZombiesEventPlayersLimit(10) doBroadcastMessage("Zombie Event Is Waiting For 10 Players To Join.Zombie Will Start In 8 Minutes") removeZombiesEventBlockEnterPosition() addEvent(start,8*60*1000) doSetStorage(ZE_STATUS, 1) return true end Editado Abril 28, 2014 11 anos por Beckman (veja o histórico de edições) ShopGuild Points 100% add em player offline. Dev c++ Compilando TFS no Windows [GlobalEvents] Perfect Lottery System(MySql) [GlobalEvents] ServeSave - Shutdown/Automático [Talkactions] Trade OFF - Shop Offline [Linux] Auto-Backup Database ShopGuild TFS 1.0PagSeguro Automático 100% Esse funciona![MYSQL] Backup_points Resetando e devolvendo os points automático.[LINUX] Montando OTserver em Debian perfeito.GesiorACC 2012 modificado o melhor!StreamTemple TFS 0.4 [8.60] MegaTibia
Postado Abril 28, 2014 11 anos local function start() local players_on_arena_count = #getZombiesEventPlayers() if players_on_arena_count <= 1 then for _, pid in pairs(getZombiesEventPlayers()) do kickPlayerFromZombiesArea(pid) end doBroadcastMessage("Zombie Couldn't Start Because there was few numbers ona rena") doSetStorage(ZE_STATUS, 0) addZombiesEventBlockEnterPosition() return true end setZombiesEventPlayersLimit(players_on_arena_count) addZombiesEventBlockEnterPosition() doSetStorage(ZE_STATUS, 2) doBroadcastMessage("Zombie Arena Event started") return true end function onTime(interval, lastExecution) setZombiesEventPlayersLimit(10) doBroadcastMessage("Zombie Event Is Waiting For 10 Players To Join.Zombie Will Start In 8 Minutes") removeZombiesEventBlockEnterPosition() addEvent(start,8*60*1000) doSetStorage(ZE_STATUS, 1) return true end -"Supra Omnes Lux Lucis" - Acima de todos brilha a Luz -
Postado Abril 29, 2014 11 anos Autor Quando eu botei 2 player ele não obedeceu a regra de 10 players, executou o evento e deu o premio ao ultimo sobrevivente e foram tp normal. Quando eu botei 1 player ele não executou o evento e teleportou pro templo coisa que não fazia! ShopGuild Points 100% add em player offline. Dev c++ Compilando TFS no Windows [GlobalEvents] Perfect Lottery System(MySql) [GlobalEvents] ServeSave - Shutdown/Automático [Talkactions] Trade OFF - Shop Offline [Linux] Auto-Backup Database ShopGuild TFS 1.0PagSeguro Automático 100% Esse funciona![MYSQL] Backup_points Resetando e devolvendo os points automático.[LINUX] Montando OTserver em Debian perfeito.GesiorACC 2012 modificado o melhor!StreamTemple TFS 0.4 [8.60] MegaTibia
Postado Abril 29, 2014 11 anos Solução local function start() local players_on_arena_count = #getZombiesEventPlayers() if players_on_arena_count < 10 then for _, pid in pairs(getZombiesEventPlayers()) do kickPlayerFromZombiesArea(pid) end doBroadcastMessage("Zombie Couldn't Start Because there was few numbers ona rena") doSetStorage(ZE_STATUS, 0) addZombiesEventBlockEnterPosition() return true end setZombiesEventPlayersLimit(players_on_arena_count) addZombiesEventBlockEnterPosition() doSetStorage(ZE_STATUS, 2) doBroadcastMessage("Zombie Arena Event started") return true end function onTime(interval, lastExecution) setZombiesEventPlayersLimit(10) doBroadcastMessage("Zombie Event Is Waiting For 10 Players To Join.Zombie Will Start In 8 Minutes") removeZombiesEventBlockEnterPosition() addEvent(start,8*60*1000) doSetStorage(ZE_STATUS, 1) return true end -"Supra Omnes Lux Lucis" - Acima de todos brilha a Luz -
Postado Abril 29, 2014 11 anos Autor Resolvido Max, perfeito. Muito obrigado! ShopGuild Points 100% add em player offline. Dev c++ Compilando TFS no Windows [GlobalEvents] Perfect Lottery System(MySql) [GlobalEvents] ServeSave - Shutdown/Automático [Talkactions] Trade OFF - Shop Offline [Linux] Auto-Backup Database ShopGuild TFS 1.0PagSeguro Automático 100% Esse funciona![MYSQL] Backup_points Resetando e devolvendo os points automático.[LINUX] Montando OTserver em Debian perfeito.GesiorACC 2012 modificado o melhor!StreamTemple TFS 0.4 [8.60] MegaTibia
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.