Postado Maio 15, 2020 5 anos Entao rapaziada estou com um problema no meu batle field automatico,ele funciona corretamente o unico problema é que ele nao remove as paredes que separa um time do outro,o evento starta da a msg de inicio mas nao remove a wall para os times se atacarem Parendes Id: 1543 ERRO NA DISTRO: BattleLib: Citar _Lib_Battle_Info = { Reward = {2160,10}, TeamOne = {name = "Madara", storage = 140120, pos = {x=1071,y=1551,z=7}}, TeamTwo = {name = "Hashirama",storage = 140121,pos = {x=1030,y=1552,z=7}}, storage_count = 180400, tpPos = {x=1021, y=1017, z=8}, limit_Time = 10 -- em minutos } function resetBattle() return setGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage, 0) and setGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage, 0) end function OpenWallBattle() local B = { {1543,{x=1062, y=1554, z=6, stackpos = 1}}, {1543,{x=1062, y=1555, z=6, stackpos = 1}}, {1543,{x=1062, y=1056, z=6, stackpos = 1}}, {1543,{x=1062, y=1057, z=6, stackpos = 1}} } for i = 1, #B do if getTileItemById(B[2], B[1]).uid == 0 then doRemoveItem(getThingfromPos(B[2]).uid,1) else doCreateItem(B[1], 1, B[2]) end end end function doBroadCastBattle(type,msg) local players = {} for _, cid in pairs(getPlayersOnline()) do if getPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage) == 1 or getPlayerStorageValue(cid, _Lib_Battle_Info.TeamTwo.storage) == 1 then table.insert(players, cid) end end for i = 1, #players do doPlayerSendTextMessage(players,type,msg) end end function removeBattleTp() local t = getTileItemById(_Lib_Battle_Info.tpPos, 1387).uid return t > 0 and doRemoveItem(t) and doSendMagicEffect(_Lib_Battle_Info.tpPos, CONST_ME_POFF) end function getWinnersBattle(storage) local players,str = {},"" for _, cid in pairs(getPlayersOnline()) do if getPlayerStorageValue(cid, storage) == 1 then table.insert(players, cid) end end str = str .. ""..#players.." Player"..(#players > 1 and "s" or "").." from team "..(getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage) == 0 and _Lib_Battle_Info.TeamTwo.name or _Lib_Battle_Info.TeamOne.name).." won the event battlefield, they received a ".._Lib_Battle_Info.Reward[2].." "..getItemNameById(_Lib_Battle_Info.Reward[1]).."!" for i = 1, #players do doPlayerAddItem(players, _Lib_Battle_Info.Reward[1], _Lib_Battle_Info.Reward[2]) doRemoveCondition(players, CONDITION_OUTFIT) doTeleportThing(players, getTownTemplePosition(getPlayerTown(players))) setPlayerStorageValue(players, storage, -1) end resetBattle() OpenWallBattle() return doBroadcastMessage(str) end function CheckEvent(delay) if delay > 0 and getGlobalStorageValue(_Lib_Battle_Info.storage_count) > 0 then doBroadcastMessage("[battleField Event] We are waiting "..getGlobalStorageValue(_Lib_Battle_Info.storage_count).." players to Battlefield starts") elseif delay == 0 and getGlobalStorageValue(_Lib_Battle_Info.storage_count) > 0 then local players = {} for _, cid in pairs(getPlayersOnline()) do if getPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage) == 1 or getPlayerStorageValue(cid, _Lib_Battle_Info.TeamTwo.storage) == 1 then table.insert(players, cid) end end for i = 1, #players do doRemoveCondition(players, CONDITION_OUTFIT) doTeleportThing(players, getTownTemplePosition(getPlayerTown(players))) setPlayerStorageValue(players, getPlayerStorageValue(players, _Lib_Battle_Info.TeamOne.storage) == 1 and _Lib_Battle_Info.TeamOne.storage or _Lib_Battle_Info.TeamTwo.storage, -1) end doBroadcastMessage("The event cannot be started because not had enough players.") setGlobalStorageValue(_Lib_Battle_Info.storage_count, 0) resetBattle() removeBattleTp() end addEvent(CheckEvent, 60000, delay-1) 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.