Advertisement
Eliaseeg

ShamanBattle

Jun 10th, 2014
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 27.05 KB | None | 0 0
  1. shaman = {
  2. "@4858080","@4665162","@4669167","@4665304","@4666393","@4668170","@4674901","@4677540","@4677664",
  3. '<C><P D="illu-niveau.png,340,140,defilante_mort.png,153,100,defilante_vitesse.png,642,100" /><Z><S><S L="394" H="68" X="199" Y="370" T="3" P="0,0,0,9999,0,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="10" o="e46f1c" X="394" c="3" Y="448" T="12" H="406" /><S L="400" H="63" X="600" Y="369" T="9" P="0,0,,,,0,0,0" /><S H="406" L="10" o="62b9e5" X="404" c="3" Y="448" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="48" o="" H="10" Y="213" T="12" X="400" /><S P="0,0,0.3,0.2,0,0,0,0" L="91" o="e46f1c" X="46" Y="246" T="12" H="11" /><S L="91" o="62b9e5" X="754" H="11" Y="246" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0,0,10,0,0,0" L="94" o="" X="46" Y="255" T="12" H="12" /></S><D><DS Y="194" X="400" /></D><O><O C="11" Y="100" P="0" X="153" /><O C="11" Y="100" X="642" P="0" /></O></Z></C>'
  4. }
  5. langs={
  6.       ES={
  7.           help={"<font size='18'><p align='center'><B>#ShamanBattle</B></p></font><font size='12'>\nShamanBattle es un minijuego creado por <j>Eliaseeg <n>& <j>Aritxy<n>. Consiste en matar todos los chamanes sin que te maten, el último que quede vivo, gana.\n\n<p align='center'><font size='16'><b>Índice</b></font></p><br><br><font size='14'><a href='event:help'><g>1) <n>Información</a><br><a href='event:Comandos'><g>2) <n>Comandos.</a><br><a href='event:Equipo'><g>3) <n>Equipo.</a></a> \n\n\n\n\n\n\n<font size='9'><R>Reporta cualquier error a Eliaseeg o Aritxy.</r>",
  8.             "<font size='18'><p align='center'><B>Comandos</B></p></font><font size='12'>\nÉsta es la página de los comandos. Los siguientes comandos son los añadidos al juego.\n\n\n<b>!perfil usuario</b><j> - <n>Te muestra el perfil del usuario.\n<b>!perfil me</b><j> - <n>Muestra tu perfil.\n<b>!ranking/leaderboard/top/scoreboard</b><j> - <n>Muestra el ranking.\n<b>!title numero</b><j> - <n>Cambia tú título.\n<b>!afk\n\n<font size='18'><p align='center'><B>Hotkeys</B></p></font>\n<b>P</b><j> - <n> Muestra/cierra el perfil\n<b>H</b><j> - <n>Muestra/cierra la ayuda.\n<b>L</b><j> - <n>Muestra/cierra el ranking",
  9.             "<g><font size='18'><p align='center'><B>Títulos</B></p></font>1) <n>Iniciado              <g>2) <n>Sobreviviente\n<g>3) <n>Cañon *-*             <g>4) <n>Shaman\n<g>5) <n>Coleccionador          <g>6) <n>Camper\n<g>7) <n>El salvador          <g>8) <n>Graduado\n<g>9) <n>Hábil              <g>10) <n>Inmortal\n<g>11) <n>Ratón de acero               <g>12) <n>Superviviente\n<g>13) <n>Iluminado                <g>14) <n>Dios de Survivor\n<g>15) <n>Maestro Cervecero                 <g>16) <n>Tejedor de niebla\n<g>17) <n>Escapista                <g>18) <n>Perseguidor\n<g>19) <n>El mejor               <g>20) <n>Asesino en serie\n<g>21) <n>INMORTAL :0",
  10.             "<font size='18'><p align='center'><b>Equipo</b></p></font>\n<font size='18'><p align='center'><B>Administradores</B></p></font><br><font size='12' color='#EB1D51'><b>Eliaseeg</b> <J>-<n> Tiene todos los permisos. Se encarga del mantenimiento y mejoras de ShamanBattle\n<font color='#EB1D51'><b>Aritxy</b> <J>-<n> Tiene todos los permisos. </font>\n\n<font size='18'><p align='center'><B>Mapcrews</B></p></font>\nNo hay. :("};
  11.          level_up = "<BV><b>₪</b> ¡%s subió al nivel <CH>%s",
  12.          welcome = "<n>¡Hola %s! bienvenid@ a <ch>#ShamanBattle! <n>Presiona <ch>H <n>o escribe <ch>!help <n>para ver una lista de información.",
  13.          spirit_warning = "<R>¡Has usado %d / %d <R>chispas disponibles!",
  14.          xp = "<BV>Has ganado <CH>%s <BV>de experiencia <G>(<BV>Nivel: <CH>%d<G>)",  
  15.          newRound = "<CH>Una nueva ronda comenzó, mata a todos los demás chamanes para obtener la victoria.",
  16.          battleName = "#<CH>Shaman<font color='#FEB1FC'>battle<font>  <g>|  <BV>Mata a todos los demás chamanes  <g>|  <n>Tiempo: <v>%s  <g>|  <n>Chamanes restantes: <v>%s \n",
  17.          map = "<n>Ahora jugando el mapa de: <V>%s<n> con el codigo: <J>%s<BL> - <BV>P%s",
  18.          winRound = "<CH>%s <n>ganó la ronda! <g>(<n>Nivel: <CH>%d<g>).",
  19.          inv = "La ronda empieza en <v>%s",
  20.          profiletext = "<font size='13'>\n\n\<bl><p align='center'>«%s»</p><br><bl>• Tribu: <ch>%s<br><bl>• Rondas ganadas: <ch>%s<br><bl>• Nivel: <ch>%s<br><bl>• Experiencia restante: <ch>%s<br><bl>• Muertes: <ch>%s<br><br><bl>• Títulos desbloqueados <g>(baja el scroll para ver más títulos)<bl>: <br><bl>%s",
  21.          profile = "<p align='center'><font size='17' color='#%s'>%s",
  22.          unlock_title = "<bv><b>₪</b> %s ha desbloqueado el titulo <j>«%s»",
  23.          change_title = "<bv><b>₪</b> Tú nuevo título será: <j>«%s».",
  24.   },
  25.       EN={
  26.           help={"<font size='18'><p align='center'><B>#ShamanBattle</B></p></font><font size='12'>\nShamanBattle is a minigame created by <j>Eliaseeg <n>& <j>Aritxy<n>. Your objective is to kill all shamans, last mouse alive wins the round.\n\n<p align='center'><font size='16'><b>Index</b></font></p><br><br><font size='14'><a href='event:help'><g>1) <n>Information</a><br><a href='event:Comandos'><g>2) <n>Commands</a><br><a href='event:Equipo'><g>3) <n>Team</a></font>\n\n\n\n\n\n<font size='9'><R>Report any bugs to Eliaseeg or Aritxy.</r>",
  27.             "<font size='18'><p align='center'><B>Commands</B></p></font><font size='12'>\nThis page is for commands, the following commands are added in game.\n\n\n<b>!perfil user</b><j> - <n>Shows the user's profile\n<b>!perfil me</b><j> - <n>Sampe profile.\n<b>!ranking/leaderboard/top/scoreboard</b><j> - <n>Shows the rankings.\n<b>!title number</b><j> - <n>Changes your title.\n<b>!afk\n\n<font size='18'><p align='center'><B>Hotkeys</B></p></font>\n<b>P</b><j> - <n> Shows/closes the profile.\n<b>H</b><j> - <n>Shows/closes the help.\n<b>L</b><j> - <n>Shows/closes the ranking.",
  28.             "<g><font size='18'><p align='center'><B>Titles</B></p></font>1) <n>Initiated               <g>2) <n>Survivor\n<g>3) <n>Cannon *-*          <g>4) <n>Shaman\n<g>5) <n>Collector           <g>6) <n>Camper\n<g>7) <n>El salvador             <g>8) <n>Graduated\n<g>9) <n>Business               <g>10) <n>Immortal\n<g>11) <n>Mouse of steel      <g>12) <n>Super Survivor\n<g>13) <n>Iluminated            <g>14) <n>God of Survivor\n<g>15) <n>Brewmaster<g>16) <n>Weaver Fogger\n<g>17) <n>Escapist            <g>18) <n>Tracker\n<g>19) <n>Best           <g>20) <n>Serial Murderer\n<g>21) <n>IMMORTAL :0",
  29.             "<font size='18'><p align='center'><b>Team</b></p></font>\n<font size='18'><p align='center'><B>Administrators</B></p></font><br><font size='12' color='#EB1D51'><b>Eliaseeg</b> <J>-<n> Will be responsible for maintenance and improvements of ShamanBattle\n<font color='#EB1D51'><b>Aritxy</b> <J>-<n> Has license. </font>\n\n<font size='18'><p align='center'><B>Mapcrews</B></p></font>\nNone. :("};
  30.          level_up = "<BV><b>₪</b> %s is now level <CH>%s!",
  31.          welcome = "<n>Hi %s! Welcome to <ch>#ShamanBattle! <n>Type <ch>!help <n>or press <ch>H <n>for information.",
  32.          spirit_warning = "<R>You used %d / %d spirits allowed!",
  33.          xp = "<BV>You won <CH>%s <BV>xp <G>(<BV>Level: <CH>%d<G>)",
  34.          newRound = "<CH>A new round has begun, kill everyone to win!",
  35.          battleName = "#<CH>Shaman<font color='#FEB1FC'>battle<font>  <g>|  <BV>Kill everyone to win  <g>|  <n>Time: <v>%s  <g>|  <n>Shamans: <v>%s \n",
  36.          map =  "<n>Now playing the map of: <V>%s<n> Code: <J>%s<BL> - <BV>P%s",
  37.          winRound = "<CH>%s <n>has won the round! <g>(<n>Level: <CH>%d<g>).",
  38.          inv = "The round starts in <v>%s",
  39.          profiletext = "<font size='13'>\n\n<p align='center'>«%s»</p><br><bl>• Tribe: <ch>%s<br><bl>• Rounds won: <ch>%s<br><bl>• Level: <ch>%s<br><bl>• Xp left: <ch>%s<br><bl>• Times killed: <ch>%s<br><br><bl>• Unlocked titles: <g>(Scroll down to see all titles)<bl>:<br><bl>%s",
  40.          profile = "<p align='center'><font size='17' color='#%s'>%s",
  41.          unlock_title = "<bv><b>₪</b> %s has unlocked the title <j>«%s»",
  42.          change_title = "<bv><b>₪</b> Your new title is: <j>«%s».",
  43.       },
  44.         TR={
  45.           help={"<font size='18'><p align='center'><B>#ShamanBattle</B></p></font><font size='12'>\nShamanBattle minioyunu  <j>Eliaseeg <n>& <j>Aritxy<n> tarafından yapılmış bir oyundur. Amacınız tüm şamanları öldürmek.Hayatta kalan fare kazanır\n\n<p align='center'><font size='16'><b>Dizin</b></font></p><br><br><font size='14'><a href='event:help'><g>1) <n>Bilgi</a><br><a href='event:Comandos'><g>2) <n>Komutlar</a><br><a href='event:Equipo'><g>3) <n>Takım</a></font>\n\n\n\n\n\n<font size='9'><R>Sorunları bildirmek için Eliaseeg veya Aritxy ile iletişime geçin.</r>",
  46.             "<font size='18'><p align='center'><B>Komutlar</B></p></font><font size='12'>\nBu sayfadaki  komutlar, aşağıdaki komutlar için minioyuna eklenmiştir.\n\n\n<b>!profil,perfil kullanıcı</b><j> - <n>Kullanıcı Profili Görüntüler\n<b>!profil,perfil me</b><j> - <n>Kendi Profilinizi Görüntüler.\n<b>!ranking/leaderboard/top/scoreboard</b><j> - <n>Sıralamayı Gösterir.\n<b>!title numara</b><j> - <n>Titlenizi Değiştirir.\n<b>!afk\n\n<font size='18'><p align='center'><B>Kısayol tuşları</B></p></font>\n<b>P</b><j> - <n> Profili Gösterir/Kapatır.\n<b>H</b><j> - <n>Yardım Sekmesini Gösterir/Kapatır\n<b>L</b><j> - <n>Sıralamayı Gösterir/Kapatır.",
  47.             "<g><font size='18'><p align='center'><B>Titleler</B></p></font>1) <n>Initiated             <g>2) <n>Survivor\n<g>3) <n>Cannon *-*          <g>4) <n>Shaman\n<g>5) <n>Collector           <g>6) <n>Camper\n<g>7) <n>El salvador             <g>8) <n>Graduated\n<g>9) <n>Business               <g>10) <n>Immortal\n<g>11) <n>Mouse of steel      <g>12) <n>Super Survivor\n<g>13) <n>Iluminated            <g>14) <n>God of Survivor\n<g>15) <n>Brewmaster<g>16) <n>Weaver Fogger\n<g>17) <n>Escapist            <g>18) <n>Tracker\n<g>19) <n>Best           <g>20) <n>Serial Murderer\n<g>21) <n>IMMORTAL :0",
  48.             "<font size='18'><p align='center'><b>Takım</b></p></font>\n<font size='18'><p align='center'><B>Adminler</B></p></font><br><font size='12' color='#EB1D51'><b>Eliaseeg</b> <J>-<n> Sorumlu olacak bakım ve iyileştirmeler için  ShamanBattle\n<font color='#EB1D51'><b>Aritxy</b> <J>-<n> Tarafından Lisanslandırılmıstır.. </font>\n\n<font size='18'><p align='center'><B>Mapcrews</B></p></font>\nYok. :("};
  49.          level_up = "<BV><b>₪</b> %s şimdi <CH>%s seviyede!",
  50.          welcome = "<n>Merhaba %s! <ch>#ShamanBattle!  Minioyununa Hoş Geldiniz <n>Yardım için  <ch>!help <n>veya  <ch>H <n>tuşuna basarak bilgi alabilirsin.",
  51.          spirit_warning = "<R>Kullandığınız  %d / %d spirits izinleri!",
  52.          xp = "<CH>%s <BV>xp <BV>kazandı. <G>(<BV>Level: <CH>%d<G>)",
  53.          newRound = "<CH>Yeni bir tur başladı, herkesi öldürmek için kazanın!",
  54.          battleName = "#<CH>Shaman<font color='#FEB1FC'>Battle<font>  <g>|  <BV>Herkes Öldürerek Kazadığı:  <g>|  <n>Zaman: <v>%s  <g>|  <n>Şaman: <v>%s \n",
  55.          map =  "<n>Harita Şimdi Açılıyor: <V>%s<n> Kod: <J>%s<BL> - <BV>P%s",
  56.          winRound = "<CH>%s <n>roundu kazandı! <g>(<n>Level: <CH>%d<g>).",
  57.          inv = "Yeni Round Başlıyor <v>%s",
  58.          profiletext = "<font size='13'>\n\n<bl><p align='center'>«%s»</p><br><bl>• Kazandığı Round: <ch>%s<br><bl>• Level: <ch>%s<br><bl>• Xp left: <ch>%s<br><bl>• Öldürdüğü Kişi Sayısı: <ch>%s<br><br><bl>• Açtığı Titleler: <g>(Tüm başlıkları görmek için aşağı doğru ilerleyin)<bl>:<br><bl>%s",
  59.          profile = "<p align='center'><font size='17' color='#%s'>%s",
  60.          unlock_title = "<bv><b>₪</b> %s ünvanı kazandı. <j>«%s»",
  61.          change_title = "<bv><b>₪</b> Yeni Title: <j>«%s».",
  62.       }
  63. }
  64. local images = {
  65.   newPlayer = "2opfIg6.png"
  66. }
  67. local obj = {1,2,3,4,5,6,7,8,9,10,21,22,23,25,26,27,28,32,44}; 
  68. local chamanes=0
  69. local id1
  70. local time = 0
  71. local data={}
  72. local invb = true
  73. local invtime = 0
  74. local perfil = false
  75. local color = 0x191919
  76. local map = true
  77. local titles = {"Initiated","Survivor","Cannon *-*","Shaman","Collector","Camper","El Salvador","Graduated","Business","Immortal","Mouse of steel","Super Survivor","Iluminated","God of Survivor","Brewmaster","Weaver Fogger","Escapist","Persecuter","The Best ", "Serial Murderer", "IMMORTAL :0"}
  78. local admins = {"Eliaseeg"}
  79. local mapcrews = {"Stheblindd"}
  80. function inTable(t,a)if type(t)=="table" then for x,y in pairs(t)do if a==y then return true    end end return false end end
  81.  
  82. function main()
  83.     tfm.exec.disableAutoNewGame(true)
  84.     tfm.exec.disableAutoTimeLeft(true)
  85.     tfm.exec.disableAllShamanSkills(true)
  86.     tfm.exec.disableAutoShaman(true)
  87.     tfm.exec.disableAfkDeath(true)
  88.     for i, command in ipairs ({"perfil","p","stats", "title","help","profile","leaderboard","rank","top","scoreboard","afk","lang","langue","ranking"}) do
  89.       system.disableChatCommandDisplay(command,true)
  90.     end
  91.     startGame()
  92. end
  93.  
  94. function startGame()   
  95.  local newMap;
  96.         repeat
  97.              newMap = shaman[math.random(#shaman)];
  98.         until newMap ~= tfm.get.room.currentMap
  99.         tfm.exec.newGame (newMap)
  100. end
  101.  
  102. function eventNewGame()
  103.   shamanBattle()
  104.   time = 127
  105.   chamanes = 0
  106.   ui.removeTextArea(6,nil)
  107.   ui.removeTextArea(7,nil)
  108.     for name,player in pairs(tfm.get.room.playerList) do   
  109.         message(string.format(getTrans(name).map, tfm.get.room.xmlMapInfo.author, tfm.get.room.currentMap, tfm.get.room.xmlMapInfo.permCode))
  110.         if data[name].afk == true then
  111.           tfm.exec.killPlayer(name)
  112.         end  
  113.     end
  114. end
  115.  
  116. function message(s,p)
  117.     tostring(s)
  118.     if tfm.get.room.name:sub(2,2)=="" then
  119.         print(s)
  120.     else
  121.         tfm.exec.chatMessage(s,p)
  122.     end
  123. end
  124.  
  125. function getColour(name)
  126.  local adm = inTable(admins,name)
  127.   if adm then
  128.     color = 'EB1D51'
  129.     else
  130.     color = 'C2C2DA'
  131.     end
  132.     return color
  133. end
  134.  
  135. function getTransMessage()
  136.       return langs[idioma] or langs.ES
  137. end
  138.  
  139. function eventNewPlayer(name)
  140.  if not data[name] then
  141.   data[name]={}
  142.   data[name].perfil = false
  143.   data[name].rank = false
  144.   data[name].help = false
  145.   data[name].wins = 0
  146.   data[name].muertes = 0
  147.   data[name].spirits = 0
  148.   data[name].paginah = 1
  149.   data[name].idioma = "ES"
  150.   data[name].nTime = 5
  151.   data[name].stat={1,150,0}
  152.   -- Nivel, xp faltante, xp actual
  153.   data[name].titles={true}for i=2,#titles do data[name].titles[i]=false end
  154.   data[name].title=titles[1]
  155.  end  
  156. local adm = inTable(admins,name)
  157.   ui.addTextArea(0,"<p align='center'><a href='event:help'><b>?</b></a></p>",name,780,25,16,16,nil,0x324650,nil,true)
  158.   for key=1,100 do
  159.   tfm.exec.bindKeyboard(name,key,true,true)
  160.   message(string.format(getTransMessage().welcome, name), name)
  161.   id1 = tfm.exec.addImage(images.newPlayer, "!1", 400-771, 200-420, name)
  162.  end
  163.  if adm then
  164.   data[name].titles={true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true}for i=21,#titles do data[name].titles[i]=true end
  165.   data[name].title=titles[16]
  166.   data[name].stat={100,1500,2000}
  167.   end
  168. end
  169.  
  170. for p in pairs(tfm.get.room.playerList) do
  171.   eventNewPlayer(p)
  172. end  
  173.  
  174. function getTrans(name)
  175.     return langs[data[name].idioma] or langs.ES
  176. end
  177.  
  178. function addTextArea(id,text,p,x,y,w,h,bac,boc,alpha,scroll,espinfo)
  179. ui.addTextArea(id,text,p,x,y,w,h,0x324650,0x27373F,1,true,true)
  180. ui.addTextArea(id+8000,"<font size='14'><p align='center'>"..espinfo.."</p>",p,x,y,w,20,0x27373F,0x27373F,1,true,true)
  181. ui.addTextArea(id+7000,"<p align='center'><a href='event:close'>Cerrar</a></p>",p,x,y+h+5,w,20,0x324650,0x27373F,1,true)
  182. end
  183.  
  184. function removeTextArea(id,player)
  185. ui.removeTextArea(8000+id,player)
  186. ui.removeTextArea(7000+id,player)
  187. ui.removeTextArea(id,player)
  188. end
  189.  
  190. function eventLoop(ct,rt)
  191. time = time-0.5
  192.   local timed = string.format("%.2d:%.2d",time/60%60, time%60)
  193.   for p in pairs(tfm.get.room.playerList) do
  194.     data[p].nTime = data[p].nTime-0.5
  195.     tfm.exec.setUIMapName(string.format(getTrans(p).battleName, timed, chamanes))
  196.   end
  197.     if time <= 0 then
  198.         startGame()
  199.         end
  200.     if invb == true then
  201.     invtime = invtime-0.5
  202.     for p in pairs(tfm.get.room.playerList) do
  203.       ui.addTextArea(2,string.format(getTrans(p).inv, math.floor(invtime)),name,310,25,nil,nil,0x990000,0x990000,0.6,true)
  204.         end
  205.     end
  206.     if invtime == 0 then
  207.         invb = false
  208.         makeShamans(true)
  209.         invtime=7
  210.         for p in pairs(tfm.get.room.playerList) do
  211.           tfm.exec.setNameColor(p, math.random(0x000000, 0xFFFFFF))
  212.           ui.removeTextArea(2,p)
  213.         end
  214.     end
  215.  --[[for name in pairs(tfm.get.room.playerList) do 
  216.   if data[name].nTime <= 0 then
  217.     tfm.exec.removeImage(id1)    
  218.     end  
  219.   end]]
  220. end
  221.    
  222. function shamanBattle(name)
  223.   invb = true
  224.   invtime = 7
  225.   time = 125
  226.   tfm.exec.setGameTime(127)
  227.   for name in pairs(tfm.get.room.playerList) do
  228.     data[name].spirits = 0
  229.       message(getTrans(name).newRound)
  230.     tfm.exec.setNameColor(name,0xC2C2DA)
  231.     end
  232. end
  233.  
  234. function eventChatCommand(name, command)
  235. local args={}  
  236. local adm = inTable(admins,name)
  237. local mc = inTable(mapcrews,name)
  238. for arg in command:gmatch("[^%s]+") do
  239.   table.insert(args,arg:lower())
  240. end  
  241.     if args[1] == "stats" or args[1] == "perfil" or args[1] == "p" or args[1]=="profile" and data[capitalize(args[2])] then
  242.                 getPerfil(capitalize(args[2]), name)
  243.  
  244.     elseif args[1] == "lang" and args[2] == "en" then
  245.         data[name].idioma = "EN"
  246.         print('hello')
  247.     elseif args[1] == "lang" and args[2] == "es" then
  248.         data[name].idioma = "ES"
  249.         print('hola')
  250.         elseif args[1] == "lang" and args[2] == "tr" then
  251.         data[name].idioma = "TR"
  252.         print('merhaba')
  253.     elseif args[1]=="rank" or args[1]=="leaderboard" or args[1]=="top" or args[1]=="scoreboard" or args[1]=="ranking" then
  254.       leaderboard(name)
  255.     elseif args[1]=="title" then
  256.       if args[2] then
  257.         changetitle(name, tonumber(args[2]))
  258.         end
  259.     elseif args[1]=="help" then
  260.         ui.addTextArea(9,getTrans(name).help[data[name].paginah],name,100,40,600,300,0x26353d,0x26353d,nil,true);
  261.         ui.addTextArea(10,"<p align='center'><J><a href='event:previous'><B>←</B></a> <G>(Prev)</p>",name,330,355,nil,16,0x26353d,0x26353d,nil,true);
  262.         ui.addTextArea(11,"<p align='center'><G>(Next) <J><a href='event:next'><B>→</B></a></p>",name,400,355,nil,16,0x26353d,0x26353d,nil,true);
  263.         ui.addTextArea(12,"<p align='center'><R><a href='event:closex'><b>☓</b></a> <G>(Close)</p>",name,640,355,nil,16,0x26353d,0x26353d,nil,true);
  264.         ui.addTextArea(13,"<p align='center'><J>"..data[name].paginah.."<G>/<J>"..#getTrans(name).help.."<G></p> Pages",name,100,355,nil,16,0x26353d,0x26353d,nil,true);
  265.         data[name].help = true
  266.     elseif args[1]=="perfil" or args[1]=="p" and args[2]=="me" then
  267.         getPerfil(name,name)
  268.     elseif args[1]=="afk" then 
  269.         if not data[name].afk == true then
  270.         data[name].afk = true
  271.         message("You are afk, afk for desactive it.",name)
  272.         tfm.exec.killPlayer(name)
  273.         elseif data[name].afk == true then
  274.         data[name].afk = false
  275.           message("You aren't afk",name)
  276.         end
  277.     elseif args[1]=="insert" and args[2]=="map" and args[3] and mc or adm then
  278.         print("test")
  279.         table.insert(shaman, args[3])
  280.     end
  281. end
  282.  
  283. function eventPlayerDied(name)
  284. chamanes = chamanes - 1
  285. data[name].muertes = data[name].muertes +1
  286. alive()
  287. end
  288.  
  289. function eventPlayerLeft(name)
  290.   chamanes = chamanes - 1
  291. end
  292.  
  293. function eventPlayerWon(p)
  294.   levelup(p,math.random(80, 120))
  295. end
  296.  
  297. function eventTextAreaCallback(id, name, callback)
  298.     if callback=="close" then
  299.         removeTextArea(0,p,true)
  300.     elseif callback=="cperfil" then
  301.     removeTextArea(0,p,true)
  302.     elseif callback=="help" then
  303.         eventChatCommand(name, "help")
  304.     elseif callback=="closex" then
  305.                 data[name].paginah=1
  306.                 data[name].help = false
  307.                 for id=9,13 do
  308.                         ui.removeTextArea(id,name)
  309.                         ui.removeTextArea(6969+id,name)
  310.                         ui.removeTextArea(7979+id,name)
  311.                         end
  312.         elseif callback=="next" and data[name].paginah<#getTrans(name).help then   
  313.                 data[name].paginah=(data[name].paginah)+1
  314.                 ui.updateTextArea(9,getTrans(name).help[data[name].paginah],name)              
  315.                 ui.updateTextArea(13,"<p align='center'><J>"..data[name].paginah.."<G>/<J>"..#getTrans(name).help.."<G></p> Pages",name)
  316.         elseif callback=="previous" and data[name].paginah>1 then
  317.                 data[name].paginah=data[name].paginah-1
  318.                 ui.updateTextArea(9,getTrans(name).help[data[name].paginah],name)
  319.                 ui.updateTextArea(13,"<p align='center'><J>"..data[name].paginah.."<G>/<J>"..#getTrans(name).help.."<G></p> Pages",name)                       
  320.         elseif callback=="Comandos" then
  321.             data[name].paginah=2
  322.                 ui.updateTextArea(9,getTrans(name).help[data[name].paginah],name)              
  323.                 ui.updateTextArea(13,"<p align='center'><J>"..data[name].paginah.."<G>/<J>"..#getTrans(name).help.."<G></p> Pages",name)   
  324.         elseif callback=="Equipo" then
  325.             data[name].paginah=4
  326.                 ui.updateTextArea(9,getTrans(name).help[data[name].paginah],name)              
  327.                 ui.updateTextArea(13,"<p align='center'><J>"..data[name].paginah.."<G>/<J>"..#getTrans(name).help.."<G></p> Pages",name)   
  328.     end
  329. end
  330.  
  331. function eventSummoningEnd(name,Obje,xPosition,yPosition,angle,xSpeed,ySpeed,other)
  332.     if Obje==44 then
  333.         tfm.exec.killPlayer(name)  
  334.         message("Without totem",name)  
  335.     elseif Obje==24 then
  336.       data[name].spirits=data[name].spirits+1
  337.         if data[name].spirits>3 then
  338.           data[name].muertes = data[name].muertes +1
  339.           tfm.exec.killPlayer(name)                
  340.     else
  341.             message(string.format(getTrans(name).spirit_warning, data[name].spirits, 3),name)
  342.                         end
  343.                 end
  344.     for index,objs in pairs(obj) do
  345.         if objs == Obje then
  346.             tfm.exec.removeObject(other.id)
  347.             end
  348.         end    
  349.     end
  350.  
  351. function eventKeyboard(name,key,down,x,y)
  352.  if key==80 and data[name].perfil then
  353.   removeTextArea(0,p,true)
  354.  elseif key==80 and data[name].rank then
  355.  removeTextArea(0,p,true)
  356.   getPerfil(name,name)
  357.  elseif key==80 and data[name].rank and data[name].help then
  358.  removeTextArea(0,p,true)
  359.  
  360.   eventTextAreaCallback(id, name, "closex")
  361.     data[name].rank=false
  362.   elseif key==80 then
  363.     getPerfil(name,name)
  364.   elseif key == 76 and data[name].rank then
  365.  removeTextArea(0,p,true)
  366.   data[name].rank=false
  367.     elseif key == 76 and data[name].perfil then
  368.     removeTextArea(0,p,true)
  369.     leaderboard(name)
  370.   elseif key == 76 then
  371.     leaderboard(name)
  372.   elseif key == 72 and data[name].help then
  373.     eventTextAreaCallback(id, name, "closex")
  374.   elseif key == 72 and data[name].perfil then  
  375.     removeTextArea(0,p,true)
  376.     eventChatCommand(name,"help")
  377.   elseif key == 72 and data[name].rank then
  378.  removeTextArea(0,p,true)
  379.   eventChatCommand(name,"help")
  380.     data[name].rank=false
  381.   elseif key == 72 then
  382.         eventChatCommand(name,"help")
  383.     end
  384. end
  385.  
  386. -- Tools
  387.  
  388. function makeShamans(boolean)
  389. tfm.exec.disableAutoShaman(boolean)
  390. chamanes = 0
  391. if boolean == true then
  392.   for p in pairs(tfm.get.room.playerList) do
  393.   chamanes = chamanes + 1
  394.   tfm.exec.setShaman(p)
  395.   end
  396. end
  397. end
  398.  
  399. function chamanalive()
  400. for name,player in pairs(tfm.get.room.playerList) do
  401.   if player.isShaman and not player.isDead then
  402.    chaman=name
  403. end
  404. end
  405. return chaman
  406. end
  407.  
  408. function alive()
  409. if chamanes == 1 then
  410.   local chaman=chamanalive()
  411.   if tfm.get.room.playerList[chaman].isShaman and not tfm.get.room.playerList[chaman].isDead then
  412.   time = 10
  413.   tfm.exec.setGameTime(10)
  414.   tfm.exec.giveCheese(chaman)
  415.   tfm.exec.playerVictory(chaman)
  416.   data[chaman].wins = data[chaman].wins +1
  417.   for p in pairs(tfm.get.room.playerList) do
  418.     message(string.format(getTrans(p).winRound, chaman, data[chaman].stat[1]))
  419.   end
  420.   end
  421. end
  422.     if chamanes == 0 then
  423.     time = 5
  424. end
  425. end
  426.  
  427. function levelup(p,e)
  428. if tfm.get.room.playerList[p] and tonumber(e)~=nil then
  429.   e=tonumber(e)
  430.   data[p].stat[3]=e
  431. if data[p].stat[3]>=data[p].stat[2] and data[p].stat[1]<100 then
  432. repeat
  433.   data[p].stat[1]=data[p].stat[1]+1
  434.   data[p].stat[3]=data[p].stat[3]-data[p].stat[2]
  435.   data[p].stat[2]=150+54*data[p].stat[1]
  436. if data[p].stat[2]>data[p].stat[3] then
  437.   data[p].stat[2]=data[p].stat[2]-data[p].stat[3]
  438. end
  439.   until data[p].stat[3]<data[p].stat[2] or data[p].stat[1]==100
  440.   for player in pairs(tfm.get.room.playerList) do
  441.   message(string.format(getTrans(player).level_up, p, data[p].stat[1]), player)
  442.   unlockTitle(p)
  443.  end
  444.  else
  445.   data[p].stat[2]=data[p].stat[2]-data[p].stat[3]
  446.   data[p].stat[3]=0
  447.   message(string.format(getTrans(p).xp, e, data[p].stat[1]), p)
  448. end
  449. if data[p].stat[1]==100 then
  450.   data[p].stat[2]=0
  451.   end
  452. end  
  453. end
  454.  
  455. function leaderboard(name)
  456.         scores = {}
  457.         for name, player in pairs(data) do
  458.                 if data[name] then
  459.                         table.insert (scores, {name=name, score=data[name].wins, level=data[name].stat[1]})
  460.                 end
  461.         end
  462.         table.sort (scores,
  463.                 function (x,y)
  464.                         return x.score > y.score
  465.                 end
  466.         )
  467.             local message = "\n\n<font size='15'><BV>Nombre <g> - <j>Wins <g> - <CH>Nivel\n\n"
  468.         for i,score in ipairs(scores) do
  469.         message = message.."<font size='15'><G>"..i.. ") <BV>" .. score.name .. " <BL>-<j> " .. score.score .. " <BL>-<CH> "..score.level.."</font>\n"      
  470.         end            
  471.     addTextArea(0,message,p,160,60,540,260,0x324650,0x27373F,1,true,"<v><b>Ranking</b>")
  472. end    
  473.  
  474. function capitalize(word)
  475. if word then
  476. if word:find("+") then  
  477.     return string.upper(word:sub(1,2)) .. string.lower (word:sub(3));
  478. else
  479.  return string.upper(word:sub(1,1)) .. string.lower (word:sub(2)); 
  480. end
  481. end
  482. end
  483.  
  484. function getPerfil(profile,n)
  485.     if tfm.get.room.playerList[profile] then
  486.         local perfil=string.format(getTrans(profile).profiletext, data[profile].title, tfm.get.room.playerList[profile].tribeName or "<r>No tiene", data[profile].wins, data[profile].stat[1], data[profile].stat[2], data[profile].muertes, returntitles(profile))
  487.         data[n].perfil=true
  488.         addTextArea(0,perfil,pp,275,75,250,200,0x324650,0x27373F,1,true,string.format(getTrans(profile).profile, getColour(profile), profile))
  489.     end
  490. end
  491.        
  492. function desbtitle(p,n)
  493.     if tfm.get.room.playerList[p] and titles[n] then
  494.         if data[p].titles[n]==false then
  495.             data[p].titles[n]=true
  496.             data[p].title=titles[n]
  497.             message(string.format(getTrans(p).unlock_title, p, titles[n]), n)
  498.         end
  499.     end
  500. end
  501.  
  502. function changetitle(p,n)
  503.     if tfm.get.room.playerList[p] and titles[n] then
  504.         if data[p].titles[n] then
  505.             data[p].title=titles[n]
  506.             message(string.format(getTrans(p).change_title, titles[n]), n)
  507.         end
  508.     end
  509. end
  510.  
  511. function unlockTitle(p)
  512.  if tfm.get.room.playerList[p] then
  513.         if data[p].wins>=1 then desbtitle(p,4)end   if data[p].wins>=10 then desbtitle(p,5)end
  514.         if data[p].wins>=25 then desbtitle(p,6)end  if data[p].wins>=40 then desbtitle(p,7)end
  515.         if data[p].wins>=60 then desbtitle(p,8)end  if data[p].wins>=80 then desbtitle(p,9)end  if data[p].wins>=100 then desbtitle(p,10)end
  516.         if data[p].stat[1]>1 then desbtitle(p,11)end if data[p].stat[1]>=10 then desbtitle(p,12)end
  517.         if data[p].stat[1]>=20 then desbtitle(p,13)end  if data[p].stat[1]>=30 then desbtitle(p,14)end
  518.         if data[p].stat[1]>=40 then desbtitle(p,15)end  if data[p].stat[1]>=50 then desbtitle(p,16)end
  519.         if data[p].stat[1]>=60 then desbtitle(p,17)end  if data[p].stat[1]>=70 then desbtitle(p,18)end
  520.         if data[p].stat[1]>=80 then desbtitle(p,19)end  if data[p].stat[1]>=90 then desbtitle(p,20)end
  521.         if data[p].stat[1]>=100 then desbtitle(p,21)end
  522.     end
  523. end
  524.  
  525. function returntitles(p)
  526.   if tfm.get.room.playerList[p] then
  527.    local playertitles={}
  528.     for a=1,#titles do
  529.      if data[p].titles[a] then
  530.        table.insert(playertitles,"<g> "..tostring(a).." - «"..titles[a].."»")
  531.       end
  532.     end
  533.      return table.concat(playertitles,"\n",1)
  534.   end
  535. end
  536.  
  537. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement