Postado Fevereiro 25, 2020 5 anos .Qual servidor ou website você utiliza como base? Servidor base 8.60, OTX server. Qual o motivo deste tópico? Boa tarde a todos(das), gostaria que as caves abaixo fossem escolhidas através de alavancas (removendo X item) para dar direito ao uso da cave. Além disto, gostaria que quando o player da cave passar pelo tile da cave, mostra-se hora, minutos e segundos, atualmente apenas mostra minutos. Portanto, em resumo, gostaria que o player escolhe-se a cave por alavanca (removendo X item da backpack) dando direito de uso de 2 horas e quem tenta-se passar pelo tile que não for o dono no momento demonstre a quem possui a cave, exemplo: Esta cave pertente a FULANO, que tem X horas, X minutos e X segundos, e ao proprietário também. Deste modo, grato de imediato, por quem leu ou tentou ajudar. Você tem o código disponível? Se tiver publique-o aqui: PASTA ACTIONS. local function filtrateString(str) if type(str) ~= "string" then return false end local first, last = 0, 0 local second, final = 0, #str local limitedeuso = 49015 local textofinal1 = "Voce ja esta sob efeito da pot de experiencia espere o efeito acabar." for i = 1, #str do if string.byte(str:sub(i,i)) == string.byte('a') then first = i + 2 for t = first, #str do if string.byte(str:sub(t,t)) == string.byte(' ') then last = t - 1 break end end end if string.byte(str:sub(i,i)) == string.byte('b') then second = i + 2 end end return {str:sub(first, last), str:sub(second, final)} end function doPlayerHaveCave(cid) local count = 0 for i = 822081, 822090 do if tonumber(filtrateString(getGlobalStorageValue(i))[1]) == getPlayerAccountId(cid) and tonumber(filtrateString(getGlobalStorageValue(i))[2]) - os.time() > 0 then count = count + 1 end end return count end function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerLevel(cid) > 15000 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce e maior que level 15000, porem nao pode usar a cave exclusiva.") return false elseif doPlayerHaveCave(cid) > 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce ja possui uma cave propria.") return false end if tonumber(filtrateString(getGlobalStorageValue(822081))[2]) < os.time() then doRemoveItem(item.uid) setGlobalStorageValue(822081, "a "..getPlayerAccountId(cid).." b ".. os.time() + (3600 * 2)) doPlayerSendTextMessage(cid, 25, "Agora você é o dono da cave 1 e pode upar lá por 4 horas.") elseif item.itemid == seuitem and (getPlayerStorageValue(cid, limitedeuso) - os.time() > 0) then doPlayerSendTextMessage(cid,22,textofinal1) elseif tonumber(filtrateString(getGlobalStorageValue(822082))[2]) < os.time() then doRemoveItem(item.uid) setGlobalStorageValue(822082, "a "..getPlayerAccountId(cid).." b ".. os.time() + (3600 * 2)) doPlayerSendTextMessage(cid, 25, "Agora você é o dono da cave 2 e pode upar lá por 4 horas.") elseif item.itemid == seuitem and (getPlayerStorageValue(cid, limitedeuso) - os.time() > 0) then doPlayerSendTextMessage(cid,22,textofinal1) elseif tonumber(filtrateString(getGlobalStorageValue(822083))[2]) < os.time() then doRemoveItem(item.uid) setGlobalStorageValue(822083, "a "..getPlayerAccountId(cid).." b ".. os.time() + (3600 * 2)) doPlayerSendTextMessage(cid, 25, "Agora você é o dono da cave 3 e pode upar lá por 4 horas.") elseif item.itemid == seuitem and (getPlayerStorageValue(cid, limitedeuso) - os.time() > 0) then doPlayerSendTextMessage(cid,22,textofinal1) elseif tonumber(filtrateString(getGlobalStorageValue(822084))[2]) < os.time() then doRemoveItem(item.uid) setGlobalStorageValue(822084, "a "..getPlayerAccountId(cid).." b ".. os.time() + (3600 * 2)) doPlayerSendTextMessage(cid, 25, "Agora você é o dono da cave 4 e pode upar lá por 4 horas.") elseif item.itemid == seuitem and (getPlayerStorageValue(cid, limitedeuso) - os.time() > 0) then doPlayerSendTextMessage(cid,22,textofinal1) elseif tonumber(filtrateString(getGlobalStorageValue(822085))[2]) < os.time() then doRemoveItem(item.uid) setGlobalStorageValue(822085, "a "..getPlayerAccountId(cid).." b ".. os.time() + (3600 * 2)) doPlayerSendTextMessage(cid, 25, "Agora você é o dono da cave 5 e pode upar lá por 4 horas.") elseif item.itemid == seuitem and (getPlayerStorageValue(cid, limitedeuso) - os.time() > 0) then doPlayerSendTextMessage(cid,22,textofinal1) elseif tonumber(filtrateString(getGlobalStorageValue(822086))[2]) < os.time() then doRemoveItem(item.uid) setGlobalStorageValue(822086, "a "..getPlayerAccountId(cid).." b ".. os.time() + (3600 * 2)) doPlayerSendTextMessage(cid, 25, "Agora você é o dono da cave 6 e pode upar lá por 4 horas.") elseif item.itemid == seuitem and (getPlayerStorageValue(cid, limitedeuso) - os.time() > 0) then doPlayerSendTextMessage(cid,22,textofinal1) elseif tonumber(filtrateString(getGlobalStorageValue(822087))[2]) < os.time() then doRemoveItem(item.uid) setGlobalStorageValue(822087, "a "..getPlayerAccountId(cid).." b ".. os.time() + (3600 * 2)) doPlayerSendTextMessage(cid, 25, "Agora você é o dono da cave 7 e pode upar lá por 4 horas.") elseif item.itemid == seuitem and (getPlayerStorageValue(cid, limitedeuso) - os.time() > 0) then doPlayerSendTextMessage(cid,22,textofinal1) elseif tonumber(filtrateString(getGlobalStorageValue(822088))[2]) < os.time() then doRemoveItem(item.uid) setGlobalStorageValue(822088, "a "..getPlayerAccountId(cid).." b ".. os.time() + (3600 * 2)) doPlayerSendTextMessage(cid, 25, "Agora você é o dono da cave 8 e pode upar lá por 4 horas.") elseif item.itemid == seuitem and (getPlayerStorageValue(cid, limitedeuso) - os.time() > 0) then doPlayerSendTextMessage(cid,22,textofinal1) elseif tonumber(filtrateString(getGlobalStorageValue(822089))[2]) < os.time() then doRemoveItem(item.uid) setGlobalStorageValue(822089, "a "..getPlayerAccountId(cid).." b ".. os.time() + (3600 * 2)) doPlayerSendTextMessage(cid, 25, "Agora você é o dono da cave 9 e pode upar lá por 4 horas.") elseif item.itemid == seuitem and (getPlayerStorageValue(cid, limitedeuso) - os.time() > 0) then doPlayerSendTextMessage(cid,22,textofinal1) elseif tonumber(filtrateString(getGlobalStorageValue(822090))[2]) < os.time() then doRemoveItem(item.uid) setGlobalStorageValue(822090, "a "..getPlayerAccountId(cid).." b ".. os.time() + (3600 * 2)) doPlayerSendTextMessage(cid, 25, "Agora você é o dono da cave 10 e pode upar lá por 4 horas.") elseif item.itemid == seuitem and (getPlayerStorageValue(cid, limitedeuso) - os.time() > 0) then doPlayerSendTextMessage(cid,22,textofinal1) elseif tonumber(filtrateString(getGlobalStorageValue(822091))[2]) < os.time() then doRemoveItem(item.uid) else doPlayerSendCancel(cid, "Todas as caves já estão com dono no momento. Tente mais tarde.") end return true end PASTA MOVEMENTS: local function filtrateString(str) if type(str) ~= "string" then return false end local first, last = 0, 0 local second, final = 0, #str for i = 1, #str do if string.byte(str:sub(i,i)) == string.byte('a') then first = i + 2 for t = first, #str do if string.byte(str:sub(t,t)) == string.byte(' ') then last = t - 1 break end end end if string.byte(str:sub(i,i)) == string.byte('b') then second = i + 2 end end return {str:sub(first, last), str:sub(second, final)} end function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) if item.actionid == 3600 then if tonumber(filtrateString(getGlobalStorageValue(822081))[1]) == getPlayerAccountId(cid) and tonumber(filtrateString(getGlobalStorageValue(822081))[2]) >= os.time() then doPlayerSendTextMessage(cid, 25, "Bem vindo à sua hunt! Aproveite ela, você tem mais "..math.floor((tonumber(filtrateString(getGlobalStorageValue(822081))[2]) - os.time())/60).." minutos de hunt.") else doTeleportThing(cid, fromPosition) doPlayerSendCancel(cid, "Você não é dono dessa hunt! Para ser dono de uma hunt, compre em nosso website.") end elseif item.actionid == 3601 then if tonumber(filtrateString(getGlobalStorageValue(822082))[1]) == getPlayerAccountId(cid) and tonumber(filtrateString(getGlobalStorageValue(822082))[2]) >= os.time() then doPlayerSendTextMessage(cid, 25, "Bem vindo à sua hunt! Aproveite ela, você tem mais "..math.floor((tonumber(filtrateString(getGlobalStorageValue(822082))[2]) - os.time()) / 60).." minutos de hunt.") else doTeleportThing(cid, fromPosition) doPlayerSendCancel(cid, "Você não é dono dessa hunt! Para ser dono de uma hunt, compre em nosso website.") end elseif item.actionid == 3602 then if tonumber(filtrateString(getGlobalStorageValue(822083))[1]) == getPlayerAccountId(cid) and tonumber(filtrateString(getGlobalStorageValue(822083))[2]) >= os.time() then doPlayerSendTextMessage(cid, 25, "Bem vindo à sua hunt! Aproveite ela, você tem mais "..math.floor((tonumber(filtrateString(getGlobalStorageValue(822083))[2]) - os.time()) / 60).." minutos de hunt.") else doTeleportThing(cid, fromPosition) doPlayerSendCancel(cid, "Você não é dono dessa hunt! Para ser dono de uma hunt, compre em nosso website.") end elseif item.actionid == 3603 then if tonumber(filtrateString(getGlobalStorageValue(822084))[1]) == getPlayerAccountId(cid) and tonumber(filtrateString(getGlobalStorageValue(822084))[2]) >= os.time() then doPlayerSendTextMessage(cid, 25, "Bem vindo à sua hunt! Aproveite ela, você tem mais "..math.floor((tonumber(filtrateString(getGlobalStorageValue(822084))[2]) - os.time()) / 60).." minutos de hunt.") else doTeleportThing(cid, fromPosition) doPlayerSendCancel(cid, "Você não é dono dessa hunt! Para ser dono de uma hunt, compre em nosso website.") end elseif item.actionid == 3604 then if tonumber(filtrateString(getGlobalStorageValue(822085))[1]) == getPlayerAccountId(cid) and tonumber(filtrateString(getGlobalStorageValue(822085))[2]) >= os.time() then doPlayerSendTextMessage(cid, 25, "Bem vindo à sua hunt! Aproveite ela, você tem mais "..math.floor((tonumber(filtrateString(getGlobalStorageValue(822085))[2]) - os.time()) / 60).." minutos de hunt.") else doTeleportThing(cid, fromPosition) doPlayerSendCancel(cid, "Você não é dono dessa hunt! Para ser dono de uma hunt, compre em nosso website.") end elseif item.actionid == 3605 then if tonumber(filtrateString(getGlobalStorageValue(822086))[1]) == getPlayerAccountId(cid) and tonumber(filtrateString(getGlobalStorageValue(822086))[2]) >= os.time() then doPlayerSendTextMessage(cid, 25, "Bem vindo à sua hunt! Aproveite ela, você tem mais "..math.floor((tonumber(filtrateString(getGlobalStorageValue(822086))[2]) - os.time()) / 60).." minutos de hunt.") else doTeleportThing(cid, fromPosition) doPlayerSendCancel(cid, "Você não é dono dessa hunt! Para ser dono de uma hunt, compre em nosso website.") end elseif item.actionid == 3606 then if tonumber(filtrateString(getGlobalStorageValue(822087))[1]) == getPlayerAccountId(cid) and tonumber(filtrateString(getGlobalStorageValue(822087))[2]) >= os.time() then doPlayerSendTextMessage(cid, 25, "Bem vindo à sua hunt! Aproveite ela, você tem mais "..math.floor((tonumber(filtrateString(getGlobalStorageValue(822087))[2]) - os.time()) / 60).." minutos de hunt.") else doTeleportThing(cid, fromPosition) doPlayerSendCancel(cid, "Você não é dono dessa hunt! Para ser dono de uma hunt, compre em nosso website.") end elseif item.actionid == 3607 then if tonumber(filtrateString(getGlobalStorageValue(822088))[1]) == getPlayerAccountId(cid) and tonumber(filtrateString(getGlobalStorageValue(822088))[2]) >= os.time() then doPlayerSendTextMessage(cid, 25, "Bem vindo à sua hunt! Aproveite ela, você tem mais "..math.floor((tonumber(filtrateString(getGlobalStorageValue(822088))[2]) - os.time()) / 60).." minutos de hunt.") else doTeleportThing(cid, fromPosition) doPlayerSendCancel(cid, "Você não é dono dessa hunt! Para ser dono de uma hunt, compre em nosso website.") end elseif item.actionid == 3608 then if tonumber(filtrateString(getGlobalStorageValue(822089))[1]) == getPlayerAccountId(cid) and tonumber(filtrateString(getGlobalStorageValue(822089))[2]) >= os.time() then doPlayerSendTextMessage(cid, 25, "Bem vindo à sua hunt! Aproveite ela, você tem mais "..math.floor((tonumber(filtrateString(getGlobalStorageValue(822089))[2]) - os.time()) / 60).." minutos de hunt.") else doTeleportThing(cid, fromPosition) doPlayerSendCancel(cid, "Você não é dono dessa hunt! Para ser dono de uma hunt, compre em nosso website.") end elseif item.actionid == 3609 then if tonumber(filtrateString(getGlobalStorageValue(822090))[1]) == getPlayerAccountId(cid) and tonumber(filtrateString(getGlobalStorageValue(822090))[2]) >= os.time() then doPlayerSendTextMessage(cid, 25, "Bem vindo à sua hunt! Aproveite ela, você tem mais "..math.floor((tonumber(filtrateString(getGlobalStorageValue(822090))[2]) - os.time()) / 60).." minutos de hunt.") else doTeleportThing(cid, fromPosition) doPlayerSendCancel(cid, "Você não é dono dessa hunt! Para ser dono de uma hunt, compre em nosso website.") end end return true end
Postado Fevereiro 26, 2020 5 anos Amigo, não é 100% da forma que deseja.. porém é 80%. Segue.data/actions/actions.xml Citar <action uniqueid="2227" script="nome do seu script.lua" /> data/actions/scripts Crie um arquivo com o nome do script Citar -- Config # -- local areafrom = {x = 390, y = 127, z = 9} -- ENTRADA from - Parte superior esquerda do mapa da cave local areato = {x = 461, y = 157, z = 9} -- ENTRADA to - Parte inferior esquerda do mapa da cave local pos_exit = {x = 405, y = 141, z = 6} -- POS SAIDA - Para onde o player irá ao acabar se tenpo local pos_entrance = {x = 395, y = 138, z = 9} -- Aonde o player irá entrar ao clicar na alavanca local global_stor = 30050 local player_stor = 45319 local timetokick_free = {90, "min"} -- tempo local timetokick_vip = {90, "min"} -- tempo -- END -- local function convertTime(a) if(type(tonumber(a)) == "number" and a > 0) then if (a <= 3599) then local minute = math.floor(a/60) local second = a - (60 * minute) if(second == 0) then return ((minute)..((minute > 1) and " minutos" or " minuto")) else return ((minute ~= 0) and ((minute>1) and minute.." minutos e " or minute.." minuto e ").. ((second>1) and second.." segundos" or second.." segundo") or ((second>1) and second.." segundos" or second.. " segundo")) end else local hour = math.floor(a/3600) local minute = math.floor((a - (hour * 3600))/60) local second = (a - (3600 * hour) - (minute * 60)) if (minute == 0 and second > 0) then return (hour..((hour > 1) and " horas e " or " hora e "))..(second..((second > 1) and " segundos" or " segundo")) elseif (second == 0 and minute > 0) then return (hour..((hour > 1) and " horas e " or " hora e "))..(minute..((minute > 1) and " minutos" or " minuto")) elseif (second == 0 and minute == 0) then return (hour..((hour > 1) and " horas" or " hora")) end return (hour..((hour > 1) and " horas, " or " hora, "))..(minute..((minute > 1) and " minutos e " or " minuto e "))..(second..((second > 1) and " segundos" or " segundo")) end end end local function doRemoveMonstersInArea(from, to) for x = from.x, to.x do for y = from.y, to.y do local pos = {x=x, y=y, z = from.z} local m = getTopCreature(pos).uid if m > 0 and isMonster(m) then doRemoveCreature(m) end end end end local function getPlayersInArea(fromPos, toPos) local cave_exc_players = {} for _, pid in ipairs(getPlayersOnline()) do if isInRange(getPlayerPosition(pid), fromPos, toPos) then table.insert(cave_exc_players, pid) end end return cave_exc_players end local function kickPlayerFromArea(cid, p) for _, pid in ipairs(getPlayersOnline()) do if isPlayer(pid) and isInRange(getPlayerPosition(pid), p[1], p[2]) then doTeleportThing(pid, p[3]) doSendMagicEffect(p[3], CONST_ME_TELEPORT) doCreatureSay(pid, 'You were kicked out of the room.', TALKTYPE_ORANGE_1) end end end local 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 onUse(cid, item, frompos, item2, topos) local check_player = getPlayersInArea(areafrom, areato); if getGlobalStorageValue(cid, global_stor) - os.time() <= 0 and getPlayerStorageValue(cid, player_stor) - os.time() > 0 then doPlayerSendTextMessage(cid, 27, "Infelizmente o servidor deu SaveServer ou caiu e você perdeu sua Cave Exclusiva. Lamentamos muito o ocorrido, aguarde ".. convertTime(getPlayerStorageValue(cid, player_stor) - os.time()) .." para acessar alguma Cave Exclusiva novamente.") elseif getGlobalStorageValue(cid, global_stor) - os.time() > 0 and getPlayerStorageValue(cid, player_stor) - os.time() <= 0 then if #check_player > 0 then doPlayerSendTextMessage(cid, 27, "Possui um jogador nesta Cave Exclusiva. Aguarde ".. convertTime(getGlobalStorageValue(cid, global_stor) - os.time()) ..".") else doPlayerSendTextMessage(cid, 27, "Esta Cave Exclusiva está ocupada, o jogador não se encontra nela no momento, mas pode voltar. Aguarde ".. convertTime(getGlobalStorageValue(cid, global_stor) - os.time()) ..".") end elseif getGlobalStorageValue(cid, global_stor) - os.time() > 0 and getPlayerStorageValue(cid, player_stor) - os.time() > 0 then if #check_player > 0 then doTeleportThing(cid, pos_exit) doSendMagicEffect(getCreaturePosition(cid), 12) doPlayerSendTextMessage(cid, 27, "Você saiu da Cave Exclusiva. Você ainda possui ".. convertTime(getGlobalStorageValue(cid, global_stor) - os.time()) ..".") return true else doTeleportThing(cid, pos_entrance) doSendMagicEffect(getCreaturePosition(cid), 12) doPlayerSendTextMessage(cid, 27, "Você entrou na Cave Exclusiva. Você ainda possui ".. convertTime(getGlobalStorageValue(cid, global_stor) - os.time()) ..".") return true end elseif getGlobalStorageValue(cid, global_stor) - os.time() <= 0 and getPlayerStorageValue(cid, player_stor) - os.time() <= 0 and getPlayerItemCount(cid, 9971, 100) >= 1 then if getPlayerStorageValue(cid, 45343) - os.time() > 0 then doPlayerSendTextMessage(cid, 27, "Você já possui uma Cave Exclusiva. Só pode haver 1 Cave Exclusiva por personagem.") return true end if doPlayerRemoveItem(cid, 9971, 100) then if isPremium(cid) then setGlobalStorageValue(cid, global_stor, os.time()+90*60) setPlayerStorageValue(cid, player_stor, os.time()+90*60) setPlayerStorageValue(cid, 45343, os.time()+90*60) addEvent(kickPlayerFromArea, mathtime(timetokick_vip) * 1000, cid, {areafrom, areato, pos_exit}) else setGlobalStorageValue(cid, global_stor, os.time()+90*60) setPlayerStorageValue(cid, player_stor, os.time()+90*60) setPlayerStorageValue(cid, 45343, os.time()+1*60) addEvent(kickPlayerFromArea, mathtime(timetokick_free) * 1000, cid, {areafrom, areato, pos_exit}) end doRemoveMonstersInArea(areafrom, areato) doTeleportThing(cid, pos_entrance) doSendMagicEffect(getCreaturePosition(cid), 12) doPlayerSendTextMessage(cid, 27, "Você entrou na Cave Exclusiva. Você possui ".. convertTime(getGlobalStorageValue(cid, global_stor) - os.time()) ..".") end else doPlayerSendTextMessage(cid, 27, "Você não possui 100 barras de ouro para entrar. Você as consegue através de bosses, monstros e quests no servidor. Dica: [Destroyer Vip II], [Nilza], [Trokar Vip III], [Ventusy Imperor], [Brazilino] entre outros.") end return true end É um sistema de hunt exclusiva por alavanca, o sistema remove X itens da BP do Jogador e ele tem acesso a cave, durante 1h30. Caso outro player clique la alavanca, avisará que já tem um membro dentro dela e faltam Xh + Xmin + Xsec para acabar. Ou que mesmo caso o player não esteja dentro dela, a cave possui um dono e ele pode voltar durante seu tempo. O script já está autoexplicativo, você consegue ler e configurar. Editado Fevereiro 26, 2020 5 anos por alexpaimel (veja o histórico de edições)
Postado Junho 25, 2021 4 anos Meu char não move pra o lugar da cave, só ganha o acesso, o que pode ser?
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.