Advertisement
Guest User

TFM Vending Machine

a guest
Aug 5th, 2014
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.89 KB | None | 0 0
  1. ----------------------------
  2. ----------------------------
  3. ----------------------------
  4. ADMINS = {} -- Add names with quotes separated with commas, example:  ADMINS = {'Firestonnne', 'Firestone'} -- If admin list is blank, all users have privileges
  5. MAP_CODE = '@5313698'
  6. SPAWN_LOCATION = {x=425, y=325}
  7. BUTTON_LOCATIONS = {
  8.     [tfm.enum.shamanObject.anvil]       = {x1=300, y1=075, x2=350, y2=125},
  9.     [tfm.enum.shamanObject.ball]        = {x1=375, y1=075, x2=425, y2=125},
  10.     [tfm.enum.shamanObject.balloon]     = {x1=450, y1=075, x2=500, y2=125},
  11.     [tfm.enum.shamanObject.littleBox]   = {x1=300, y1=150, x2=350, y2=200},
  12.     [tfm.enum.shamanObject.box]         = {x1=000, y1=000, x2=000, y2=000},
  13.     [tfm.enum.shamanObject.littleBoard] = {x1=375, y1=150, x2=500, y2=200},
  14.     [tfm.enum.shamanObject.board]       = {x1=300, y1=225, x2=500, y2=275}
  15. }
  16. ----------------------------
  17. ----------------------------
  18. ----------------------------
  19. tfm.exec.disableAfkDeath(true)
  20. tfm.exec.disableAutoNewGame(true)
  21. tfm.exec.disableAutoShaman(true)
  22. system.disableChatCommandDisplay('reset', true)
  23.  
  24. function reset()
  25.     tfm.exec.newGame(MAP_CODE)
  26.    
  27.     for name,player in pairs(tfm.get.room.playerList) do
  28.         system.bindMouse(name, true)
  29.     end
  30. end
  31.  
  32. function eventMouse(name, x, y)
  33.     if table.getn(ADMINS) ~= 0 then
  34.         if not is_admin(name) then
  35.             return
  36.         end
  37.     end
  38.     for id_type, loc in pairs (BUTTON_LOCATIONS) do
  39.         if (x > loc.x1 and x < loc.x2) and (y > loc.y1 and y < loc.y2) then
  40.             tfm.exec.addShamanObject(id_type, SPAWN_LOCATION.x, SPAWN_LOCATION.y, 0, 0, 0, false)
  41.             return
  42.         end
  43.     end
  44. end
  45.  
  46. function is_admin(name)
  47.     for num,admin_name in pairs(ADMINS) do
  48.         if name == admin_name then
  49.             return true
  50.         end
  51.     end
  52.     return false
  53. end
  54.  
  55. function eventChatCommand(name, cmd)
  56.     if table.getn(ADMINS) ~= 0 then
  57.         if not is_admin(name) then
  58.             return
  59.         end
  60.     end
  61.     if cmd == 'reset' then
  62.         reset()
  63.     end
  64. end
  65.  
  66. reset()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement