map1=''
map2=''
map3=''
map4=''
map5=''
players={}
maps={map1,map2,map3,map4,map5,7704767}
--maps={map5,7704767} --test edilecek map (başındaki "--" işaretini kaldır)
function eventPlayerDied(name)
tfm.exec.respawnPlayer(name)
tfm.exec.movePlayer(name,players[name].x,players[name].y)
end
function eventNewPlayer(name)
players[name]={x=x, y=y, win=1}
end
for name,player in pairs(tfm.get.room.playerList) do
eventNewPlayer(name)
tfm.exec.bindKeyboard(name, 69, true, true)
end
function returnMouseCount()
count=0
for player in pairs(tfm.get.room.playerList) do
if(tfm.get.room.playerList[player].isDead==false) then
count=count+1
elseif(players[player].id) then
count=count+1
end
end
return count
end
function eventLoop(time,remaining)
returnMouseCount()
if(remaining<=0 or count==0) then
newRound()
end
playerList=tfm.get.room.playerList
end
function newRound()
tfm.exec.setGameTime(483)
tfm.exec.newGame(maps[math.random(#maps)])
end
function main()
tfm.exec.disableAfkDeath(true)
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAutoTimeLeft(true)
tfm.exec.disableAutoShaman(true)
tfm.exec.newGame(maps[math.random(#maps)])
tfm.exec.setGameTime(483)
for name,player in pairs(tfm.get.room.playerList) do
eventNewPlayer(name)
end
end
main()
function eventKeyboard(name, key, down, x, y)
if tfm.get.room.xmlMapInfo.mapCode == 7704767 then
if y>=700 then
if players[name].win==1 then
players[name].x=300 players[name].y=50
end
end
if y>=700 then
if players[name].win==2 then
players[name].x=570 players[name].y=50
end
end
if y>=700 then
if players[name].win==3 then
players[name].x=800 players[name].y=50
end
end
if y>=700 then
if players[name].win==4 then
players[name].x=1140 players[name].y=50
end
end
if y>=700 then
if players[name].win==5 then
players[name].x=1420 players[name].y=50
end
end
if y>=700 then
if players[name].win==6 then
tfm.exec.giveCheese(name)
end
end
tfm.exec.respawnPlayer(name)
if y>=700 then
players[name].win=players[name].win+1
tfm.exec.movePlayer(name,players[name].x,players[name].y)
end
end
--ornek kod CP
if tfm.get.room.xmlMapInfo.xml == map5 then
if y>=2750 then
if players[name].win==1 then
players[name].x=300 players[name].y=50
end
end
if y>=2750 then
if players[name].win==2 then
players[name].x=570 players[name].y=50
end
end
if y>=2750 then
if players[name].win==3 then
players[name].x=830 players[name].y=50
end
end
if y>=2750 then
if players[name].win==4 then
players[name].x=1140 players[name].y=50
end
end
if y>=2750 then
if players[name].win==5 then
players[name].x=1420 players[name].y=50
end
end
if y>=2750 then
if players[name].win==6 then
tfm.exec.giveCheese(name)
end
end
if y>=2750 then
players[name].win=players[name].win+1
tfm.exec.movePlayer(name,players[name].x,players[name].y)
end
end
end
function eventPlayerGetCheese(name)
tfm.exec.playerVictory(name)
end
function eventPlayerWon(name)
players[name].x=nil
players[name].y=nil
players[name].id=nil
players[name].win=1
end