Advertisement
suxonov

Untitled

Jan 14th, 2016
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.56 KB | None | 0 0
  1.  
  2. --DARKROOM--
  3.  
  4. tfm.exec.disableAutoScore(true)
  5. tfm.exec.disableAutoShaman(true)
  6. tfm.exec.disableAfkDeath(true)
  7. tfm.exec.disableAutoNewGame(true)
  8.  
  9. mapcr={"Aviener","Kaysha","Ilyasport"}
  10. admins={"Aviener"}
  11.  
  12. maplist={"@1257258", "@6459786", "@6465008", "@6464994", "@4043664"}
  13. maps=maplist[math.random(#maplist)]
  14.  
  15. imagelist={"PTQL30f.png", "x1zS39R.png", "9LcqZUY.png", "Dydh9Qo.png", "1CBFyuL.png"}
  16.  
  17.  
  18. function isarray(val,arr)
  19. local flag=true
  20. for i,v in pairs(arr) do
  21. if v==val then
  22. flag=false;
  23. break
  24. end
  25. end
  26. return flag
  27. end
  28.  
  29. function xmlToobj(xmlS)
  30. local obj={}
  31. local i=0
  32. local blacklist={"0","1","2","4","5","6","7","8","10","12","13","14","15","16","17","18","19","20","21","22","23","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","40","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69","70","71","72","73","74","75","76","77","78","79","80","81","82","83","84","85","86","87","88","89","90","91","92","93","94","95","96","97","98","99","100","101","102","103","104","105","106","107","108","109","110","111","112","113","114","115","116","117","118","119","120","121","122","123","124","125","126","127","128","129","130","131"}
  33. for w in string.gmatch(xmlS, "<P.-T.->") do
  34. local tmps=string.sub(w, string.find(w, 'X="[-]?%d+"'))
  35. xO=string.sub(tmps,string.find(tmps,"[-]?%d+"))
  36. tmps=string.sub(w, string.find(w, 'Y="[-]?%d+"'))
  37. yO=string.sub(tmps,string.find(tmps,"[-]?%d+"))
  38. idO=string.gsub(string.sub(w, string.find(w, 'T="%d+"')),"%D","")
  39. if( isarray(idO,blacklist)) then
  40. obj[i]={x=xO;y=yO;id=idO}
  41. i=i+1
  42. end
  43. end
  44.  
  45. table.insert(obj,{x=tonumber(xO);y=tonumber(yO);id=tonumber(idO)})
  46.  
  47. return obj
  48.  
  49. end
  50.  
  51.  
  52. function eventNewGame()
  53. if tfm.get.room.xmlMapInfo.xml then
  54. local myVar = xmlToobj(tfm.get.room.xmlMapInfo.xml);
  55. local tmpO=myVar[math.random(#myVar)]
  56. tfm.exec.addShamanObject (27, tmpO.x, tmpO.y-50, 0, 0, 0, ghost)
  57. tfm.exec.addShamanObject (26, 818, 363, 0, 0, 0, false)
  58. for player,name in pairs(tfm.get.room.playerList) do
  59. tfm.exec.addImage("imagelist[math.random(#imagelist)]", "%name", 0, 0)
  60. ui.removeTextArea (1, playerName)
  61. end
  62. end
  63. end
  64.  
  65. --ChatCommands
  66. function eventChatCommand(playername, cmd)
  67. if cmd == "help" then
  68. tfm.exec.chatMessage("<BV>Point of game</BV><N>: Find <BV> the hole</BV> (exit from room)\
  69. <N>Type <j>!cont</j> for contacts\
  70. <BV>Original idea</BV><N>: Defoster\
  71. <BV>Game made by</BV><N>: Aviener", playername)
  72.  
  73. else
  74.  
  75. if cmd== "cont" then
  76. tfm.exec.chatMessage("<BV>Admin<N>: Aviener\
  77. <BV>Map Crew<N>: "..table.concat(mapcr, ", "), playername)
  78.  
  79. end
  80. end
  81. end
  82.  
  83. --Game
  84. tfm.exec.newGame(maplist[math.random(#maplist)])
  85.  
  86. function eventNewPlayer(playerName)
  87. ui.addTextArea(1,"",playerName,0,0,800, 400,0x030303,0x030303,1,true)
  88. tfm.exec.chatMessage("<BV>"..playerName.."</BV><N>, hello! Welcome to <BV>#darkroom<BV>!<N> Try to find hole. Type <J>help<J> <N>(with exclamation mark) for more information!<CH>", playerNameame)
  89. end
  90.  
  91. function eventPlayerWon(playerName)
  92. ui.addTextArea(1,"",playerName,0,0,800, 400,0x030303,0x030303,1,true)
  93. for name,player in pairs(tfm.get.room.playerList) do
  94. tfm.exec.chatMessage("<CH>"..playerName.."</CH><N> won the <J>game!<G>", name)
  95. tfm.exec.newGame(maplist[math.random(#maplist)])
  96. end
  97. end
  98. end
  99. end
  100.  
  101. function eventLoop(t1,t2)
  102. if t2<=0 then
  103. maps=maplist[math.random(#maplist)]
  104. tfm.exec.newGame(maplist[math.random(#maplist)])
  105. end
  106. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement