Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoShaman(true)
- players={}
- toDespawn={}
- function eventNewPlayer(name)
- for i,key in ipairs({48,49,50,51,52,53,54,55,56,57}) do
- tfm.exec.bindKeyboard(name,key,true,true)
- end
- players[name]={
- timestamp=os.time(),
- offsets={x=2, y=10}
- }
- end
- function eventKeyboard(name,key,down,x,y)
- if (key == 48) and not tfm.get.room.playerList[name].isDead and started then
- if players[name].timestamp < os.time()-500 then
- local id=tfm.exec.addShamanObject(103, x+(tfm.get.room.playerList[name].isFacingRight and players[name].offsets.x or -players[name].offsets.x), y+players[name].offsets.y, 0, tfm.get.room.playerList[name].isFacingRight and 20 or -20)
- players[name].timestamp=os.time()
- table.insert(toDespawn,{os.time(),id})
- end
- end
- if (key == 49) and not tfm.get.room.playerList[name].isDead and started then
- if players[name].timestamp < os.time()-500 then
- local id=tfm.exec.addShamanObject(403, x+(tfm.get.room.playerList[name].isFacingRight and players[name].offsets.x or -players[name].offsets.x), y+players[name].offsets.y, 0, tfm.get.room.playerList[name].isFacingRight and 20 or -20)
- players[name].timestamp=os.time()
- table.insert(toDespawn,{os.time(),id})
- end
- end
- if (key == 50) and not tfm.get.room.playerList[name].isDead and started then
- if players[name].timestamp < os.time()-500 then
- local id=tfm.exec.addShamanObject(206, x+(tfm.get.room.playerList[name].isFacingRight and players[name].offsets.x or -players[name].offsets.x), y+players[name].offsets.y, 0, tfm.get.room.playerList[name].isFacingRight and 20 or -20)
- players[name].timestamp=os.time()
- table.insert(toDespawn,{os.time(),id})
- end
- end
- if (key == 51) and not tfm.get.room.playerList[name].isDead and started then
- if players[name].timestamp < os.time()-500 then
- local id=tfm.exec.addShamanObject(1003, x+(tfm.get.room.playerList[name].isFacingRight and players[name].offsets.x or -players[name].offsets.x), y+players[name].offsets.y, 0, tfm.get.room.playerList[name].isFacingRight and 20 or -20)
- players[name].timestamp=os.time()
- table.insert(toDespawn,{os.time(),id})
- end
- end
- if (key == 52) and not tfm.get.room.playerList[name].isDead and started then
- if players[name].timestamp < os.time()-500 then
- local id=tfm.exec.addShamanObject(6, x+(tfm.get.room.playerList[name].isFacingRight and players[name].offsets.x or -players[name].offsets.x), y+players[name].offsets.y, 0, tfm.get.room.playerList[name].isFacingRight and 20 or -20)
- players[name].timestamp=os.time()
- table.insert(toDespawn,{os.time(),id})
- end
- end
- if (key == 53) and not tfm.get.room.playerList[name].isDead and started then
- if players[name].timestamp < os.time()-500 then
- local id=tfm.exec.addShamanObject(2810, x+(tfm.get.room.playerList[name].isFacingRight and players[name].offsets.x or -players[name].offsets.x), y+players[name].offsets.y, 0, tfm.get.room.playerList[name].isFacingRight and 20 or -20)
- players[name].timestamp=os.time()
- table.insert(toDespawn,{os.time(),id})
- end
- end
- if (key == 54) and not tfm.get.room.playerList[name].isDead and started then
- if players[name].timestamp < os.time()-500 then
- local id=tfm.exec.addShamanObject(57, x+(tfm.get.room.playerList[name].isFacingRight and players[name].offsets.x or -players[name].offsets.x), y+players[name].offsets.y, 0, tfm.get.room.playerList[name].isFacingRight and 100 or -100)
- players[name].timestamp=os.time()
- table.insert(toDespawn,{os.time(),id})
- end
- end
- if (key == 55) and not tfm.get.room.playerList[name].isDead and started then
- if players[name].timestamp < os.time()-500 then
- local id=tfm.exec.addShamanObject(59, x+(tfm.get.room.playerList[name].isFacingRight and players[name].offsets.x or -players[name].offsets.x), y+players[name].offsets.y, 0, tfm.get.room.playerList[name].isFacingRight and 20 or -20)
- players[name].timestamp=os.time()
- table.insert(toDespawn,{os.time(),id})
- end
- end
- if (key == 56) and not tfm.get.room.playerList[name].isDead and started then
- if players[name].timestamp < os.time()-500 then
- local id=tfm.exec.addShamanObject(39, x+(tfm.get.room.playerList[name].isFacingRight and players[name].offsets.x or -players[name].offsets.x), y+players[name].offsets.y, 0, tfm.get.room.playerList[name].isFacingRight and 20 or -20)
- players[name].timestamp=os.time()
- table.insert(toDespawn,{os.time(),id})
- end
- end
- if (key == 57) and not tfm.get.room.playerList[name].isDead and started then
- if players[name].timestamp < os.time()-500 then
- local id=tfm.exec.addShamanObject(46, x+(tfm.get.room.playerList[name].isFacingRight and players[name].offsets.x or -players[name].offsets.x), y+players[name].offsets.y, 0, tfm.get.room.playerList[name].isFacingRight and 20 or -20)
- players[name].timestamp=os.time()
- table.insert(toDespawn,{os.time(),id})
- end
- end
- end
- function eventChatCommand(name,command)
- local arg={}
- for argument in command:gmatch("[^%s]+") do
- table.insert(arg,argument)
- end
- if arg[1]=="off" then
- if tonumber(arg[2]) and tonumber(arg[3]) then
- players[name].offsets.x=tonumber(arg[2])
- players[name].offsets.y=tonumber(arg[3])
- else
- players[name].offsets.x=2
- players[name].offsets.y=10
- end
- tfm.exec.chatMessage("Offsets changed to X:"..players[name].offsets.x.." Y:"..players[name].offsets.y,name)
- end
- end
- function eventNewGame()
- started=false
- end
- function eventLoop(time,remaining)
- if time >= 1000 and not started then
- started=true
- end
- for i,cannon in ipairs(toDespawn) do
- if cannon[1] <= os.time()-3000 then
- tfm.exec.removeObject(cannon[2])
- table.remove(toDespawn,i)
- end
- end
- end
- for name,player in pairs(tfm.get.room.playerList) do
- eventNewPlayer(name)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement