Postado Fevereiro 24, 2018 7 anos local cf = { teleportPosition = {x = 167, y = 49, z = 7, stackpos = 1}, -- Where the teleport will be created teleportToPosition = {x = 540, y = 665, z = 7}, -- Where the teleport will take you from = {x=508,y=641,z=7}, -- left top corner of event room to = {x=575,y=691,z=7} -- right bottom corner of event room } local function LoopEffectInTeleport(Position) local Teleport = getTileItemById(Position, 1387).uid if Teleport > 0 then doSendMagicEffect(Position, 55) doSendMagicEffect(Position, 56) addEvent(LoopEffectInTeleport, 5 * 1000) end end function onTime() doItemSetAttribute(doCreateTeleport(1387, cf.teleportToPosition, cf.teleportPosition), "aid", 1747) doBroadcastMessage("FireStorm event starting in 3 minutes! The teleport will be closed when the event start!", MESSAGE_STATUS_WARNING) LoopEffectInTeleport(cf.teleportToPosition) setGlobalStorageValue(17, 0) addEvent(startEventF, 3 * 60 * 1000) return true end function startEventF () doRemoveItem(getTileItemById(cf.teleportPosition, 1387).uid, 1) if getGlobalStorageValue(17) > 0 then addEvent(doRepeatCheckFireStorm, 5 * 1000) doBroadcastMessage("Good luck in the FireStorm event people! The teleport has closed!", MESSAGE_STATUS_WARNING) else doBroadcastMessage('FireStorm Event hasn\'t started beacuse there were not enough players.') end end y, x = 1, 1 function doRepeatCheckFireStorm () if getGlobalStorageValue(17) > 0 then local xTable, yTable, playerTable = {}, {}, {} for x = cf.from.x, cf.to.x do for y = cf.from.y, cf.to.y do table.insert(xTable, x) table.insert(yTable, y) local n, i = getTileInfo({x=x, y=y, z=cf.to.z}).creatures, 1 if n ~= 0 then local v = getThingfromPos({x=x, y=y, z=cf.to.z, stackpos=i}).uid while v ~= 0 do if isPlayer(v) then table.insert(playerTable, v) if n == #playerTable then break end end i = i + 1 v = getThingfromPos({x=x, y=y, z=cf.to.z, stackpos=i}).uid end end end end if #playerTable == 1 then doTeleportThing(playerTable[1], getTownTemplePosition(getPlayerTown(playerTable[1])), true) doItemSetAttribute(doPlayerAddItem(playerTable[1], 7371), "name", "trophy " .. getCreatureName(playerTable[1]) .. "! Congratulations! Winner a fire event") doPlayerAddItem(playerTable[1],9971,2) doPlayerAddItem(playerTable[1],10559,15) doBroadcastMessage('FireStorm Event has finished. The winner is ' .. getCreatureName(playerTable[1]) .. '. Congratulations.') setGlobalStorageValue(17, 0) x, y = 1, 1 elseif #playerTable > 1 then for a = 1, y do local pos = {x=xTable[math.random(#xTable)], y=yTable[math.random(#yTable)], z=7} for _, player in ipairs(playerTable) do local pPos = getThingPos(player) if pPos.x == pos.x and pPos.y == pos.y and pPos.z == pos.z then doTeleportThing(player, getTownTemplePosition(getPlayerTown(playerTable[1])), true) end end doSendDistanceShoot({x = pos.x - math.random(4, 6), y = pos.y - 5, z = pos.z}, pos, CONST_ANI_FIRE) addEvent(doSendMagicEffect, 150, pos, CONST_ME_HITBYFIRE) addEvent(doSendMagicEffect, 150, pos, CONST_ME_FIREAREA) math.random(100,1000) end if x == 5 * y then y = y + 1 end x = x + 1 else doBroadcastMessage('No one have won in Fire Storm Event.') setGlobalStorageValue(17, 0) x, y = 1, 1 end addEvent(doRepeatCheckFireStorm, 1000) end end Testa ai.
Postado Agosto 18, 2018 6 anos Autor Alguem poderia me ajudar colocar a mesma função em outros eventos? estou com dificuldade. function onTime() function isInWallArray(pos) for k = 0, table.getn(SBW_WALLSID) do if (getTileItemById(pos, SBW_WALLSID[k]).itemid == SBW_WALLSID[k]) then return true end end return false end function endsnowball() local score = {} if not SBW_USEWAIT then doRemoveItem(getTileItemById(SBW_TP, 1387).uid) end for _, pid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(pid, SBW_INEVENT) > 0 then table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, SBW_SCORE)}) doPlayerSetStorageValue(pid, SBW_INEVENT, 0) doPlayerSetStorageValue(pid, SBW_SCORE, 0) doPlayerSetStorageValue(pid, SBW_AMMO, 0) doTeleportThing(pid, SBW_TPEND) end end table.sort(score, function(a, b) return a[2] > b[2] end) --local random_item = SBW_REWARDS[math.random(1, #SBW_REWARDS)] local hora = os.date("%X") local data = os.date("%x") if table.getn(score) > 0 then if SBW_ADDREWARD then for _, pid in ipairs(getPlayersOnline()) do if getCreatureName(pid) == score[1][1] then for op,ad in pairs(SBW_REWARDS) do doPlayerAddItem(pid, ad[1], ad[2]) end break end end end db.query("INSERT INTO `snowballwar` VALUES ('', ".. db.escapeString(score[1][1]) .. ",".. score[1][2] ..", ".. db.escapeString(data) ..", ".. db.escapeString(hora) ..");") db.query("UPDATE `players` SET `sbw_points`=`sbw_points`+".. score[1][2] .." WHERE `name` = " .. db.escapeString(score[1][1]) .. ";") doBroadcastMessage("[SNOWBALL WAR] Foi encerrado, parabens ao jogador "..score[1][1].." que venceu o SnowBall com "..score[1][2].." pontos.") end return true end local t_l = SBW_AREA[1] local b_r = SBW_AREA[2] function moveToEvent() for _, pid in ipairs(getPlayersOnline()) do if isInRange(getCreaturePosition(pid), SBW_WAITROOM[1], SBW_WAITROOM[2]) then local posti = {} local isPossibleToTeleportPlayer = false while (isPossibleToTeleportPlayer == FALSE) do posti = Position(math.random(t_l.x,b_r.x), math.random(t_l.y, b_r.y), 7) if (isInWallArray(posti) == FALSE) then isPossibleToTeleportPlayer = TRUE end end doTeleportThing(pid, posti) doPlayerSetStorageValue(pid, SBW_INEVENT, 1) doPlayerSetStorageValue(pid, SBW_AMMO, SBW_MINAMMO) doPlayerSetStorageValue(pid, SBW_SCORE, 0) doPlayerSendTextMessage(pid, 27, "[SNOWBALL WAR] Seja bem vindo, aqui estao os comandos que voce vai usar durante o evento\n!snowball atirar --Atirar uma bola de neve.\n!snowball info --Isso mostra seus pontos de jogos e a quantia de bolas de neve que voce tem. Tambem mostra o ranking de pontos do evento.\n Recarregue suas bolas de neve clicando em frente ao gerador no centro do campo.\nAltamente recomendado adicionar estes comandos a sua hotkeys.") end end doRemoveItem(getTileItemById(SBW_TP, 1387).uid) addEvent(endsnowball, SBW_DURATION*1000*60) doBroadcastMessage(SBW_MSGSTART) end local time = os.date("*t") local timeopen1 = math.ceil(SBW_TIMEWAIT / 4) local timeopen2 = math.ceil(SBW_TIMEWAIT / 2) if (SBW_STARTAUTO) and (isInArray(SBW_DAYS,time.wday)) then doBroadcastMessage(SBW_MSGWARNING) if SBW_USEWAIT then addEvent(doBroadcastMessage, timeopen1*1000*60, "[SNOWBALL WAR] - Resta(m) ".. timeopen2 .." minuto(s) para iniciar o evento!") if (timeopen2 ~= timeopen1) then addEvent(doBroadcastMessage, timeopen2*1000*60, "[SNOWBALL WAR] - Resta(m) ".. timeopen1 .." minuto(s) para iniciar o evento!") end addEvent(moveToEvent, SBW_TIMEWAIT*1000*60) doCreateTeleport(1387, SBW_TPGO, SBW_TP) else if SBW_TFS == "0.3" then doItemSetAttribute(doCreateItem(1387, SBW_TP), "aid", 2880) else doSetItemActionId(doCreateItem(1387, SBW_TP), 2880) end if(SBW_DURATION > 0) then addEvent(endsnowball, SBW_DURATION*1000*60) end end end return true end up
Postado Agosto 18, 2018 6 anos Autor alguem ajuda ae local function LoopEffectInTeleport(Position) local Teleport = getTileItemById(Position, 1387).uid if Teleport > 0 then doSendMagicEffect(Position, 55) doSendMagicEffect(Position, 56) addEvent(LoopEffectInTeleport, 5 * 1000) end end Tem que colocar isso em algum lugar q eu nao sei onde é, na verdade eu tentei mas n deu
Postado Agosto 19, 2018 6 anos Solução @theeusata55 Mostrar conteúdo oculto function onTime() function isInWallArray(pos) for k = 0, table.getn(SBW_WALLSID) do if (getTileItemById(pos, SBW_WALLSID[k]).itemid == SBW_WALLSID[k]) then return true end end return false end local function LoopEffectInTeleport(Position) local Teleport = getTileItemById(Position, 1387).uid if Teleport > 0 then doSendMagicEffect(Position, 55) doSendMagicEffect(Position, 56) addEvent(LoopEffectInTeleport, 5 * 1000) end end function endsnowball() local score = {} if not SBW_USEWAIT then doRemoveItem(getTileItemById(SBW_TP, 1387).uid) end for _, pid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(pid, SBW_INEVENT) > 0 then table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, SBW_SCORE)}) doPlayerSetStorageValue(pid, SBW_INEVENT, 0) doPlayerSetStorageValue(pid, SBW_SCORE, 0) doPlayerSetStorageValue(pid, SBW_AMMO, 0) doTeleportThing(pid, SBW_TPEND) end end table.sort(score, function(a, b) return a[2] > b[2] end) --local random_item = SBW_REWARDS[math.random(1, #SBW_REWARDS)] local hora = os.date("%X") local data = os.date("%x") if table.getn(score) > 0 then if SBW_ADDREWARD then for _, pid in ipairs(getPlayersOnline()) do if getCreatureName(pid) == score[1][1] then for op,ad in pairs(SBW_REWARDS) do doPlayerAddItem(pid, ad[1], ad[2]) end break end end end db.query("INSERT INTO `snowballwar` VALUES ('', ".. db.escapeString(score[1][1]) .. ",".. score[1][2] ..", ".. db.escapeString(data) ..", ".. db.escapeString(hora) ..");") db.query("UPDATE `players` SET `sbw_points`=`sbw_points`+".. score[1][2] .." WHERE `name` = " .. db.escapeString(score[1][1]) .. ";") doBroadcastMessage("[SNOWBALL WAR] Foi encerrado, parabens ao jogador "..score[1][1].." que venceu o SnowBall com "..score[1][2].." pontos.") end return true end local t_l = SBW_AREA[1] local b_r = SBW_AREA[2] function moveToEvent() for _, pid in ipairs(getPlayersOnline()) do if isInRange(getCreaturePosition(pid), SBW_WAITROOM[1], SBW_WAITROOM[2]) then local posti = {} local isPossibleToTeleportPlayer = false while (isPossibleToTeleportPlayer == FALSE) do posti = Position(math.random(t_l.x,b_r.x), math.random(t_l.y, b_r.y), 7) if (isInWallArray(posti) == FALSE) then isPossibleToTeleportPlayer = TRUE end end doTeleportThing(pid, posti) doPlayerSetStorageValue(pid, SBW_INEVENT, 1) doPlayerSetStorageValue(pid, SBW_AMMO, SBW_MINAMMO) doPlayerSetStorageValue(pid, SBW_SCORE, 0) doPlayerSendTextMessage(pid, 27, "[SNOWBALL WAR] Seja bem vindo, aqui estao os comandos que voce vai usar durante o evento\n!snowball atirar --Atirar uma bola de neve.\n!snowball info --Isso mostra seus pontos de jogos e a quantia de bolas de neve que voce tem. Tambem mostra o ranking de pontos do evento.\n Recarregue suas bolas de neve clicando em frente ao gerador no centro do campo.\nAltamente recomendado adicionar estes comandos a sua hotkeys.") end end doRemoveItem(getTileItemById(SBW_TP, 1387).uid) addEvent(endsnowball, SBW_DURATION*1000*60) doBroadcastMessage(SBW_MSGSTART) end local time = os.date("*t") local timeopen1 = math.ceil(SBW_TIMEWAIT / 4) local timeopen2 = math.ceil(SBW_TIMEWAIT / 2) if (SBW_STARTAUTO) and (isInArray(SBW_DAYS,time.wday)) then doBroadcastMessage(SBW_MSGWARNING) if SBW_USEWAIT then addEvent(doBroadcastMessage, timeopen1*1000*60, "[SNOWBALL WAR] - Resta(m) ".. timeopen2 .." minuto(s) para iniciar o evento!") if (timeopen2 ~= timeopen1) then addEvent(doBroadcastMessage, timeopen2*1000*60, "[SNOWBALL WAR] - Resta(m) ".. timeopen1 .." minuto(s) para iniciar o evento!") end addEvent(moveToEvent, SBW_TIMEWAIT*1000*60) doCreateTeleport(1387, SBW_TPGO, SBW_TP) LoopEffectInTeleport(SBW_TP) else if SBW_TFS == "0.3" then doItemSetAttribute(doCreateItem(1387, SBW_TP), "aid", 2880) else doSetItemActionId(doCreateItem(1387, SBW_TP), 2880) end if(SBW_DURATION > 0) then addEvent(endsnowball, SBW_DURATION*1000*60) end end end return true end
Postado Agosto 19, 2018 6 anos Autor Agradeço, funcionou certinho. Irei deixar outros scripts dos eventos que falta, se alguem tiver um tempo e poder ajudar non resto eu agradeço. OBS: Talvez tenha alguns eventos que não sao no globalevents e sim nas libs Zombie.lua DTT.lua DesertWAR.lua BattlefieldOpen.lua CTF.lua @up Editado Agosto 19, 2018 6 anos por theeusata55 (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.