Postado Julho 18, 2022 2 anos .Qual servidor ou website você utiliza como base? otx 2.8 Qual o motivo deste tópico? duvida Está surgindo algum erro? Se sim coloque-o aqui. Citar Como faço pra colocar para os 4 players só entrar de 20 em 20 minutos? Você tem o código disponível? Se tiver publique-o aqui: function onUse(cid, item, fromPosition, itemEx, toPosition) local room = { ['start'] = {x=2192, y=2543, z=8}, ['end'] = {x=2213, y=2564, z=8} } local boss_name = 'Gravelord' local boss = {x=2203, y=2549, z=8} local kick_pos = {x=2195, y=2583, z=8} local players_pos = { {x=2194, y=2577, z=8, stackpos = 253}, {x=2195, y=2577, z=8, stackpos = 253}, {x=2196, y=2577, z=8, stackpos = 253}, {x=2197, y=2577, z=8, stackpos = 253} } local new_player_pos = {x=2205, y=2564, z=8} local player = {0, 0, 0, 0} local all_ready = 0 if item.itemid == 1945 then for i = 1, 4 do player[i] = getThingfromPos(players_pos[i]) if player[i].itemid > 0 and isPlayer(player[i].uid) then all_ready = 1 end end if all_ready == 1 then doCreateMonster(boss_name, {x=boss.x, y=boss.y, z=boss.z}) for i = 1, 4 do if isPlayer(player[i].uid) then doSendMagicEffect(players_pos[i], 2) doTeleportThing(player[i].uid, new_player_pos, false) doSendMagicEffect(new_player_pos, 10) addEvent(kickFromArea, (10 * 60 * 1000), player[i].uid, room['start'], room['end'], kick_pos) all_ready = 0 end end doTransformItem(item.uid, 1946) end elseif item.itemid == 1946 then local player_room = 0 for x = room['start'].x, room['end'].x do for y = room['start'].y, room['end'].y do for z = room['start'].z, room['end'].z do local pos = {x=x, y=y, z=z, stackpos=253} local thing = getThingfromPos(pos) if thing.itemid > 0 then if isPlayer(thing.uid) == true then player_room = player_room + 1 end end end end end if player_room >= 1 then doPlayerSendTextMessage(cid, 19, "There is already a player in the boss room.") elseif player_room == 0 then for x = room['start'].x, room['end'].x do for y = room['start'].y, room['end'].y do for z = room['start'].z, room['end'].z do local pos = {x=x, y=y, z=z, stackpos=253} local thing = getThingfromPos(pos) if thing.itemid > 0 then doRemoveCreature(thing.uid) end end end end player_room = 0 doTransformItem(item.uid, 1945) end end return true end Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui.
Postado Julho 18, 2022 2 anos 3 horas atrás, iTzBrHue3 disse: .Qual servidor ou website você utiliza como base? otx 2.8 Qual o motivo deste tópico? duvida Está surgindo algum erro? Se sim coloque-o aqui. Você tem o código disponível? Se tiver publique-o aqui: function onUse(cid, item, fromPosition, itemEx, toPosition) local room = { ['start'] = {x=2192, y=2543, z=8}, ['end'] = {x=2213, y=2564, z=8} } local boss_name = 'Gravelord' local boss = {x=2203, y=2549, z=8} local kick_pos = {x=2195, y=2583, z=8} local players_pos = { {x=2194, y=2577, z=8, stackpos = 253}, {x=2195, y=2577, z=8, stackpos = 253}, {x=2196, y=2577, z=8, stackpos = 253}, {x=2197, y=2577, z=8, stackpos = 253} } local new_player_pos = {x=2205, y=2564, z=8} local player = {0, 0, 0, 0} local all_ready = 0 if item.itemid == 1945 then for i = 1, 4 do player[i] = getThingfromPos(players_pos[i]) if player[i].itemid > 0 and isPlayer(player[i].uid) then all_ready = 1 end end if all_ready == 1 then doCreateMonster(boss_name, {x=boss.x, y=boss.y, z=boss.z}) for i = 1, 4 do if isPlayer(player[i].uid) then doSendMagicEffect(players_pos[i], 2) doTeleportThing(player[i].uid, new_player_pos, false) doSendMagicEffect(new_player_pos, 10) addEvent(kickFromArea, (10 * 60 * 1000), player[i].uid, room['start'], room['end'], kick_pos) all_ready = 0 end end doTransformItem(item.uid, 1946) end elseif item.itemid == 1946 then local player_room = 0 for x = room['start'].x, room['end'].x do for y = room['start'].y, room['end'].y do for z = room['start'].z, room['end'].z do local pos = {x=x, y=y, z=z, stackpos=253} local thing = getThingfromPos(pos) if thing.itemid > 0 then if isPlayer(thing.uid) == true then player_room = player_room + 1 end end end end end if player_room >= 1 then doPlayerSendTextMessage(cid, 19, "There is already a player in the boss room.") elseif player_room == 0 then for x = room['start'].x, room['end'].x do for y = room['start'].y, room['end'].y do for z = room['start'].z, room['end'].z do local pos = {x=x, y=y, z=z, stackpos=253} local thing = getThingfromPos(pos) if thing.itemid > 0 then doRemoveCreature(thing.uid) end end end end player_room = 0 doTransformItem(item.uid, 1945) end end return true end Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. Citar function onUse(cid, item, fromPosition, itemEx, toPosition) local room = { storage = 676631, -- storage, só mude se tiver usando pra outra coisa. tempo = 20, -- tempo em minutos. ['start'] = {x=2192, y=2543, z=8}, ['end'] = {x=2213, y=2564, z=8} } local boss_name = 'Gravelord' local boss = {x=2203, y=2549, z=8} local kick_pos = {x=2195, y=2583, z=8} local players_pos = { {x=2194, y=2577, z=8, stackpos = 253}, {x=2195, y=2577, z=8, stackpos = 253}, {x=2196, y=2577, z=8, stackpos = 253}, {x=2197, y=2577, z=8, stackpos = 253} } local new_player_pos = {x=2205, y=2564, z=8} local player = {0, 0, 0, 0} local all_ready = 0 if getPlayerStorageValue(cid, room.storage) < os.time() then if item.itemid == 1945 then for i = 1, 4 do player[i] = getThingfromPos(players_pos[i]) if player[i].itemid > 0 and isPlayer(player[i].uid) then all_ready = 1 end end if all_ready == 1 then doCreateMonster(boss_name, {x=boss.x, y=boss.y, z=boss.z}) for i = 1, 4 do if isPlayer(player[i].uid) then doSendMagicEffect(players_pos[i], 2) doTeleportThing(player[i].uid, new_player_pos, false) doSendMagicEffect(new_player_pos, 10) addEvent(kickFromArea, (10 * 60 * 1000), player[i].uid, room['start'], room['end'], kick_pos) all_ready = 0 end end doTransformItem(item.uid, 1946) end elseif item.itemid == 1946 then local player_room = 0 for x = room['start'].x, room['end'].x do for y = room['start'].y, room['end'].y do for z = room['start'].z, room['end'].z do local pos = {x=x, y=y, z=z, stackpos=253} local thing = getThingfromPos(pos) if thing.itemid > 0 then if isPlayer(thing.uid) == true then player_room = player_room + 1 end end end end end if player_room >= 1 then doPlayerSendTextMessage(cid, 19, "There is already a player in the boss room.") elseif player_room == 0 then for x = room['start'].x, room['end'].x do for y = room['start'].y, room['end'].y do for z = room['start'].z, room['end'].z do local pos = {x=x, y=y, z=z, stackpos=253} local thing = getThingfromPos(pos) if thing.itemid > 0 then doRemoveCreature(thing.uid) end end end end player_room = 0 doTransformItem(item.uid, 1945) doPlayerPopupFYI(cid, "Voce precisa aguardar ".. getPlayerStorageValue(cid, room.storage) - os.time() .." segundos.") end end return true end
Postado Julho 18, 2022 2 anos Autor 1 hora atrás, Vitorelias disse: conseguir fazer assim for i = 1, 4 do if player[i].uid > 0 then if getPlayerStorageValue(player[i].uid, stor) > os.time() then doPlayerSendTextMessage(player[i].uid, 19, os.time() - getPlayerStorageValue(cid, stor)) all_ready = 0 end end end mas como deixa o tempo em segundos no os.time? Editado Julho 18, 2022 2 anos por iTzBrHue3 (veja o histórico de edições)
Postado Julho 18, 2022 2 anos 53 minutos atrás, iTzBrHue3 disse: mas como deixa o tempo em segundos no os.time? local tempo = getPlayerStorageValue(cid, storage) - os.time() if tempo > 0 then if tempo > 60 then doPlayerSendCancel(cid,"Você precisa esperar "..math.floor(tempo/60).." minutos e "..(tempo%60).." segundos.") else doPlayerSendCancel(cid,"Você precisa esperar "..(tempo%60).." segundos.") end return true end eu uso assim pra checar tempo em segundos tempo/60 ou seja, tempo da storage - os.time() se for 600 segundos vai pegar 600/60 = 10 e tempo%60 = resto da equação, ou seja, o que sobra da divisão são segundos 6 minutos atrás, FeeTads disse: math.floor(tempo/60) math.floor = arredonda pra baixo math.ceil = arredonda pra cima uso o arredonda pra baixo pq normalmente os.time/60 da um numero tipo 21.0505850, ai sempre arredonda pra 2 digitos Editado Julho 18, 2022 2 anos por FeeTads (veja o histórico de edições)
Postado Julho 19, 2022 2 anos Solução Bom dia! timeToAgain = Tempo para entrar novamente posLever = posição da alavanca storP = storageValue que adicionei, caso queira mudar, basta trocar -- Edited by xMonkey local room = { ['start'] = {x=2192, y=2543, z=8}, ['end'] = {x=2213, y=2564, z=8} } local players_pos = { {x=2194, y=2577, z=8, stackpos = 253}, {x=2195, y=2577, z=8, stackpos = 253}, {x=2196, y=2577, z=8, stackpos = 253}, {x=2197, y=2577, z=8, stackpos = 253} } local boss_name = 'Gravelord' local boss = {x=2203, y=2549, z=8} local kick_pos = {x=2195, y=2583, z=8} local new_player_pos = {x=2205, y=2564, z=8} local player = {0, 0, 0, 0} local all_ready = 0 local timeToAgain = {20, "min"} local posLever = {x=00000, y=00000, z=00} local storP = 12281 -- Para deixar mais organizado, jogar essas funções em LIB (se jogar em LIB, remover o local na frente de function) -- Custom Functions (inicio) 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 local function getTimeString(self) local format = { {'dia', self / 60 / 60 / 24}, {'hora', self / 60 / 60 % 24}, {'minuto', self / 60 % 60}, {'segundo', self % 60} } local out = {} for k, t in ipairs(format) do local v = math.floor(t[2]) if(v > 0) then table.insert(out, (k < #format and (#out > 0 and ', ' or '') or ' e ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or '')) end end local ret = table.concat(out) if ret:len() < 16 and ret:find('segundo') then local a, b = ret:find(' e ') ret = ret:sub(b+1) end return ret end -- Custom Functions (fim) function onUse(cid, item, fromPosition, itemEx, toPosition) if item.itemid == 1945 then for i = 1, 4 do player[i] = getThingfromPos(players_pos[i]) if player[i].itemid > 0 and isPlayer(player[i].uid) then if (getPlayerStorageValue(player[i].uid, storP) - os.time() > 0) then doCreatureSay(cid, "O jogador ".. getPlayerName(player[i].uid) .." deve aguardar ".. getTimeString(getPlayerStorageValue(player[i].uid, storP) - os.time()) .." para fazer novamente.", TALKTYPE_ORANGE_1, false, 0, posLever) return true end all_ready = 1 end end if all_ready == 1 then doCreateMonster(boss_name, {x=boss.x, y=boss.y, z=boss.z}) for i = 1, 4 do if isPlayer(player[i].uid) then doSendMagicEffect(players_pos[i], 2) doTeleportThing(player[i].uid, new_player_pos, false) doSendMagicEffect(new_player_pos, 10) setPlayerStorageValue(player[i].uid, storP, os.time() + mathtime(timeToAgain)) addEvent(kickFromArea, (10 * 60 * 1000), player[i].uid, room['start'], room['end'], kick_pos) all_ready = 0 end end doTransformItem(item.uid, 1946) end elseif item.itemid == 1946 then local player_room = 0 for x = room['start'].x, room['end'].x do for y = room['start'].y, room['end'].y do for z = room['start'].z, room['end'].z do local pos = {x=x, y=y, z=z, stackpos=253} local thing = getThingfromPos(pos) if thing.itemid > 0 then if isPlayer(thing.uid) == true then player_room = player_room + 1 end end end end end if player_room >= 1 then doPlayerSendTextMessage(cid, 19, "There is already a player in the boss room.") elseif player_room == 0 then for x = room['start'].x, room['end'].x do for y = room['start'].y, room['end'].y do for z = room['start'].z, room['end'].z do local pos = {x=x, y=y, z=z, stackpos=253} local thing = getThingfromPos(pos) if thing.itemid > 0 then doRemoveCreature(thing.uid) end end end end player_room = 0 doTransformItem(item.uid, 1945) end end return true end
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.