Advertisement
Bolodefchoco_LUAXML

[Script] Map loader

Feb 8th, 2018
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.90 KB | None | 0 0
  1. --Creator: Bolodefchoco
  2. --Made in: 08/02/2018
  3. --Last update: 08/02/2018
  4. --[[ Notes:
  5.     Does:
  6.         Carrega mapas de uma lista
  7.     Keys:
  8.         Z --> Próximo mapa
  9.         X --> Mapa anterior
  10.         C --> Recarregar mapa
  11.         Shift + Click --> Teleport
  12.     Commands:
  13.         !s Nickname --> Atribui Shaman
  14. ]]--
  15.  
  16. local admin = "Bolodefchoco" -- Change "Bolodefchoco", put your nickname instead
  17.  
  18. local mapCodes = [[
  19.     -- Maps go here
  20. ]]
  21.  
  22. local maps = {}
  23. for code in mapCodes:gmatch("@(%d+)") do
  24.     maps[#maps + 1] = tonumber(code) or 0
  25. end
  26.  
  27. for k, v in next, {string.byte("ZXC\16", 1, 4)} do
  28.     system.bindKeyboard(admin, v, true, true)
  29. end
  30. system.bindKeyboard(admin, 16, false, true)
  31. system.bindMouse(admin, true)
  32.  
  33. local currentRound = 1
  34. local round = function(x)
  35.     return x > #maps and #maps or x < 1 and 1 or x
  36. end
  37.  
  38. local canChange = true
  39. eventNewGame = function()
  40.     canChange = true
  41. end
  42.  
  43. local holdShift = false
  44. eventKeyboard = function(n, k, d)
  45.     if k == 16 then -- shift
  46.         holdShift = d
  47.     else
  48.         if canChange then
  49.             local oldRound = currentRound
  50.             if k == string.byte("Z") then
  51.                 currentRound = round(currentRound + 1)
  52.             elseif k == string.byte("X") then
  53.                 currentRound = round(currentRound - 1)
  54.             end
  55.             if k == string.byte("C") or oldRound ~= currentRound then
  56.                 canChange = false
  57.             end
  58.         end
  59.     end
  60. end
  61.  
  62. eventLoop = function()
  63.     if not canChange then
  64.         tfm.exec.newGame(maps[currentRound])
  65.     end
  66. end
  67.  
  68. eventMouse = function(n, x, y)
  69.     if holdShift then
  70.         tfm.exec.movePlayer(n, x, y)
  71.     end
  72. end
  73.  
  74. eventChatCommand = function(n, c)
  75.     if n == admin and c:sub(1,1) == "s" then
  76.         local name = c:sub(3)
  77.         if tfm.get.room.playerList[name] then
  78.             tfm.exec.setShaman(name)
  79.         end
  80.     end
  81. end
  82.  
  83. eventPlayerDied = tfm.exec.respawnPlayer
  84. eventPlayerWon = tfm.exec.respawnPlayer
  85.  
  86. tfm.exec.disableAutoNewGame()
  87. tfm.exec.disableAutoShaman()
  88. tfm.exec.disableAfkDeath()
  89.  
  90. tfm.exec.newGame(maps[currentRound])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement