map1='mapcode'
map2='mapcode'
map3='mapcode'
map4='mapcode'
map5='mapcode'
map6='mapcode'
players={}
--maps={map1,map2,map3,map4,map5,7704767}
maps={map6} --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
--uzun map
if tfm.get.room.xmlMapInfo.xml == map6 then
if players[name].win==1 then
if y>=20000 then
players[name].win=players[name].win+1
tfm.exec.movePlayer(name,150,20300)
players[name].x=150 players[name].y=20300
end
end
if players[name].win==2 then
print("hata nerde")
if y>=40000 then
players[name].win=players[name].win+1
tfm.exec.movePlayer(name,150,40300)
players[name].x=150 players[name].y=40300
end
end
if players[name].win==3 then
print("hata ananın amında")
if y>=60000 then
players[name].win=players[name].win+1
tfm.exec.movePlayer(name,150,60300)
players[name].x=150 players[name].y=60300
end
end
if players[name].win==4 then
if y>=80000 then
players[name].win=players[name].win+1
tfm.exec.movePlayer(name,150,80300)
players[name].x=150 players[name].y=80300
end
end
if players[name].win==5 then
if y>=100000 then
players[name].win=players[name].win+1
tfm.exec.movePlayer(name,150,100300)
players[name].x=150 players[name].y=100300
end
end
if players[name].win==6 then
if y>=120000 then
players[name].win=players[name].win+1
tfm.exec.movePlayer(name,150,120300)
players[name].x=150 players[name].y=120300
end
end
if players[name].win==7 then
if y>=140000 then
players[name].win=players[name].win+1
tfm.exec.movePlayer(name,150,140300)
players[name].x=150 players[name].y=140300
end
end
if players[name].win==8 then
if y>=160000 then
players[name].win=players[name].win+1
tfm.exec.movePlayer(name,150,160300)
players[name].x=150 players[name].y=160300
end
end
if players[name].win==9 then
if y>=180000 then
players[name].win=players[name].win+1
tfm.exec.movePlayer(name,150,180300)
players[name].x=150 players[name].y=180300
end
end
if players[name].win==10 then
if y>=200000 then
players[name].win=players[name].win+1
tfm.exec.movePlayer(name,150,200300)
players[name].x=150 players[name].y=200300
end
end
if players[name].win==11 then
if y>=220000 then
players[name].win=players[name].win+1
tfm.exec.movePlayer(name,150,220300)
players[name].x=150 players[name].y=220300
end
end
if players[name].win==12 then
if y>=22120 then
players[name].win=players[name].win+1
tfm.exec.giveCheese(name)
end
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