Postado Agosto 31, 2021 3 anos gostaria de saber se da pra por esse evento automatico, ele é um evento de castelo queria por ele toda segunda,quinta, sabado Mostrar conteúdo oculto local THRONE_POS = {x = 2561, y = 2446, z = 5} local STORAGE_EVENT = 83902 local STORAGE_PLAYER = 73289 local DUR = 15 -- in minutes function OpenEvent() for _, tid in ipairs(getPlayersOnline()) do setPlayerStorageValue(tid, STORAGE_PLAYER, 1) end setGlobalStorageValue(STORAGE_EVENT, 1) doBroadcastMessage("O Evento castle foi aberto.", 25) end function getWinnerCastle(cid) CastleWalls() local player = getTopCreature(THRONE_POS).uid if getGlobalStorageValue(STORAGE_EVENT) < 0 then return true end if (isPlayer(player)) then if (getPlayerStorageValue(player, STORAGE_PLAYER) > 0) then pid = getPlayerGUID(cid) setHouseOwner(6257, pid) doPlayerAddPremiumDays(player, 7) for _, cid in ipairs(getPlayersOnline()) do setPlayerStorageValue(cid, STORAGE_PLAYER, 0) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) end doBroadcastMessage(getCreatureName(player) .. " ganhou o evento.", 25) doTeleportThing(player, {x = 2531, y = 2460, z = 7}) doCreateItem(391, 1, {x = 2561, y = 2446, z = 5}) end else doBroadcastMessage("Ningúem ganhou o evento.", 27) for _, pid in ipairs(getPlayersOnline()) do setPlayerStorageValue(pid, STORAGE_PLAYER, 0) doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid))) end end setGlobalStorageValue(STORAGE_EVENT, 0) return db.executeQuery("DELETE FROM `player_storage` WHERE `key` = " .. STORAGE_PLAYER) end function CastleWalls() local pedra = getTileItemById({ x = 2539, y = 2474, z = 7}, 1285) local escada = getTileItemById({ x = 2539, y = 2474, z = 7}, 3687) if pedra.uid > 0 then return doRemoveItem(pedra.uid) else return doCreateItem(1285, 1, { x = 2539, y = 2474, z = 7}) end if escada.uid > 0 then return doRemoveItem(escada.uid) else return doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7}) end end function onSay(cid, words, param, channel) if ((param == "abrir") and (getGlobalStorageValue(STORAGE_EVENT) == 1)) then doPlayerSendTextMessage(cid, 27, "O evento já esta aberto.") return true elseif ((param == "fechar") and (getGlobalStorageValue(STORAGE_EVENT) == 1)) then getWinnerCastle() CastleWalls() return true end doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7}) OpenEvent() CastleWalls() addEvent(getWinnerCastle, DUR * 60 * 1000) return true end
Postado Setembro 2, 2021 3 anos local THRONE_POS = {x = 2561, y = 2446, z = 5} local STORAGE_EVENT = 83902 local STORAGE_PLAYER = 73289 local DUR = 15 -- in minutes local days = {"Monday", "Saturday", "Thursday"} -- coloque os dias function OpenEvent() for _, tid in ipairs(getPlayersOnline()) do setPlayerStorageValue(tid, STORAGE_PLAYER, 1) end setGlobalStorageValue(STORAGE_EVENT, 1) doBroadcastMessage("O Evento castle foi aberto e vai durar ".. DUR .." minutos.", 25) end function getWinnerCastle() CastleWalls() local player = getTopCreature(THRONE_POS).uid if getGlobalStorageValue(STORAGE_EVENT) < 0 then return true end if (isPlayer(player)) then if (getPlayerStorageValue(player, STORAGE_PLAYER) > 0) then local pid = getPlayerGUID(player) setHouseOwner(6257, pid) doPlayerAddPremiumDays(player, 7) for _, cid in ipairs(getPlayersOnline()) do setPlayerStorageValue(cid, STORAGE_PLAYER, 0) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) end doBroadcastMessage(getCreatureName(player) .. " ganhou o evento.", 25) doTeleportThing(player, {x = 2531, y = 2460, z = 7}) doCreateItem(391, 1, {x = 2561, y = 2446, z = 5}) end else doBroadcastMessage("Ningúem ganhou o evento.", 27) for _, pid in ipairs(getPlayersOnline()) do setPlayerStorageValue(pid, STORAGE_PLAYER, 0) doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid))) end end setGlobalStorageValue(STORAGE_EVENT, 0) return db.executeQuery("DELETE FROM `player_storage` WHERE `key` = " .. STORAGE_PLAYER) end function isEventDay() for _, dia in pairs(days) do if dia == os.date("%A") then return true end end return false end function CastleWalls() local pedra = getTileItemById({ x = 2539, y = 2474, z = 7}, 1285) local escada = getTileItemById({ x = 2539, y = 2474, z = 7}, 3687) if pedra.uid > 0 then return doRemoveItem(pedra.uid) else return doCreateItem(1285, 1, { x = 2539, y = 2474, z = 7}) end if escada.uid > 0 then return doRemoveItem(escada.uid) else return doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7}) end end function onTimer() if isEventDay() and getGlobalStorageValue(STORAGE_EVENT) <= 0 then doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7}) OpenEvent() CastleWalls() addEvent(getWinnerCastle, DUR * 60 * 1000) end return true end TAG <globalevent name="castle automatic" time="20:00" event="script" value="nome do seu script.lua"/>
Postado Setembro 2, 2021 3 anos Autor Vou testar e aviso Em 02/09/2021 em 18:25, Vodkart disse: local THRONE_POS = {x = 2561, y = 2446, z = 5} local STORAGE_EVENT = 83902 local STORAGE_PLAYER = 73289 local DUR = 15 -- in minutes local days = {"Monday", "Saturday", "Thursday"} -- coloque os dias function OpenEvent() for _, tid in ipairs(getPlayersOnline()) do setPlayerStorageValue(tid, STORAGE_PLAYER, 1) end setGlobalStorageValue(STORAGE_EVENT, 1) doBroadcastMessage("O Evento castle foi aberto e vai durar ".. DUR .." minutos.", 25) end function getWinnerCastle() CastleWalls() local player = getTopCreature(THRONE_POS).uid if getGlobalStorageValue(STORAGE_EVENT) < 0 then return true end if (isPlayer(player)) then if (getPlayerStorageValue(player, STORAGE_PLAYER) > 0) then local pid = getPlayerGUID(player) setHouseOwner(6257, pid) doPlayerAddPremiumDays(player, 7) for _, cid in ipairs(getPlayersOnline()) do setPlayerStorageValue(cid, STORAGE_PLAYER, 0) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) end doBroadcastMessage(getCreatureName(player) .. " ganhou o evento.", 25) doTeleportThing(player, {x = 2531, y = 2460, z = 7}) doCreateItem(391, 1, {x = 2561, y = 2446, z = 5}) end else doBroadcastMessage("Ningúem ganhou o evento.", 27) for _, pid in ipairs(getPlayersOnline()) do setPlayerStorageValue(pid, STORAGE_PLAYER, 0) doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid))) end end setGlobalStorageValue(STORAGE_EVENT, 0) return db.executeQuery("DELETE FROM `player_storage` WHERE `key` = " .. STORAGE_PLAYER) end function isEventDay() for _, dia in pairs(days) do if dia == os.date("%A") then return true end end return false end function CastleWalls() local pedra = getTileItemById({ x = 2539, y = 2474, z = 7}, 1285) local escada = getTileItemById({ x = 2539, y = 2474, z = 7}, 3687) if pedra.uid > 0 then return doRemoveItem(pedra.uid) else return doCreateItem(1285, 1, { x = 2539, y = 2474, z = 7}) end if escada.uid > 0 then return doRemoveItem(escada.uid) else return doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7}) end end function onTimer() if isEventDay() and getGlobalStorageValue(STORAGE_EVENT) <= 0 then doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7}) OpenEvent() CastleWalls() addEvent(getWinnerCastle, DUR * 60 * 1000) end return true end TAG <globalevent name="castle automatic" time="20:00" event="script" value="nome do seu script.lua"/> VODkart o programa iniciou o evento normalmente mas tem 1 probleminha tipo queria q quando acabar o evento o player q ganhou ganharia o castelo mas não ta passando a house pra o vencedor
Postado Setembro 3, 2021 3 anos é pq no seu código está outra house id né... nessa linha: setHouseOwner(6257, pid) troca por: setHouseOwner(223, pid, true) ## EDIT ## era "pid" ao invés de "player" ... já arrumei!! ------------------------- EDITEI O TÓPICO, ARRUMEI A VARIÁVEL!! Editado Setembro 3, 2021 3 anos por Vodkart (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.