Postado Outubro 16, 2017 7 anos Olá, tudo bem?, scripts do TK. Estou precisando de um script "alavanca". EX: que ele use alavanca e remova uma pedra e que ele seja teletransportado para uma sala e que ele tenha 2 minutos para matar os bichos dessa sala e sair dela, caso ele não sai em 2 minutos o script o teletransporte para fora da sala, e que a pedra que foi removida aparece novamente no mesmo local que ele após os 2 minutos, que quando o player usar a alavanca apareca uma mensagem você tem 2 minutos para sair deste local o será teletransportado para fora. Limite de player na sala =3 limite de vezes possa usar a alavanca no dia= 3x Esse é o escopo que impede da alavanca mudar para a posição de iniciar a quest: Spoiler Esse o escopo que impede da alavanca mudar para a posição de iniciar a quest:elseif(item.itemid == 1945)then if(#getCreaturesInRange(tele_players[3], 6, 6, false, true) > 0)then return true,doPlayerSendCancel(cid,"Espere o time acabar de fazer a annihilator quest.") end Ela só pode mudar se não houver players na sala dos monstros, se houver, ela bloqueia a alavanca e manda a msg ao player: " espere o time acabar. Estou usando o servidor "Oganza-Server-master" V11.47 A TFS dele eu não sei a versão. Spoiler Braco: player se teletransporte quando usar alavanca. da primeira imagem para segunda. Vermelho: área que o player vai ter determinado tempo para completar ou será kikado da área. Roxo: Que o player use a alavanca apenas se nessa área não tiver alguma criatura. Editado Outubro 20, 2017 7 anos por amoxicilina (veja o histórico de edições)
Postado Outubro 16, 2017 7 anos Solução Em actions/scripts, crie um arquivo: alavancatempo.lua Spoiler local quest = {level = 30, -- level mínimo max_times = 3, -- quantas vezes poderá usar timetowait = {1, "day"}, -- tempo para usar novamente após atingir o max_times max_players = 3, -- máximo de players dentro da área room = {from = {x = 1, y = 1, z = 1}, to = {x = 1, y = 1, z = 1}, -- posição do canto superior esquerdo, posição do canto inferior direito da sala newpos = {x = 1, y = 1, z = 1}}, -- posição para onde o player será teleportado ao entrar stone = {id = 1111, pos = {x = 1, y = 1, z = 1}}, -- id da pedra, posição timetokick = {2, "min"}, -- tempo para ser kikado da sala kickpos = {x = 1 , y = 1, z = 1} -- quando kikados da área, o player vai para essa posição } function onUse(cid, item, fromPosition, itemEx, toPosition) local p, inside = getPlayerPosition(cid), getPlayersInArea(quest.room.from, quest.room.to) if getPlayerStorageValue(cid, 84309) > os.time() then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You can use again at " .. os.date("%d %B %Y %X", getPlayerStorageValue(cid, 84309))..".") return true else if getPlayerStorageValue(cid, 84310) == quest.max_times then setPlayerStorageValue(cid, 84310, -1) end end if #inside >= quest.max_players then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Wait for the team to leave the room.") doSendMagicEffect(p, CONST_ME_POFF) return true end if getPlayerLevel(cid) < quest.level then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need at least level " .. quest.level .. " to go.") doSendMagicEffect(p, CONST_ME_POFF) return true end local times = getPlayerStorageValue(cid, 84310) > 0 and getPlayerStorageValue(cid, 84310) or 0 if (times + 1) == quest.max_times then setPlayerStorageValue(cid, 84309, mathtime(quest.timetowait) + os.time()) end local stone = getTileItemById(quest.stone.pos, quest.stone.id).uid if stone > 0 then doSendMagicEffect(quest.stone.pos, CONST_ME_POFF) doRemoveItem(stone) end doTeleportThing(cid, quest.room.newpos) doSendMagicEffect(quest.room.newpos, CONST_ME_TELEPORT) setPlayerStorageValue(cid, 84310, times+1) addEvent(kickFromArea, mathtime(quest.timetokick) * 1000, cid) return true end function getPlayersInArea(fromPos, toPos) local players = {} for _, pid in ipairs(getPlayersOnline()) do if isInRange(getPlayerPosition(pid), fromPos, toPos) then table.insert(players, pid) end end return players end function mathtime(table) -- by dwarfer local unit = {"sec", "min", "hour", "day"} for i, v in pairs(unit) do if v == table[2] then return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1) end end return error("Bad declaration in mathtime function.") end function kickFromArea(cid) local stone = getTileItemById(quest.stone.pos, quest.stone.id) if stone.uid == 0 then doCreateItem(quest.stone.id, 1, quest.stone.pos) end if isPlayer(cid) and isInRange(getPlayerPosition(cid), quest.room.from, quest.room.to) then doTeleportThing(cid, quest.kickpos) end doSendMagicEffect(quest.kickpos, CONST_ME_TELEPORT) end Em actions.xml, adicione a tag: <action actionid="ACTION_ID_DA_ALAVANCA" script="alavancatempo.lua" /> Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Outubro 17, 2017 7 anos Autor 23 horas atrás, Dwarfer disse: Em actions/scripts, crie um arquivo: alavancatempo.lua Mostrar conteúdo oculto local quest = {level = 30, -- level mínimo max_times = 3, -- quantas vezes poderá usar timetowait = {1, "day"}, -- tempo para usar novamente após atingir o max_times max_players = 3, -- máximo de players dentro da área room = {from = {x = 1, y = 1, z = 1}, to = {x = 1, y = 1, z = 1}, -- posição do canto superior esquerdo, posição do canto inferior direito da sala newpos = {x = 1, y = 1, z = 1}}, -- posição para onde o player será teleportado ao entrar stone = {id = 1111, pos = {x = 1, y = 1, z = 1}}, -- id da pedra, posição timetokick = {2, "min"}, -- tempo para ser kikado da sala kickpos = {x = 1 , y = 1, z = 1} -- quando kikados da área, o player vai para essa posição } function onUse(cid, item, fromPosition, itemEx, toPosition) local p, inside = getPlayerPosition(cid), getPlayersInArea(quest.room.from, quest.room.to) if getPlayerStorageValue(cid, 84309) > os.time() then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You can use again at " .. os.date("%d %B %Y %X", getPlayerStorageValue(cid, 84309))..".") return true else if getPlayerStorageValue(cid, 84310) == quest.max_times then setPlayerStorageValue(cid, 84310, -1) end end if #inside >= quest.max_players then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Wait for the team to leave the room.") doSendMagicEffect(p, CONST_ME_POFF) return true end if getPlayerLevel(cid) < quest.level then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need at least level " .. quest.level .. " to go.") doSendMagicEffect(p, CONST_ME_POFF) return true end local times = getPlayerStorageValue(cid, 84310) > 0 and getPlayerStorageValue(cid, 84310) or 0 if (times + 1) == quest.max_times then setPlayerStorageValue(cid, 84309, mathtime(quest.timetowait) + os.time()) end local stone = getTileItemById(quest.stone.pos, quest.stone.id).uid if stone > 0 then doSendMagicEffect(quest.stone.pos, CONST_ME_POFF) doRemoveItem(stone) end doTeleportThing(cid, quest.room.newpos) doSendMagicEffect(quest.room.newpos, CONST_ME_TELEPORT) setPlayerStorageValue(cid, 84310, times+1) addEvent(kickFromArea, mathtime(quest.timetokick) * 1000, cid) return true end function getPlayersInArea(fromPos, toPos) local players = {} for _, pid in ipairs(getPlayersOnline()) do if isInRange(getPlayerPosition(pid), fromPos, toPos) then table.insert(players, pid) end end return players end function mathtime(table) -- by dwarfer local unit = {"sec", "min", "hour", "day"} for i, v in pairs(unit) do if v == table[2] then return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1) end end return error("Bad declaration in mathtime function.") end function kickFromArea(cid) local stone = getTileItemById(quest.stone.pos, quest.stone.id) if stone.uid == 0 then doCreateItem(quest.stone.id, 1, quest.stone.pos) end if isPlayer(cid) and isInRange(getPlayerPosition(cid), quest.room.from, quest.room.to) then doTeleportThing(cid, quest.kickpos) end doSendMagicEffect(quest.kickpos, CONST_ME_TELEPORT) end Em actions.xml, adicione a tag: <action actionid="ACTION_ID_DA_ALAVANCA" script="alavancatempo.lua" /> seria possivel colocar para que ele usa-se a alavanca so quando ele matasse os Dragon que estão ao seu lado?. Esta dando esse erro quando eu uso a alavanca:
Postado Outubro 18, 2017 7 anos Ah, cara. Não tinha visto a versão que você tinha colocado no tópico, erro meu. Esse aí que eu fiz não é para essa versão. Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Outubro 19, 2017 7 anos Autor @Dwarfer consegui arrumar ? Em 16/10/2017 em 18:14, Dwarfer disse: Em actions/scripts, crie um arquivo: alavancatempo.lua Ocultar conteúdo local quest = {level = 30, -- level mínimo max_times = 3, -- quantas vezes poderá usar timetowait = {1, "day"}, -- tempo para usar novamente após atingir o max_times max_players = 3, -- máximo de players dentro da área room = {from = {x = 1, y = 1, z = 1}, to = {x = 1, y = 1, z = 1}, -- posição do canto superior esquerdo, posição do canto inferior direito da sala newpos = {x = 1, y = 1, z = 1}}, -- posição para onde o player será teleportado ao entrar stone = {id = 1111, pos = {x = 1, y = 1, z = 1}}, -- id da pedra, posição timetokick = {2, "min"}, -- tempo para ser kikado da sala kickpos = {x = 1 , y = 1, z = 1} -- quando kikados da área, o player vai para essa posição } function onUse(cid, item, fromPosition, itemEx, toPosition) local p, inside = getPlayerPosition(cid), getPlayersInArea(quest.room.from, quest.room.to) if getPlayerStorageValue(cid, 84309) > os.time() then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You can use again at " .. os.date("%d %B %Y %X", getPlayerStorageValue(cid, 84309))..".") return true else if getPlayerStorageValue(cid, 84310) == quest.max_times then setPlayerStorageValue(cid, 84310, -1) end end if #inside >= quest.max_players then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Wait for the team to leave the room.") doSendMagicEffect(p, CONST_ME_POFF) return true end if getPlayerLevel(cid) < quest.level then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need at least level " .. quest.level .. " to go.") doSendMagicEffect(p, CONST_ME_POFF) return true end local times = getPlayerStorageValue(cid, 84310) > 0 and getPlayerStorageValue(cid, 84310) or 0 if (times + 1) == quest.max_times then setPlayerStorageValue(cid, 84309, mathtime(quest.timetowait) + os.time()) end local stone = getTileItemById(quest.stone.pos, quest.stone.id).uid if stone > 0 then doSendMagicEffect(quest.stone.pos, CONST_ME_POFF) doRemoveItem(stone) end doTeleportThing(cid, quest.room.newpos) doSendMagicEffect(quest.room.newpos, CONST_ME_TELEPORT) setPlayerStorageValue(cid, 84310, times+1) addEvent(kickFromArea, mathtime(quest.timetokick) * 1000, cid) return true end function getPlayersInArea(fromPos, toPos) local players = {} for _, pid in ipairs(getPlayersOnline()) do if isInRange(getPlayerPosition(pid), fromPos, toPos) then table.insert(players, pid) end end return players end function mathtime(table) -- by dwarfer local unit = {"sec", "min", "hour", "day"} for i, v in pairs(unit) do if v == table[2] then return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1) end end return error("Bad declaration in mathtime function.") end function kickFromArea(cid) local stone = getTileItemById(quest.stone.pos, quest.stone.id) if stone.uid == 0 then doCreateItem(quest.stone.id, 1, quest.stone.pos) end if isPlayer(cid) and isInRange(getPlayerPosition(cid), quest.room.from, quest.room.to) then doTeleportThing(cid, quest.kickpos) end doSendMagicEffect(quest.kickpos, CONST_ME_TELEPORT) end Em actions.xml, adicione a tag: <action actionid="ACTION_ID_DA_ALAVANCA" script="alavancatempo.lua" /> Modifiquei algumas coisas nele e deixei assim: function onUse(cid, item, fromPosition, itemEx, toPosition, words, param, channel, item2, topos) local quest = {level = 50 -- level mínimo max_times = 3, -- quantas vezes poderá usar timetowait = {1, "day"}, -- tempo para usar novamente após atingir o max_times max_players = 3, -- máximo de players dentro da área room = {from = {x = 32312, y = 32507, z = 8}, to = {x = 32312, y = 32507, z = 8}}-- posição do canto superior esquerdo, posição do canto inferior direito da sala newpos = {x = 32327, y = 32528, z = 18}, -- posição para onde o player será teleportado ao entrar stone = {id = 1304, pos = {x = 32320, y = 32516, z = 8}} -- id da pedra, posição timetokick = {2, "min"},-- tempo para ser kikado da sala local pos = {X=32331, Y=32526, Z=7, stackpos=1} kickpos = {x = 32331 , y = 32526, z = 7}} -- quando kikados da área, o player vai para essa posição local p, inside = getPlayerPosition(cid), getPlayersInArea(quest.room.from, quest.room.to) if getPlayerStorageValue(cid, 84309) > os.time() then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You can use again at " .. os.date("%d %B %Y %X", getPlayerStorageValue(cid, 84309))..".") return true else if getPlayerStorageValue(cid, 84310) == quest.max_times then setPlayerStorageValue(cid, 84310, -1) end end if #inside >= quest.max_players then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Wait for the team to leave the room.") doSendMagicEffect(p, CONST_ME_POFF) return true end if getPlayerLevel(cid) < quest.level then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need at least level " .. quest.level .. " to go.") doSendMagicEffect(p, CONST_ME_POFF) return true end local max_times = getPlayerStorageValue(cid, 84310) > 0 and getPlayerStorageValue(cid, 84310) or 0 if (max_times + 1) == quest.max_times then setPlayerStorageValue(cid, 84309, mathtime(quest.timetowait) + os.time()) end local stone = getTileItemById(quest.stone.pos, quest.stone.id).uid if stone > 0 then doSendMagicEffect(quest.stone.pos, CONST_ME_POFF) doRemoveItem(stone) end doTeleportThing(cid, quest.room.newpos) doSendMagicEffect(quest.room.newpos, CONST_ME_TELEPORT) setPlayerStorageValue(cid, 84310, max_times+1) addEvent(kickFromArea, mathtime(quest.timetokick) * 1000, cid) return true end else function getPlayersInArea(fromPos, toPos) local players = {} for _, pid in ipairs(getPlayersOnline()) do if isInRange(getPlayerPosition(pid), fromPos, toPos) then table.insert(players, pid) end end return players end else function mathtime(table) -- by dwarfer local unit = {"sec", "min", "hour", "day"} for i, v in pairs(unit) do if v == table[2] then return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1) end end return error("Bad declaration in mathtime function.") end else function kickFromArea(cid) local stone = getTileItemById(quest.stone.pos, quest.stone.id) if stone.uid == 0 then doCreateItem(quest.stone.id, 1, quest.stone.pos) end if isPlayer(cid) and isInRange(getPlayerPosition(cid), quest.room.from, quest.room.to) then doTeleportThing(cid, quest.kickpos) end doSendMagicEffect(quest.kickpos, CONST_ME_TELEPORT) end E agora esta acontecendo esse erro: coloca pra mim pra que possa usar a alavanca só quando não tiver monstro no local, e colocar algo semelhante a esse aqui também. Esse o escopo que impede da alavanca mudar para a posição de iniciar a quest: elseif(item.itemid == 1945)then if(#getCreaturesInRange(tele_players[3], 6, 6, false, true) > 0)then return true,doPlayerSendCancel(cid,"Espere o time acabar de fazer a annihilator quest.") end Ela só pode mudar se não houver players na sala dos monstros, se houver, ela bloqueia a alavanca e manda a msg ao player: " espere o time acabar. procurando alguma coisar para me ajudar a tentar fazer o que você me mandou funcionar eu ó vi esse em um tópico e achei que seria entesante ele no script que pedir. @Alexy Brocanello Ajuda ai se possível. @Dwarfer desistiu de me ajudar? Editado Novembro 8, 2017 7 anos por amoxicilina (veja o histórico de edições)
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.