Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Lua by mete ( 13 years ago )
--Son güncelleme: (Kmlcan)

tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAutoTimeLeft(true)
tfm.exec.disableAutoShaman(true)
players={}
toDespawn={}
maps={"@4356778","@4350013","@159903","@414991","@343455","@4358963","@4359278","@3631619","50","101","@1390764","@4356593","@2017640","@544675","@212956","@4142720","@4142683","@1996354","@4358615","@4350624","@506950","@4358688","@4142719","@4358977"}
diff1={"50","101","@1390764","@4142683"}
diff2={"@4356778","@4350013","@159903","@414991","@343455","@3631619","@4358963","@4359278"}
diff3={"@4356593","@2017640","@544675","@212956","@4142720"}
diff4={"@1996354","@4358615","@4350624","@506950","@4358688","@4142719"}
diff5={"@4358977"}
ui.addTextArea(1,"<J>Son kazanan: <N>Yok",nil,10,30)

if playerName=="Kmlcan" or playerName=="Recorvert" then
    tfm.exec.setNameColor(playerName, 0xE9C764)
end

function eventNewPlayer(name)
    for i,key in ipairs({32,40,83}) do
     tfm.exec.bindKeyboard(name,key,true,true)
 end
 players[name]={
  timestamp=os.time(),
  offsets={x=-2, y=12}
 }
end

function eventKeyboard(name,key,down,x,y)
 if (key==32 or key==40 or key==83) and not tfm.get.room.playerList[name].isDead and started then
  if players[name].timestamp < os.time()-1000 then
   local id
   if tfm.get.room.playerList[name].isFacingRight then
    id=tfm.exec.addShamanObject(19,x+players[name].offsets.x,y+players[name].offsets.y)
   else
    id=tfm.exec.addShamanObject(20,x+players[name].offsets.x,y+players[name].offsets.y)
   end
   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=12
  end
 end
end

function eventNewGame()
 started=false
end

function eventLoop(time,remaining)
 if time >= 3000 and not started then
  started=true
 end
 if remaining<=1 then
  tfm.exec.newGame(maps[math.random(#maps)])
  for playerName,player in pairs(tfm.get.room.playerList) do
   tfm.exec.setNameColor(playerName, 0xFFFFFF)
   if playerName=="Kmlcan" or playerName=="Recorvert" then
    tfm.exec.setNameColor(playerName, 0xE9C764)
   end
  end
  ui.addTextArea(1,"<J>Son kazanan: <N>Yok",nil,10,30)
 end
 for i,cannon in ipairs(toDespawn) do
  if cannon[1] <= os.time()-1000 then
   tfm.exec.removeObject(cannon[2])
   table.remove(toDespawn,i)
  end
 end
end

function eventPlayerDied(playerName)
 tfm.exec.respawnPlayer(playerName)
end

for name,player in pairs(tfm.get.room.playerList) do
 eventNewPlayer(name)
end

function eventPlayerWon(playerName)
 ui.addPopup(99,2,"Sıradaki haritanın zorluğu kaç olsun? <font color='#e9c764'>(1-5 arası)</font>",playerName,300,200,200)
 tfm.exec.respawnPlayer(playerName)
 for playerName,player in pairs(tfm.get.room.playerList) do
  tfm.exec.setNameColor(playerName, 0xFFFFFF)
  if playerName=="Kmlcan" or playerName=="Recorvert" then
   tfm.exec.setNameColor(playerName, 0xE9C764)
  end
  tfm.exec.killPlayer(playerName)
 end
 tfm.exec.setNameColor(playerName, 0xE86363)
 ui.addTextArea(1,"<J>Son kazanan: <N>"..playerName,nil,10,30)
end

tfm.exec.newGame(maps[math.random(#maps)])
ui.addTextArea(1,"<J>Son kazanan: <N>Yok",nil,10,30)
tfm.exec.setUIShamanName("<VP> Zorluk: <J>Rastgele")
for playerName,player in pairs(tfm.get.room.playerList) do
 tfm.exec.setNameColor(playerName, 0xFFFFFF)
 if playerName=="Kmlcan" or playerName=="Recorvert" then
  tfm.exec.setNameColor(playerName, 0xE9C764)
 end
end

function eventPopupAnswer(id,playerName,answer)
 if id==99 then
  if answer=="1" then
   tfm.exec.newGame(diff1[math.random(#diff1)])
   tfm.exec.setUIShamanName("<VP> Zorluk: <J>1")
  elseif answer=="2" then
   tfm.exec.newGame(diff2[math.random(#diff2)])
   tfm.exec.setUIShamanName("<VP> Zorluk: <J>2")
  elseif answer=="3" then
   tfm.exec.newGame(diff3[math.random(#diff3)])
   tfm.exec.setUIShamanName("<VP> Zorluk: <J>3")
  elseif answer=="4" then
   tfm.exec.newGame(diff4[math.random(#diff4)])
   tfm.exec.setUIShamanName("<VP> Zorluk: <J>4")
  elseif answer=="5" then
   tfm.exec.newGame(diff5[math.random(#diff5)])
   tfm.exec.setUIShamanName("<VP> Zorluk: <J>5")
  elseif answer~="1" or answer~="2" or answer~="3" or answer~="4" or answer~="5" then
   tfm.exec.newGame(maps[math.random(#maps)])
   tfm.exec.setUIShamanName("<VP> Zorluk: <J>Rastgele")
  end
 end
end
 function main()
  command.addHandler("win", win)
  command.addHandler("help", help)
  command.addHandler("re", re)
  command.addHandler("respawn", respawn)
  command.addHandler("kill", kill)
  command.addHandler("peynir", peynir)
  command.addHandler("test", test)
  command.addHandler("skip", skip)
  command.addHandler("time", time)
  command.addHandler("diff", diff)
 end
 
 system.disableChatCommandDisplay("win",true)
 system.disableChatCommandDisplay("help",true)
 system.disableChatCommandDisplay("re",true)
 system.disableChatCommandDisplay("respawn",true)
 system.disableChatCommandDisplay("kill",true)
 system.disableChatCommandDisplay("peynir",true)
 system.disableChatCommandDisplay("test",true)
 system.disableChatCommandDisplay("skip",true)
 system.disableChatCommandDisplay("time",true)
 system.disableChatCommandDisplay("diff",true)
 
 function diff(player, code)
  if player=="Kmlcan" or player=="Recorvert" then
   if code=="1" then
    tfm.exec.newGame(diff1[math.random(#diff1)])
    tfm.exec.setUIShamanName("<VP> Zorluk: <J>1")
   elseif code=="2" then
    tfm.exec.newGame(diff2[math.random(#diff2)])
    tfm.exec.setUIShamanName("<VP> Zorluk: <J>2")
   elseif code=="3" then
    tfm.exec.newGame(diff3[math.random(#diff3)])
    tfm.exec.setUIShamanName("<VP> Zorluk: <J>3")
   elseif code=="4" then
    tfm.exec.newGame(diff1[math.random(#diff4)])
    tfm.exec.setUIShamanName("<VP> Zorluk: <J>4")
   elseif code=="5" then
    tfm.exec.newGame(diff5[math.random(#diff5)])
    tfm.exec.setUIShamanName("<VP> Zorluk: <J>5")
   end
  end
 end
 function time(player, code)
  if player=="Kmlcan" or player=="Recorvert" then
   tfm.exec.setGameTime(code)
  end
 end
 function skip(player)
  if player=="Kmlcan" or player=="Recorvert" then
   tfm.exec.newGame(maps[math.random(#maps)])
   tfm.exec.setUIShamanName("<VP> Zorluk: <J>Rastgele")
  end
 end
 function test(player, code)
  if player=="Kmlcan" or player=="Recorvert" then
   tfm.exec.newGame(code)
  end
 end
 function respawn(player, code)
  if player=="Kmlcan" or player=="Recorvert" then
   tfm.exec.respawnPlayer(code)
  end
 end
 function peynir(player, code)
  if player=="Kmlcan" or player=="Recorvert" then
   tfm.exec.giveCheese(code)
  end
 end
 function kill(player, code)
  if player=="Kmlcan" or player=="Recorvert" then
   tfm.exec.killPlayer(code)
  end
 end
 function re(player)
  tfm.exec.respawnPlayer(player)
 end
 function win(player,code)
  if player=="Kmlcan" or player=="Recorvert" then
   tfm.exec.giveCheese(code)
   tfm.exec.playerVictory(code)
  end
 end
 function help(player)
  ui.addPopup(2,0,"<font color='#BABD2F'>FFA Racing'e</font> hoş geldin, <font color='#2ECF73'>"..player.."</font>.<br><br>Bu oyundaki amacın rakiplerinden daha hızlı davranarak peyniri alıp deliğe girmek. Rakiplerinin sana yollayacağı güllelere dikkat et!",player,300,160,200)
 end
 
 function eventChatCommand(player, message)
   local args = string.split(message, "%s")
   local text = table.remove(args, 1)
   command.handle(string.lower(text), player, args)
 end
 command = {handlers = {}}
 function command.addHandler(text, handler)
  if command.handlers[text] == nil then
   command.handlers[text] = {}
  end
  table.insert(command.handlers[text], handler)
 end
  
 function command.removeHandler(text, handler)
  if command.handlers[text] ~= nil then
   local index
   for i, h in ipairs(command.handlers[text]) do
    if handler == h then
     index = i
    end
   end
   if index ~= nil then
    table.remove(command.handlers[text], index)
    if #command.handlers[text] == 0 then
     command.handlers[text] = nil
    end
   end
  end
 end
 function command.handle(text, player, args)
  if command.handlers[text] ~= nil then
   for i, handler in ipairs(command.handlers[text]) do
    handler(player, unpack(args))
   end
  end
 end
 function string.split(str, s)
  local res = {};
  for part in string.gmatch(str, "[^" .. s .. "]+") do
   table.insert(res, part)
  end
  return res;
 end
 function unpack (t, i)
  i = i or 1
  if t[i] ~= nil then
   return t[i], unpack(t, i + 1)
  end
 end
 main();

 

Revise this Paste

Your Name: Code Language: