Safwanrockz

#Iced! - By Mousechris

Oct 31st, 2013
1,457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.76 KB | None | 0 0
  1. print("<N>Hello there! <font color='#89A7F5'>#Iced<N> is an unofficial minigame that can currently only be played in the tribe house. Please support <font color='#89A7F5'>#Iced!")
  2.  
  3. maps={4446416,4414828,4431469,4433446,4413886}
  4. players={}
  5.  
  6. function returnMouseCount()
  7.  count=0
  8.  for player in pairs(tfm.get.room.playerList) do
  9.   if(tfm.get.room.playerList[player].isDead==false) then
  10.    count=count+1
  11.   elseif(players[player].id) then
  12.    count=count+1
  13.   end
  14.  end
  15.  return count
  16. end
  17.  
  18. function eventLoop(time,remaining)
  19.  returnMouseCount()
  20.  if(remaining<=0 or count==0) then
  21.     newRound()
  22.   end
  23.     playerList=tfm.get.room.playerList
  24. end
  25.  
  26. function newRound()
  27.   tfm.exec.newGame(maps[math.random(#maps)])
  28. end
  29.  
  30. function eventNewGame()
  31.   tfm.exec.snow()
  32.   tfm.exec.setUIMapName("<N>Welcome to <font color='#89A7F5'>#Iced! <N>Press <font color='#89A7F5'>Z<N> to turn into an Ice Cube! <N>Press <font color='#89A7F5'>X<N> to turn into an Ice Plank! Have fun! \n")
  33. end
  34.  
  35. function eventNewPlayer(name)
  36.  ui.addTextArea(1,"<p align='center'><b><N>Hello there! <font color='#89A7F5'>#Iced!<N> is an unofficial minigame that can currently only be played in the tribe house. Please support <font color='#89A7F5'>#Iced!</b></p>", name, 5,25, 790, 25, 0x000000, 0x000000, 0)
  37.  tfm.exec.bindKeyboard(name,87,true,true)
  38.  tfm.exec.bindKeyboard(name,88,true,true)
  39.  players[name]={timestamp=os.time()}
  40. end
  41.  
  42. function eventKeyboard(name,key,down,x,y)
  43.  if players[name].timestamp < os.time()-800 then
  44.   if(key==87 and playerList[name].isDead==false) then
  45.    tfm.exec.killPlayer(name)
  46.    local id=tfm.exec.addShamanObject(54,x,y)
  47.    players[name]={id=id,x=x,y=y}
  48.   elseif(key==88 and playerList[name].isDead==false) then
  49.    tfm.exec.killPlayer(name)
  50.    local id=tfm.exec.addShamanObject(45,x,y)
  51.    players[name]={id=id,x=x,y=y}
  52.   else
  53.    if(players[name].x and players[name].y and players[name].id) then
  54.     local id=players[name].id
  55.     tfm.exec.respawnPlayer(name)
  56.     players[name].x=tfm.get.room.objectList[id].x
  57.     players[name].y=tfm.get.room.objectList[id].y
  58.     if(players[name].x==0) then tfm.exec.killPlayer(name)
  59.     else
  60.      tfm.exec.movePlayer(name,players[name].x,players[name].y)
  61.     end
  62.     tfm.exec.removeObject(id)
  63.     players[name].id=nil
  64.    end
  65.   end
  66.   players[name].timestamp=os.time()
  67.  end
  68. end
  69.  
  70.  
  71. function main()
  72.   tfm.exec.disableAutoNewGame(true)
  73.   tfm.exec.disableAutoTimeLeft(true)
  74.   tfm.exec.disableAutoShaman(true)
  75.   tfm.exec.newGame(maps[math.random(#maps)])
  76.   for name,player in pairs(tfm.get.room.playerList) do
  77.     eventNewPlayer(name)
  78.   end
  79. end
  80.  
  81. main()
  82.  
  83. function eventPlayerWon(name)
  84.  players[name].x=nil
  85.  players[name].y=nil
  86.  players[name].id=nil
  87. end
  88.  
  89. function eventPlayerGetCheese(name)
  90.  tfm.exec.playerVictory(name)
  91. end
Advertisement
Add Comment
Please, Sign In to add comment