Postado Julho 13, 2015 9 anos Queria Saber se esse script da pra deixa automatico \/ local THRONE_POS = {x = 561, y = 446, z = 5} local STORAGE_EVENT = 83902 local STORAGE_PLAYER = 73289 local DUR = 10 -- 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(6258, 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 = 531, y = 460, z = 7}) doCreateItem(391, 1, {x = 500, y = 500, z = 7}) 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 = 539, y = 474, z = 7}, 1285) local escada = getTileItemById({ x = 539, y = 474, z = 7}, 3687) if pedra.uid > 0 then return doRemoveItem(pedra.uid) else return doCreateItem(1285, 1, { x = 500, y = 500, z = 7}) end if escada.uid > 0 then return doRemoveItem(escada.uid) else return doCreateItem(3687, 1, {x = 500, y = 500, 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 = 500, y = 500, z = 7}) OpenEvent() CastleWalls() addEvent(getWinnerCastle, DUR * 60 * 1000) return true end
Postado Julho 13, 2015 9 anos Lembrando que é um globalevent agora... local function getWinnerCastle(cid) local THRONE_POS = {x = 561, y = 446, z = 5} local DUR = 10 -- in minutes 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(6258, 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 = 531, y = 460, z = 7}) doCreateItem(391, 1, {x = 500, y = 500, z = 7}) 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 local function OpenEvent() local STORAGE_EVENT = 83902 local STORAGE_PLAYER = 73289 for _, tid in ipairs(getPlayersOnline()) do setPlayerStorageValue(tid, STORAGE_PLAYER, 1) end setGlobalStorageValue(STORAGE_EVENT, 1) doBroadcastMessage("O Evento castle foi aberto.", 25) end local function CastleWalls() local pedra = getTileItemById({ x = 539, y = 474, z = 7}, 1285) local escada = getTileItemById({ x = 539, y = 474, z = 7}, 3687) if pedra.uid > 0 then return doRemoveItem(pedra.uid) else return doCreateItem(1285, 1, { x = 500, y = 500, z = 7}) end if escada.uid > 0 then return doRemoveItem(escada.uid) else return doCreateItem(3687, 1, {x = 500, y = 500, z = 7}) end end function onThink(cid, interval, lastexecution) local times = { ["12:00"] = {date="Saturday"}, ["14:00"] = {date="Sunday"} } if getGlobalStorageValue(19234, 1) then return false end if times[hours] ~= false and os.date("%A") == times[hours].date then doCreateItem(3687, 1, {x = 500, y = 500, z = 7}) OpenEvent() CastleWalls() addEvent(getWinnerCastle, DUR * 60 * 1000) addEvent(function () setGlobalStorageValue(19234, 1) end, os.clock()+600) end return true end Editado Julho 13, 2015 9 anos por Vinicius Xxgamexx (veja o histórico de edições) Ando devagar, porque já tive pressa. E levo esse sorriso, porque já chorei demais... ________________________________________________________________________________ Minhas Sprites: Mega Metagross Mega Abomasnow Pack de Shinys [Posso atualizá-lo com novos shinys a qualquer momento] Tutoriais: [Completo] Criando e adicionando um novo Pokémon [Actions] Criando quest no RME Editores Lua/Xml/Sync Entre outros: Editores Win/Mac/Linux
Postado Julho 13, 2015 9 anos Autor <globalevent name="castle" type="startup" event="script" value="castle.lua"/> coloquei esa tag mas ta dando erro /\
Postado Julho 13, 2015 9 anos Qual é esse erro exatamente ?? Ando devagar, porque já tive pressa. E levo esse sorriso, porque já chorei demais... ________________________________________________________________________________ Minhas Sprites: Mega Metagross Mega Abomasnow Pack de Shinys [Posso atualizá-lo com novos shinys a qualquer momento] Tutoriais: [Completo] Criando e adicionando um novo Pokémon [Actions] Criando quest no RME Editores Lua/Xml/Sync Entre outros: Editores Win/Mac/Linux
Postado Julho 13, 2015 9 anos Autor [13/07/2015 15:29:26] [Warning - Event::loadScript] Event onStartup not found (data/globalevents/scripts/castle.lua) tem como dizer uma tag tb pq sou ruim pra esas coisas Editado Julho 13, 2015 9 anos por Xandinhorasta (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.