Advertisement
smgxxx

heh

Dec 20th, 2014
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.71 KB | None | 0 0
  1. --[[
  2. Клавишы:
  3. E - поменять режим. по клику или по клавише вниз
  4. F - Изменить шаманский объект
  5. _ - (пробел) увеличить скорость мыши
  6. ]]--
  7. local objectId = 0 -- шаманский объект по умолчанию
  8. local offsetX = 0 -- появление относительно мыши по координате X
  9. local offsetY = 20 -- появление относительно мыши по координате Y
  10. local mode
  11. function eventKeyboard(playerName, keyCode, down, xPlayerPosition,  yPlayerPosition)
  12.     if keyCode == 83 or keyCode == 40 then
  13.         tfm.exec.addShamanObject(objectId, tfm.get.room.playerList[playerName].x + offsetX, tfm.get.room.playerList[playerName].y + offsetY, 0, 0, 0, false)
  14.     elseif keyCode == 69 then
  15.         -- смена режима
  16.         mode = changeMode(mode)
  17.     elseif keyCode == 70 then
  18.         -- сменить ид шаманского объекта
  19.         local width = 200
  20.         ui.addPopup(1, 2, "Введите ид шаманского объекта", playerName, tfm.get.room.playerList[playerName].x - math.ceil(width/2), 200, width, true)
  21.     elseif keyCode == 32 then
  22.         -- ускорение
  23.         if tfm.get.room.playerList[playerName].isFacingRight then
  24.             tfm.exec.movePlayer(playerName, 0, 0, true, 40, 0, true)
  25.         else
  26.             tfm.exec.movePlayer(playerName, 0, 0, true, -40, 0, true)
  27.         end
  28.     end
  29. end
  30. function eventMouse(playerName, xMousePosition, yMousePosition)
  31.     tfm.exec.addShamanObject(objectId, xMousePosition, yMousePosition, 0, 0, 0, false)
  32. end
  33. system.disableChatCommandDisplay("speed", true)
  34. function eventChatCommand(playerName, message)
  35.     if message == "speed" then
  36.         if tfm.get.room.playerList[playerName].isFacingRight then
  37.             tfm.exec.movePlayer(playerName, 0, 0, true, 40, 0, true)
  38.         else
  39.             tfm.exec.movePlayer(playerName, 0, 0, true, -40, 0, true)
  40.         end
  41.     end
  42. end
  43. function eventPopupAnswer(popupId, playerName, answer)
  44.     if popupId == 1 and answer ~= "" then
  45.         objectId = tonumber(answer, 10);
  46.     end
  47. end
  48.  
  49. function changeMode(m)
  50.     for k,v in pairs(tfm.get.room.playerList) do
  51.         if m == nil or m == "click" then
  52.             tfm.exec.bindKeyboard(k, 83, true, true)
  53.             tfm.exec.bindKeyboard(k, 40, true, true)
  54.             system.bindMouse(k, false)
  55.         elseif m == "key" then
  56.             tfm.exec.bindKeyboard(k, 83, true, false)
  57.             tfm.exec.bindKeyboard(k, 40, true, false)
  58.             system.bindMouse(k, true)
  59.         end
  60.     end
  61.     if m == nil or m == "click" then
  62.         m = "key"
  63.     elseif m == "key" then
  64.         m = "click"
  65.     end
  66.     return m
  67. end
  68. mode = changeMode()
  69. for k,v in pairs(tfm.get.room.playerList) do
  70.     tfm.exec.bindKeyboard(k, 69, true, true)
  71.     tfm.exec.bindKeyboard(k, 70, true, true)
  72.     tfm.exec.bindKeyboard(k, 32, true, true)
  73. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement