Postado Fevereiro 13, 2016 9 anos Ola galera.... Alguem poderia me ajudar? Estou com um servidor de war que muda o mapa a cada 20 minutos ou se algum time "ganhar".... Alguem poderia me ajudar a adicionar , quando isto acontecer (ou o player logar) resetar também o level e vocation? (se possivel randomizar a vocation) Se não for possivel introduzir no script , poderia ser também por movement , pisando no tile que o mapa manda quando muda se nao tiver a storage, e em algum momento ela tem q ser resetada..... Acredito que esse seja o script Citar -- config -- WAR_MAP_NAMES = {'FIBULA', 'EDRON', ' VENORE', 'THAIS', 'ARENA', 'ARENA 3', 'ARENA 1', 'ARENA 2'} WAR_SPAWNS = {} WAR_SPAWNS[1] = {{2,2},{3,3}} -- map 1 WAR_SPAWNS[2] = {{5,5},{6,6}} -- map 2 WAR_SPAWNS[3] = {{8,8},{9,9}} -- map 3 WAR_SPAWNS[4] = {{11,11},{12,12}} -- map 4 WAR_SPAWNS[5] = {{36,36},{34,34}} -- map 5 WAR_SPAWNS[6] = {{37,37},{38,38}} -- map 6 WAR_SPAWNS[7] = {{41,41},{42,42}} -- map 8 positions = { {{x = 260,y = 535, z = 9},{x = 280,y = 555, z = 9}}, {{x = 1003,y = 907, z = 7},{x =1013,y = 917, z = 7}}, {{x = 970,y = 973, z = 7},{x = 984,y = 987, z = 7}} } WAR_MAP_CYCLE = {{1,2},{2,3},{3,4},{4,5},{5,6},{6,7},{7,1}} WAR_COLORS = {{98,94,94,94},{89,89,89,89}} WAR_TEAM_NAMES = {'Team Red','Team Blue'} WAR_BROADCAST_INTERVAL_TOP5 = 213 WAR_START_LEVEL = 140 WAR_TEAMS = 1 WAR_POINTS_FOR_KILL = 3 WAR_POINTS_FOR_KILL_ASSIST = 1 -------------------------------------------------------- STORAGE_LAST_KILLER_GUID = 10100 STORAGE_LAST_KILLER_GUID_TIMES = 10101 STORAGE_LAST_KILLER_IP = 10200 STORAGE_LAST_KILLER_IP_TIMES = 10201 STORAGE_LAST_KILLER_ACCOUNT = 10300 STORAGE_LAST_KILLER_ACCOUNT_TIMES = 10301 STORAGE_POINTS = 11000 STORAGE_TEAM_ID = 12000 STORAGE_SKULL = 13000 STORAGE_DEPOT = 14000 GLOBAL_STORAGE_MAP = 500 GLOBAL_STORAGE_MAP_CHANGE_TIME = 501 GLOBAL_STORAGE_TEAM_1_FRAGS = 600 GLOBAL_STORAGE_TEAM_2_FRAGS = 700 GLOBAL_STORAGE_BROADCAST_TOP5 = 800 warInitialized = 0 function getTime(s) local n = math. floor(s / 60) s = s - (60 * n) return n, s end function getSpawn(cid) local map_info = WAR_MAP_CYCLE[getGlobalStorageValue(GLOBAL_STORAGE_MAP)] local map_id = map_info[1] local map_spawns = WAR_SPAWNS[map_id] local team_spawns = map_spawns[getPlayerStorageValue(cid, STORAGE_TEAM_ID)] return getTownTemplePosition(team_spawns[math.random(1,#team_spawns)]) end function getTeamMembers(id) local players = getPlayersOnline() local team = {} if #players == 0 then return team end for i, cid in ipairs(players) do if getPlayerStorageValue(cid, STORAGE_TEAM_ID) == id and getPlayerGroupId(cid) == 1 then table.insert(team, cid) end end return team end function updateOutfit(cid) if WAR_TEAMS == 1 then --outfit local colors = WAR_COLORS[getPlayerStorageValue(cid, STORAGE_TEAM_ID)] local outfit = getCreatureOutfit(cid) outfit.lookHead = colors[1] outfit.lookBody = colors[2] outfit.lookLegs = colors[3] outfit.lookFeet = colors[4] doCreatureChangeOutfit(cid, outfit) end end function setTeam(cid) if WAR_TEAMS ~= 1 then setPlayerStorageValue(cid, STORAGE_TEAM_ID, 1) else local team1 = getTeamMembers(1) local team2 = getTeamMembers(2) if #team1 >= #team2 then setPlayerStorageValue(cid, STORAGE_TEAM_ID, 2) setPlayerStorageValue(cid, 3000, 1) else setPlayerStorageValue(cid, STORAGE_TEAM_ID, 1) setPlayerStorageValue(cid, 3001, 1) end updateOutfit(cid) end end function cronWar() if getGlobalStorageValue(GLOBAL_STORAGE_MAP_CHANGE_TIME) < os.time() then -- change map local map_info = WAR_MAP_CYCLE[getNextMapId()] local map_id = map_info[1] doTeleportThing(pid,getTeamSpawn(pid),false) -- teleporta para a base if WAR_TEAMS == 1 then doBroadcastMessage(getTeamScore(), MESSAGE_STATUS_DEFAULT) end setMap(getNextMapId()) elseif getGlobalStorageValue(GLOBAL_STORAGE_BROADCAST_TOP5) < os.time() then -- broadcast top 5 setGlobalStorageValue(GLOBAL_STORAGE_BROADCAST_TOP5, os.time()+WAR_BROADCAST_INTERVAL_TOP5) addEvent(doBroadcastMessage, 1000, getTop5Players(), MESSAGE_STATUS_CONSOLE_ORANGE) end addEvent(cronWar, 1000) end function getNextMapId() if getGlobalStorageValue(GLOBAL_STORAGE_MAP) == #WAR_MAP_CYCLE then return 1 end return getGlobalStorageValue(GLOBAL_STORAGE_MAP)+1 end function getTop5Players() local players = getPlayersOnline() if #players == 0 then return top5text end local player1 = {0,-1} local player2 = {0,-1} local player3 = {0,-1} local player4 = {0,-1} local player5 = {0,-1} local top5text = "Top 5 Fragers Online" for i, cid in ipairs(players) do if getPlayerStorageValue(cid,19999) > player1[2] then player5 = {player4[1], player4[2]} player4 = {player3[1], player3[2]} player3 = {player2[1], player2[2]} player2 = {player1[1], player1[2]} player1 = {cid, getPlayerStorageValue(cid,19999)} elseif getPlayerStorageValue(cid,19999) > player2[2] then player5 = {player4[1], player4[2]} player4 = {player3[1], player3[2]} player3 = {player2[1], player2[2]} player2 = {cid, getPlayerStorageValue(cid,19999)} elseif getPlayerStorageValue(cid,19999) > player3[2] then player5 = {player4[1], player4[2]} player4 = {player3[1], player3[2]} player3 = {cid, getPlayerStorageValue(cid,19999)} elseif getPlayerStorageValue(cid,19999) > player4[2] then player5 = {player4[1], player4[2]} player4 = {cid, getPlayerStorageValue(cid,19999)} elseif getPlayerStorageValue(cid,19999) > player1[2] then player5 = {cid, getPlayerStorageValue(cid,19999)} end end if player1[1] > 0 then top5text = top5text .. "\n1. " .. getCreatureName(player1[1]) .. " - " .. player1[2]+1 .. " frags" end if player2[1] > 0 then top5text = top5text .. "\n2. " .. getCreatureName(player2[1]) .. " - " .. player2[2]+1 .. " frags" end if player3[1] > 0 then top5text = top5text .. "\n3. " .. getCreatureName(player3[1]) .. " - " .. player3[2]+1 .. " frags" end if player4[1] > 0 then top5text = top5text .. "\n4. " .. getCreatureName(player4[1]) .. " - " .. player4[2]+1 .. " frags" end if player5[1] > 0 then top5text = top5text .. "\n5. " .. getCreatureName(player5[1]) .. " - " .. player5[2]+1 .. " frags" end return top5text end function getTeamScore() return WAR_TEAM_NAMES[1] .. " - " .. getGlobalStorageValue(GLOBAL_STORAGE_TEAM_1_FRAGS) .. " : " .. getGlobalStorageValue(GLOBAL_STORAGE_TEAM_2_FRAGS) .. " - " .. WAR_TEAM_NAMES[2] end function setMap(id) local map_info = WAR_MAP_CYCLE[id] setGlobalStorageValue(GLOBAL_STORAGE_MAP,id) local players = getPlayersOnline() for i, cid in ipairs(players) do addEvent(doRemoveCreature, 5*1000, cid, true) setPlayerStorageValue(cid,17778,0) -- seta verificacao de bandeira em 0 setPlayerStorageValue(cid,17777,0) -- seta verificacao de bandeira em 0 setGlobalStorageValue(17778,0) -- ninguem ficar com bandeira time verde! setGlobalStorageValue(17779,0) -- ninguem ficar com bandeira time vermelho! setGlobalStorageValue(18888,0) -- ninguem ficar com bandeira time verde! setGlobalStorageValue(18889,0) -- ninguem ficar com bandeira time vermelho!! setGlobalStorageValue(5002,0) -- ninguem ficar com bandeira time verde! setGlobalStorageValue(5001,0) -- ninguem ficar com bandeira time verde! setGlobalStorageValue(4002,0) -- ninguem ficar com bandeira time verde! setGlobalStorageValue(4001,0) -- ninguem ficar com bandeira time verde! setGlobalStorageValue(11544 ,0) -- ninguem ficar com bandeira time verde! setGlobalStorageValue(11543,0) -- ninguem ficar com bandeira time verde! setGlobalStorageValue(5555,0) -- ninguem ficar com bandeira time verde! setGlobalStorageValue(5656,0) -- ninguem ficar com bandeira time verde! doCreatureSetSkullType(cid, 0) doCreatureAddHealth(cid, getCreatureMaxHealth(cid)) doCreatureAddMana(cid, getCreatureMaxMana(cid)) doChangeSpeed(cid, -getCreatureSpeed(cid) + getCreatureBaseSpeed(cid)) doTeleportThing(cid, getSpawn(cid), TRUE) removeConditions(cid) end end function removeConditions(cid) doRemoveCondition(cid, CONDITION_INFIGHT) doRemoveCondition(cid, CONDITION_PARALYZE) doRemoveCondition(cid, CONDITION_ENERGY) doRemoveCondition(cid, CONDITION_FIRE) doRemoveCondition(cid, CONDITION_POISON) doRemoveCondition(cid, CONDITION_DRUNK) end Editado Fevereiro 13, 2016 9 anos por Mayke Fleury (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.