Hachem16

Main framework

Dec 15th, 2013
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.69 KB | None | 0 0
  1. -- Main FrameWork :
  2.  
  3. ui.addTextArea(0, "thing", nil, nil, nil, nil, nil, nil, nil, 0.5, true)
  4. string = {}
  5. Particle = {3, 30}
  6.  
  7.  
  8. numbers=10
  9. emote={}
  10.  
  11. function eventNewPlayer(name)
  12.         tfm.exec.bindKeyboard(name,32,true,true)
  13. end
  14.  
  15. for name,player in pairs(tfm.get.room.playerList) do
  16.         eventNewPlayer(name)
  17. end
  18.  
  19.  
  20. function eventKeyboard(playerName,key,down,x,y)
  21.         if key==32 then
  22.                 if tfm.get.room.playerList[playerName].isFacingRight then
  23.                         for i=1,4 do
  24.                             if emote[playerName] then
  25.                                 tfm.exec.displayParticle(emote[playerName], x, y+(i*10), 5, 0.05, 0.05, 0, nil)
  26.                             else
  27.                                 tfm.exec.displayParticle(5, x, y+(i*10), 5, 0.05, 0.05, 0, nil)
  28.                             end
  29.  
  30.                         end
  31.                 else
  32.                         for i=1,4 do
  33.                                 if emote[playerName] then
  34.                                     tfm.exec.displayParticle(emote[playerName], x, y+(i*10), -5, 0.05, -0.05, 0, nil)
  35.                                 else
  36.                                      tfm.exec.displayParticle(5, x, y+(i*10), -5, 0.05, -0.05, 0, nil)
  37.                                 end
  38.  
  39.                         end
  40.         end
  41. end
  42. end
  43.  
  44.  
  45.  
  46. function eventChatCommand(playerName, cmd)
  47.                 if cmd:sub(0,4) == "kill" then
  48.                         tfm.exec.killPlayer(cmd:sub(6))
  49.                 elseif cmd:sub(0,4) == "part" then
  50.                       emote[playerName]=cmd:sub(6)
  51.                     elseif cmd:sub(0,1)=="p" then
  52.                         table.insert(string, "<font color='#0880fe' size='16'><b>"..playerName.."</b></font> : <font size='16'>"..cmd:sub(3).."</font>")
  53.                     elseif cmd=="reset" then -- command reset don't work properly :c
  54.                             for i=0,#string do
  55.                                     table.remove(string, i)
  56.                         end
  57.                      table.insert(string, "<font size='18' color='#008000f'>Updated for the longest</font>")
  58.                     elseif cmd=="input" then
  59.                      ui.addPopup(0, 2, "<font color='#00800f' size='15.4'>Input</font>", playerName, 400, 50)      
  60.             end
  61. end
  62.  
  63.  
  64. function eventLoop()
  65. for i=1,numbers do
  66.                 tfm.exec.displayParticle(math.random(3, 4), math.random(50,100), math.random(20, 250), 1, 0, 0, 0, nil)
  67. end
  68. ui.updateTextArea(0, table.concat(string, "\n"))
  69. end
  70.  
  71. function eventPopupAnswer(iD, playerName, ans)
  72. if iD==0 then
  73.         table.insert(string, "<font color='#0880fe' size='16'><b>"..playerName.."</b></font> : <font size='16'>"..ans.."</font>")
  74. end
  75. end
  76.  
  77. for i,command in ipairs({"part","p","kill","input","reset"}) do
  78.     system.disableChatCommandDisplay(command,true)
  79. end
Advertisement
Add Comment
Please, Sign In to add comment