Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Клавишы:
- E - поменять режим. по клику или по клавише вниз
- F - Изменить шаманский объект
- _ - (пробел) увеличить скорость мыши
- ]]--
- local objectId = 0 -- шаманский объект по умолчанию
- local offsetX = 0 -- появление относительно мыши по координате X
- local offsetY = 20 -- появление относительно мыши по координате Y
- local mode
- function eventKeyboard(playerName, keyCode, down, xPlayerPosition, yPlayerPosition)
- if keyCode == 83 or keyCode == 40 then
- tfm.exec.addShamanObject(objectId, tfm.get.room.playerList[playerName].x + offsetX, tfm.get.room.playerList[playerName].y + offsetY, 0, 0, 0, false)
- elseif keyCode == 69 then
- -- смена режима
- mode = changeMode(mode)
- elseif keyCode == 70 then
- -- сменить ид шаманского объекта
- local width = 200
- ui.addPopup(1, 2, "Введите ид шаманского объекта", playerName, tfm.get.room.playerList[playerName].x - math.ceil(width/2), 200, width, true)
- elseif keyCode == 32 then
- -- ускорение
- if tfm.get.room.playerList[playerName].isFacingRight then
- tfm.exec.movePlayer(playerName, 0, 0, true, 40, 0, true)
- else
- tfm.exec.movePlayer(playerName, 0, 0, true, -40, 0, true)
- end
- end
- end
- function eventMouse(playerName, xMousePosition, yMousePosition)
- tfm.exec.addShamanObject(objectId, xMousePosition, yMousePosition, 0, 0, 0, false)
- end
- system.disableChatCommandDisplay("speed", true)
- function eventChatCommand(playerName, message)
- if message == "speed" then
- if tfm.get.room.playerList[playerName].isFacingRight then
- tfm.exec.movePlayer(playerName, 0, 0, true, 40, 0, true)
- else
- tfm.exec.movePlayer(playerName, 0, 0, true, -40, 0, true)
- end
- end
- end
- function eventPopupAnswer(popupId, playerName, answer)
- if popupId == 1 and answer ~= "" then
- objectId = tonumber(answer, 10);
- end
- end
- function changeMode(m)
- for k,v in pairs(tfm.get.room.playerList) do
- if m == nil or m == "click" then
- tfm.exec.bindKeyboard(k, 83, true, true)
- tfm.exec.bindKeyboard(k, 40, true, true)
- system.bindMouse(k, false)
- elseif m == "key" then
- tfm.exec.bindKeyboard(k, 83, true, false)
- tfm.exec.bindKeyboard(k, 40, true, false)
- system.bindMouse(k, true)
- end
- end
- if m == nil or m == "click" then
- m = "key"
- elseif m == "key" then
- m = "click"
- end
- return m
- end
- mode = changeMode()
- for k,v in pairs(tfm.get.room.playerList) do
- tfm.exec.bindKeyboard(k, 69, true, true)
- tfm.exec.bindKeyboard(k, 70, true, true)
- tfm.exec.bindKeyboard(k, 32, true, true)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement