Advertisement
Bolodefchoco_LUAXML

[Function] updateRoomBar

Dec 29th, 2016
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.03 KB | None | 0 0
  1. --Creator: Bolodefchoco
  2. --Made in: 29/12/2016
  3. --Last update: 02/01/2017
  4.  
  5.  
  6. local players = 0
  7. updateRoomBar = function(set,...)
  8.  
  9.     local attribs,args = {},{...}
  10.     local author,map,time,shaman = "Tigrounette","@0",120,{}
  11.  
  12.     if not set.disableCreator then
  13.         author = tfm.get.room.xmlMapInfo and tfm.get.room.xmlMapInfo.author or author
  14.         attribs[#attribs+1] = string.format("<J>%s",author)
  15.     end
  16.  
  17.     if not set.disableCode then
  18.         map = tfm.get.room.xmlMapInfo and tfm.get.room.currentMap or map
  19.         if not set.disableCreator then
  20.             attribs[#attribs] = string.format("<J>%s <BL>- %s",author,map)
  21.         else
  22.             attribs[#attribs+1] = string.format("<BL>%s",map)
  23.         end
  24.     end
  25.  
  26.     if not set.disableTime then
  27.         time = timeLeft or time
  28.         local min,sec = math.floor((time/60)%60),math.floor(time%60)
  29.         min,sec = (min < 10 and "0"..min or min),(sec < 10 and "0"..sec or sec)
  30.         attribs[#attribs+1] = string.format("<N>New map in : <V>%s:%s",min,sec)
  31.     end
  32.  
  33.     if not set.disableMice then
  34.         attribs[#attribs+1] = string.format("<N>Noobs : <V>%d",players)
  35.     end
  36.  
  37.     if not set.disableShaman then
  38.         for k,v in next,tfm.get.room.playerList do
  39.             if v.isShaman then
  40.                 table.insert(shaman,k)
  41.             end
  42.         end
  43.         if #shaman > 0 then
  44.             attribs[#attribs+1] = string.format("<N>Shaman : <CH>%s",table.concat(shaman," - <PS>"))
  45.         end
  46.     end
  47.  
  48.     if #args > 0 then
  49.         for k,v in next,args do
  50.             table.insert(attribs,"<N>"..v)
  51.         end
  52.     end
  53.  
  54.     local str = string.format(table.concat(attribs,"   <G>|<N>   "))
  55.     ui.setMapName(str.."<")
  56. end
  57.  
  58. eventPlayerLeft = function(n)
  59.     players = players - 1
  60. end
  61.  
  62. eventNewPlayer = function(n)
  63.     players = players + 1
  64. end
  65. table.foreach(tfm.get.room.playerList,eventNewPlayer)
  66.  
  67. eventLoop = function(currentTime,timeLeft)
  68.     if currentTime >= 1000 then
  69.         _G.timeLeft = (timeLeft/1000)
  70.         if _G.timeLeft < 0 then
  71.             _G.timeLeft = 0
  72.         end
  73.     end
  74.     updateRoomBar({
  75.         disableCreator = false,
  76.         disableCode = false,
  77.         disableTime = false,
  78.         disableMice = false,
  79.         disableShaman = false
  80.     },"Made by <PT>Bolodefchoco")
  81. end
  82. tfm.exec.newGame()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement