Xtudomuito 2 Postado Julho 27, 2015 Share Postado Julho 27, 2015 Queria que alguem cria-se pra min um porta que so passa um player por vezes e que estiver level 300. e eu queria aquelas que portas teleporta e n aqui abri e fecha. Link para o comentário https://xtibia.com/forum/topic/235803-porta-s%C3%B3-passa-um-player-por-vez/ Compartilhar em outros sites More sharing options...
0 Alencar522 19 Postado Agosto 3, 2015 Share Postado Agosto 3, 2015 Tenta assim: -- Do not remove the credits -- -- [MOVEEVENT] Limite de player por sala -- -- Developed by Rigby -- -- Especially for the Xtibia.com -- function onUse(cid, item, topos) local config = { -- Config -- -- [ACTIONID] = {area = getPlayersInArea(AREA QUE IRA CHECAR (FROMPOS,TOPOS)), amountOfPlayers = QUANTIDADE QUE CABE} [212331] = {area = getPlayersInArea({x = 1030, y = 1020, z = 7}, {x = 1040, y = 1030, z = 7}), amountOfPlayers = 1} -- Config -- } if getPlayerLevel(cid) <= 299 then doPlayerSendCancel(cid, 'Você precisa de nivel 300 ou mais para passar') return true end if getPlayerStorageValue(cid, 1233256) == 1 then doTeleportThing(cid, topos,true) setPlayerStorageValue(cid, 1233256, -1) return true end if config[item.actionid] then if #config[item.actionid].area >= config[item.actionid].amountOfPlayers then return doPlayerSendCancel(cid, 'Ja tem um player, aguarde...') end setPlayerStorageValue(cid, 1233256, 1) doTeleportThing(cid, topos, true) end return true end function getPlayersInArea(fromPos, toPos) -- Function made by Vodkart local players = {} for _, pid in ipairs(getPlayersOnline()) do if isInRange(getPlayerPosition(pid), fromPos, toPos) then table.insert(players, pid) end end return players end Link para o comentário https://xtibia.com/forum/topic/235803-porta-s%C3%B3-passa-um-player-por-vez/#findComment-1663537 Compartilhar em outros sites More sharing options...
0 cheveko 11 Postado Julho 28, 2015 Share Postado Julho 28, 2015 Como assim, 1 player por vez? Se alguém atravessa, não dá mais pra atravessar? Link para o comentário https://xtibia.com/forum/topic/235803-porta-s%C3%B3-passa-um-player-por-vez/#findComment-1662671 Compartilhar em outros sites More sharing options...
0 Xtudomuito 2 Postado Julho 29, 2015 Autor Share Postado Julho 29, 2015 fis uma area, ai tem uma porta o player so pode entra um de cada vez. tipo eu entro na sala, so vai pode entra outro quando eu sair, Link para o comentário https://xtibia.com/forum/topic/235803-porta-s%C3%B3-passa-um-player-por-vez/#findComment-1662762 Compartilhar em outros sites More sharing options...
0 RigBy 285 Postado Julho 29, 2015 Share Postado Julho 29, 2015 De uma olhada nisso: http://www.xtibia.com/forum/topic/235070-limite-de-player-por-sala/ Link para o comentário https://xtibia.com/forum/topic/235803-porta-s%C3%B3-passa-um-player-por-vez/#findComment-1662764 Compartilhar em outros sites More sharing options...
0 Xtudomuito 2 Postado Julho 29, 2015 Autor Share Postado Julho 29, 2015 Então amigo eu vir o seu tópico ia até pow aqui pra quem tenta min ajuda, ter como uma noção. Mas eu queria uma porta no lugar de um teleporte. Link para o comentário https://xtibia.com/forum/topic/235803-porta-s%C3%B3-passa-um-player-por-vez/#findComment-1662792 Compartilhar em outros sites More sharing options...
0 Bruno 536 Postado Julho 29, 2015 Share Postado Julho 29, 2015 Então amigo eu vir o seu tópico ia até pow aqui pra quem tenta min ajuda, ter como uma noção. Mas eu queria uma porta no lugar de um teleporte. Usando a lógica do RigBy, só fiz algumas alterações, vê se dá... Em data/actions/actions.xml adicione a seguinte tag: <action actionid="50000" script="questDoor.lua"/>Agora em data/actions/scripts crie o arquivo x com o seguinte conteúdo: -- Do not remove the credits -- -- [MOVEEVENT] Limite de player por sala -- -- Developed by Rigby -- -- Especially for the Xtibia.com -- local config = { -- Config -- -- [ACTIONID] = {area = getPlayersInArea(AREA QUE IRA CHECAR (FROMPOS,TOPOS)), amountOfPlayers = QUANTIDADE QUE CABE} [50000] = {area = getPlayersInArea({x = 1030, y = 1020, z = 7}, {x = 1040, y = 1030, z = 7}), amountOfPlayers = 1} -- Config -- } function onUse(cid, item, topos) if config[item.actionid] then if #config[item.actionid].area >= config[item.actionid].amountOfPlayers then return doPlayerSendCancel(cid, 'Ja tem um player fazendo a quest, aguarde...') end doTeleportThing(cid, topos, true) end return true end function getPlayersInArea(fromPos, toPos) -- Function made by Vodkart local players = {} for _, pid in ipairs(getPlayersOnline()) do if isInRange(getPlayerPosition(pid), fromPos, toPos) then table.insert(players, pid) end end return players endAgora basta colocar a actionid na porta. Link para o comentário https://xtibia.com/forum/topic/235803-porta-s%C3%B3-passa-um-player-por-vez/#findComment-1662810 Compartilhar em outros sites More sharing options...
0 Xtudomuito 2 Postado Julho 29, 2015 Autor Share Postado Julho 29, 2015 erro [29/07/2015 16:51:20] data/actions/scripts/other/doorsquest.lua:8: attempt to call global 'getPlayersInArea' (a nil value) [29/07/2015 16:51:20] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doorsquest.lua) [29/07/2015 16:51:20] cannot open data/actions/scripts/doorsquest.lua: No such file or directory Link para o comentário https://xtibia.com/forum/topic/235803-porta-s%C3%B3-passa-um-player-por-vez/#findComment-1662821 Compartilhar em outros sites More sharing options...
0 roriscrave 21 Postado Julho 29, 2015 Share Postado Julho 29, 2015 como coloca tempo maximo para o player ficar nesta area? por exemplo: ficou mais de 10min toma kick pra fora De uma olhada nisso: http://www.xtibia.com/forum/topic/235070-limite-de-player-por-sala/ como poe limite, por exemplo ficou 10 mins na sala toma kick pra fora Link para o comentário https://xtibia.com/forum/topic/235803-porta-s%C3%B3-passa-um-player-por-vez/#findComment-1662822 Compartilhar em outros sites More sharing options...
0 Xtudomuito 2 Postado Julho 30, 2015 Autor Share Postado Julho 30, 2015 Alguém Link para o comentário https://xtibia.com/forum/topic/235803-porta-s%C3%B3-passa-um-player-por-vez/#findComment-1662926 Compartilhar em outros sites More sharing options...
0 RigBy 285 Postado Julho 30, 2015 Share Postado Julho 30, 2015 como coloca tempo maximo para o player ficar nesta area? por exemplo: ficou mais de 10min toma kick pra fora como poe limite, por exemplo ficou 10 mins na sala toma kick pra fora substitui o movement por esse: -- Do not remove the credits -- -- [MOVEEVENT] Limite de player por sala -- -- Developed by Rigby -- -- Especially for the Xtibia.com -- function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) local pos = {x = 1073, y = 1031, z = 7} -- quando o tempo acaba para onde ele ira ser teleportado local tempo = 10 -- tempo que pode fica em minutos local config = { [5555] = {area = getPlayersInArea({x = 1030, y = 1020, z = 7}, {x = 1040, y = 1030, z = 7}), amountOfPlayers = 1, teleport = {x = 1037, y = 1025, z = 7}}, } if config[item.actionid] then if #config[item.actionid].area < config[item.actionid].amountOfPlayers then doTeleportThing(cid, config[item.actionid].teleport, false) doPlayerSendTextMessage(cid, 25, "Welcome") setPlayerStorageValue(cid, 21321321, 1) addEvent(function() if not isPlayer(cid) then return false end if getPlayerStorageValue(cid, 21321321) == 1 then doTeleportThing(cid, pos) setPlayerStorageValue(cid, 21321321, -1) end end, tempo * 60 * 1000) else doPlayerSendTextMessage(cid, 25, "The room already reached its limit "..config[item.actionid].amountOfPlayers.." player 's wait someone out .") doTeleportThing(cid, fromPosition) end end return true end function getPlayersInArea(fromPos, toPos) -- Function made by Vodkart local players = {} for _, pid in ipairs(getPlayersOnline()) do if isInRange(getPlayerPosition(pid), fromPos, toPos) then table.insert(players, pid) end end return players end e para que ele quando desloga volta pro templo adicione isso. em creaturescript, dentro do Login.lua antes do ultimo return true. .lua if getPlayerStorageValue(cid, 21321321) == 1 then local pos = {x = 1073, y = 1031, z = 7} -- posição para onde ele vai doTeleportThing(cid, pos) setPlayerStorageValue(cid, 21321321, 1) end Link para o comentário https://xtibia.com/forum/topic/235803-porta-s%C3%B3-passa-um-player-por-vez/#findComment-1662930 Compartilhar em outros sites More sharing options...
0 roriscrave 21 Postado Julho 30, 2015 Share Postado Julho 30, 2015 (editado) if getPlayerStorageValue(cid, 21321321) == 1 then local pos = {x = 1073, y = 1031, z = 7} -- posição para onde ele vai doTeleportThing(cid, pos) setPlayerStorageValue(cid, 21321321, 1) end creio que ta errado essa parte, se não sempre que ele deslogar ele vai para o templo, tem que modificar ali setPlayerStorageValue(cid, 21321321, -1) edit: poderia me explicar qual a função faz a contagem para o player tomar teleport pra fora? pois queria adicionar ela em um outro script, vlw Editado Julho 30, 2015 por roriscrave Link para o comentário https://xtibia.com/forum/topic/235803-porta-s%C3%B3-passa-um-player-por-vez/#findComment-1662963 Compartilhar em outros sites More sharing options...
0 RigBy 285 Postado Julho 30, 2015 Share Postado Julho 30, 2015 creio que ta errado essa parte, se não sempre que ele deslogar ele vai para o templo, tem que modificar ali setPlayerStorageValue(cid, 21321321, -1) edit: poderia me explicar qual a função faz a contagem para o player tomar teleport pra fora? pois queria adicionar ela em um outro script, vlw Eu fiz isso porque caso o player deslogue la dentro e o tempo acaba-se o script ia buga e ele poderia fica la pra sempre. desculpa, muda o valor de 1 para -1 no setPlayerSto.... Da uma olhada nessa parte: addEvent(function() if not isPlayer(cid) then return false end if getPlayerStorageValue(cid, 21321321) == 1 then doTeleportThing(cid, pos) setPlayerStorageValue(cid, 21321321, -1) end end, tempo * 60 * 1000) Link para o comentário https://xtibia.com/forum/topic/235803-porta-s%C3%B3-passa-um-player-por-vez/#findComment-1662966 Compartilhar em outros sites More sharing options...
0 Xtudomuito 2 Postado Julho 30, 2015 Autor Share Postado Julho 30, 2015 (editado) Já meu pedido nds. Isso que vcs estão fazendo não é contra regras não. Pq, que eu saiba ele teria que cria outro tópico. Editado Julho 30, 2015 por Xtudomuito Link para o comentário https://xtibia.com/forum/topic/235803-porta-s%C3%B3-passa-um-player-por-vez/#findComment-1662968 Compartilhar em outros sites More sharing options...
0 roriscrave 21 Postado Julho 31, 2015 Share Postado Julho 31, 2015 Já meu pedido nds. Isso que vcs estão fazendo não é contra regras não. Pq, que eu saiba ele teria que cria outro tópico. mano, ele ja postou seu script completo, é so ver acima. o erro que deu é pq tu não prestou atenção direito 29/07/2015 16:51:20] cannot open data/actions/scripts/doorsquest.lua: No such file or directory nao foi encontrado o arquivo chamado doorsquest.lua na sua pasta data/actions/scripts. voce colocou o nome dele errado! Link para o comentário https://xtibia.com/forum/topic/235803-porta-s%C3%B3-passa-um-player-por-vez/#findComment-1663031 Compartilhar em outros sites More sharing options...
0 Xtudomuito 2 Postado Julho 31, 2015 Autor Share Postado Julho 31, 2015 to achando que o erro msm é aqui [29/07/2015 16:51:20] data/actions/scripts/other/doorsquest.lua:8: attempt to call global 'getPlayersInArea' (a nil value) Link para o comentário https://xtibia.com/forum/topic/235803-porta-s%C3%B3-passa-um-player-por-vez/#findComment-1663099 Compartilhar em outros sites More sharing options...
Pergunta
Xtudomuito 2
Queria que alguem cria-se pra min um porta que so passa um player por vezes e que estiver level 300. e eu queria aquelas que portas teleporta e n aqui abri e fecha.
Link para o comentário
https://xtibia.com/forum/topic/235803-porta-s%C3%B3-passa-um-player-por-vez/Compartilhar em outros sites
28 respostass a esta questão
Posts Recomendados