Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PLAYERS, LEFT_KEYS, RIGHT_KEYS = { }, { 68, 69 }, { 81, 37 }
- function changeSpeedChanger()
- for key, value in pairs(tfm.get.room.playerList) do
- PLAYERS[#PLAYERS + 1] = key
- end
- SPEED_CHANGER = PLAYERS[math.random(1, table.getn(PLAYERS))]
- tfm.exec.setUIShamanName(SPEED_CHANGER)
- end
- function eventChatCommand(playerName, command)
- local args = { }
- for split in string.gmatch(command, "[^%s]+") do
- table.insert(args, split)
- end
- if args[1] == "speed" and args[2] and args[3] then
- if playerName ~= SPEED_CHANGER and (tonumber(args[2]) <= 50 and tonumber(args[2]) >= -50) and (tonumber(args[3]) <= 50 and tonumber(args[3]) >= -50) then
- PLAYERS[playerName].LEFT_SPEED, PLAYERS[playerName].RIGHT_SPEED = args[2], args[3]
- else
- if tfm.get.room.playerList[args[2]] and playerName == SPEED_CHANGER then
- PLAYERS[args[2]].LEFT_SPEED, PLAYERS[playerName].RIGHT_SPEED = args[3], args[4]
- end
- end
- end
- end
- function eventKeyboard(playerName, keyId)
- if keyId == 68 or keyId == 69 then tfm.exec.movePlayer(playerName, 0, 0, true, PLAYERS[playerName].LEFT_SPEED, 0, false)
- elseif keyId == 81 or keyId == 37 then tfm.exec.movePlayer(playerName, 0, 0, true, PLAYERS[playerName].RIGHT_SPEED, 0, false)
- end
- end
- function eventNewPlayer(playerName)
- PLAYERS[playerName] = { LEFT_SPEED = 30, RIGHT_SPEED = -30 }
- for i = 1, 100 do tfm.exec.bindKeyboard(playerName, i, false, true) end
- end
- function eventNewGame() changeSpeedChanger() end
- for key, value in pairs(tfm.get.room.playerList) do eventNewPlayer(key) end
- changeSpeedChanger()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement