Advertisement
Szel

UTHS_pl

Oct 10th, 2013
1,538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 60.53 KB | None | 0 0
  1. ------------------
  2. -- UTHS by Szel --
  3. -- version 1.3  --
  4. ------------------
  5. --[[
  6. Changelog:
  7. • Dodano minigry: survivor, vampire survivor, bootcamp
  8. • Dodano komendy: !settime, !snow
  9. • Dodano wersje angielską
  10. ]]--
  11.  
  12. ---- CHANGE IT/ ZMIEŃ TO:
  13. superAdmin = {'nick1'}
  14. admins = {'nick1', 'nick2'}
  15. language = 'pl' -- 'en' or 'pl'
  16.  
  17. -- cd. nie ruszać
  18. version = '1.3'
  19. lang = {}
  20. lang.en = {
  21.     help = [[<p align="center"><font size="19px">Ultimate Tribe House Script</font> v. ]]..version..[[</p><p align="right"><font size="10px" color="#ffffff">created by Szel</font></p>Commands:
  22.     !cmd - shows commands
  23.     !set - shows settings
  24.     !help - shows help
  25. Hotkeys:
  26.     h - shows help
  27.     Esc - closes window
  28.     i - shows commands
  29.     o - shows settings
  30.     m - shows minigames
  31. ]],
  32.     disabled = 'disabled',
  33.     enabled = 'enabled',
  34.     disable = 'disable',
  35.     enable = 'enable',
  36.     refresh = 'refresh',
  37.     close = 'close',
  38.     minigames = 'Minigames',
  39.     minigame = 'Minigame',
  40.     module_stop = '!module stop - to turn off minigame',
  41.  
  42.     maps_queue = 'Maps queue',
  43.     queuing = 'Queuing',
  44.     played = 'played',
  45.     maps2 = 'maps',
  46.     delete = 'delete',
  47.     admins = 'Admins',
  48.     reset_settings = 'reset settings',
  49.     settings = 'Settings',
  50.     commands = 'Commands',
  51.     for_admins = 'for admins',
  52.     banned = 'You are banned',
  53.    
  54.     module_des = 'shows list of minigames',
  55.     made_des = 'new commend',
  56.     kill_des = 'kills',
  57.     ice_des = 'freezes',
  58.     sham_des = 'gives shaman',
  59.     ch_des = 'gives cheese',
  60.     tp_des = 'teleport',
  61.     utp_des = 'diesables teleport, [unglue player]',
  62.     tpp_des = 'teleport with glue',
  63.     ro_des = 'removes all objects',
  64.     meep_des = 'gives meep',
  65.     ban_des = 'disables commands for <name>',
  66.     unban_des = 'enables commands for <name>',
  67.     admin_des = 'gives admin rank',
  68.     unadmin_des = 'withdraws admin rank',
  69.     score_des = 'sets <player> score',
  70.     mapname_des = 'changes map name',
  71.     shamname_des = 'changes shaman name',
  72.     respawn_des = 'respawns',
  73.     autorespawn_des = 'on/off autorespawn',
  74.     color_des = 'sets nickname color',
  75.     queue_des = 'on/off maps queuing',
  76.     maps_des = 'shows maps queue',
  77.     np_des = 'plays map',
  78.     npp_des = 'adds map to queue',
  79.     mort_des = 'kill yourself',
  80.     off_des = 'disables command',
  81.     on_des = 'enables command',
  82.     cmd_des = 'shows commands list',
  83.     pet_des = 'converts <name> into pet',
  84.     unpet = 'withdraws !pet',
  85.     set_des = 'shows settings lists',
  86.     xml_des = 'plays map from xml code',
  87.     house_des = 'sets tribe house',
  88.     help_des = 'shows help',
  89.     vampire_des = 'turns into vampire',
  90.     log_des = 'shows !commands log',
  91.     queue_set = 'maps queuing',
  92.     autorespawn_set = 'auto respwan',
  93.     autoTimeLeft_set = 'automatic time change',
  94.     afk_set = 'AFK death',
  95.     autoNewGame_set = 'auto map change',
  96.     autoScore_set = 'auto score',
  97.     autoShaman_set = 'automatic selection of Shaman',
  98.     shamanSkills_set = 'shaman skills',
  99.     settime_des = 'sets game time',
  100.     snow_des = 'toggles snow',
  101.     _des = '',
  102.     _des = '',
  103.     _des = '',
  104.  
  105. }
  106. lang.pl = {
  107.     help = [[<p align="center"><font size="19px">Ultimate Tribe House Script</font> v. ]]..version..[[</p><p align="right"><font size="10px" color="#ffffff">created by Szel</font></p>Komendy:
  108.     !cmd - wszystkie komendy
  109.     !set - ustawienia
  110.     !help - pomoc
  111. Skróty klawiszowe:
  112.     h - help
  113.     Esc - zamyka okna
  114.     i - komendy
  115.     o - opcje
  116.     m - minigry
  117. ]],
  118.     disabled = 'wyłączone',
  119.     enabled = 'włączone',
  120.     disable = 'wyłącz',
  121.     enable = 'włącz  ',
  122.     refresh = 'odśwież',
  123.     close = 'zamknij',
  124.     minigame = 'Minigra',
  125.     minigames = 'Minigry',
  126.     module_stop = '!module stop - żeby wyłączyć minigre',
  127.  
  128.     maps_queue = 'Kolejka map',
  129.     queuing = 'Kolejkowanie',
  130.     played = 'Zagrano',
  131.     maps2 = 'map',
  132.     delete = 'usuń',
  133.     admins = 'Admini',
  134.     reset_settings = 'resetuj ustawienia',
  135.     settings = 'Ustawienia',
  136.     commands = 'Komendy',
  137.     for_admins = 'dla adminów',
  138.     banned = 'Masz bana',
  139.     a = '',
  140.     a = '',
  141.    
  142.     module_des = 'włącza minigrę',
  143.     made_des = 'nowa komenda',
  144.     kill_des = 'zabija',
  145.     ice_des = 'zamraża',
  146.     sham_des = 'daje szamana',
  147.     ch_des = 'daje ser',
  148.     tp_des = 'teleportuje',
  149.     utp_des = 'wyłącza teleportacje, [odkleja gracza]',
  150.     tpp_des = 'teleportuje i przykleja',
  151.     ro_des = 'usuwa wszystkie objekty',
  152.     meep_des = 'daje meep',
  153.     ban_des = 'wyłącza komendy dla <nick>',
  154.     unban_des = 'włącza komendy dla <nick>',
  155.     admin_des = 'daje admina',
  156.     unadmin_des = 'zabiera admina',
  157.     score_des = 'ustawia wynik',
  158.     mapname_des = 'zmienia nazwe mapy',
  159.     shamname_des = 'zmienia nazwe szamana',
  160.     respawn_des = 'odradza',
  161.     autorespawn_des = 'włącza/wyłącza automatyczne odradzanie',
  162.     datl_des = 'włącza/wyłącza czas',
  163.     color_des = 'Ustawia kolor nicka',
  164.     queue_des = 'włącza/wyłącza kolejkowanie map',
  165.     maps_des = 'pokazuje kolejke map',
  166.     np_des = 'włacza mape',
  167.     npp_des = 'dodaje mape do kolejki',
  168.     mort_des = 'zabija gracza',
  169.     off_des = 'wyłacza komende',
  170.     on_des = 'włącza komende',
  171.     cmd_des = 'pokazuje spis komend',
  172.     pet_des = 'zamienia <arg1> w zwierzątko',
  173.     unpet = 'wyłącza !pet',
  174.     set_des = 'pokazuje ustawienia',
  175.     xml_des = 'ładuje mapę z kodu XML',
  176.     house_des = 'ustawia chatkę plemienną',
  177.     help_des = 'pomoc',
  178.     vampire_des = 'zamienia w wampira',
  179.     log_des = 'pokazuje log !komend',
  180.     queue_set = 'kolejkowanie map',
  181.     autorespawn_set = 'automatyczne odradzanie',
  182.     autoTimeLeft_set = 'autoTimeLeft',
  183.     afk_set = 'śmiereć AFK',
  184.     autoNewGame_set = 'automatyczna zmiana map',
  185.     autoScore_set = 'automatyczne punkty',
  186.     autoShaman_set = 'atomatyczne wybieranie szamana',
  187.     shamanSkills_set = 'dodatkowe umiejętności szamana',
  188.     settime_des = 'ustaw czas',
  189.     snow_des = 'włącza śnieg',
  190.     _des = '',
  191.     _des = '',
  192.     _des = '',
  193.  
  194. }
  195. lg = lang[language]
  196. mapNumber = 0
  197. wait = 0
  198. Log = '\n'
  199. tp = {}
  200. tpp = {}          
  201. playerPosition = {}
  202. ban = {}
  203. maps = {}
  204. ob = {}
  205. timer = {}
  206. pet = {}
  207. move = {}
  208. xml = {}
  209. vote = {}
  210.  
  211. commands = {
  212.     kill = {on = 1, admin = 1, arg = 0, arg2 = 1, des = lg.kill_des, func = function(nick, args)
  213.         tfm.exec.killPlayer(name(1))
  214.     end},
  215.     ice = {on = 1, admin = 1, arg = 1, des = lg.ice_des, func = function(nick, args)
  216.         if tfm.get.room.playerList[args[2]] then
  217.             local y = tfm.get.room.playerList[args[2]].y
  218.             local x = tfm.get.room.playerList[args[2]].x
  219.             tfm.exec.addShamanObject(54, x, y, 0, 0, 0, false)
  220.             tfm.exec.killPlayer(args[2])
  221.         end
  222.     end},
  223.     sham = {on = 1, admin = 1, arg = 0, arg2 = 1, des = lg.sham_des, func = function(nick, args)
  224.         tfm.exec.setShaman(name(1))
  225.     end},
  226.     ch = {on = 1, admin = 1, arg = 0, arg2 = 1, des = lg.ch_des, func = function(nick, args)
  227.         tfm.exec.giveCheese(name(1))
  228.     end},
  229.     tp = {on = 1, admin = 1, arg = 0, arg2 = 1, des = lg.tp_des, func = function(nick, args)
  230.         system.bindMouse(nick,true)
  231.         tpp[nick] = nil
  232.         tp[nick] = args[2] 
  233.     end},
  234.     tpp = {on = 1, admin = 1, arg = 0, arg = 1, des = lg.tpp_des, func = function(nick, args)
  235.         system.bindMouse(nick,true)
  236.         tp[nick] = nil
  237.         tpp[nick] = args[2]
  238.     end},
  239.     utp = {on = 1, admin = 1, arg = 0, arg2 = 1, des = lg.utp_des, func = function(nick, args)
  240.         playerPosition[name(1)] = nil
  241.         tpp[nick] = nil
  242.         tp[nick] = nil
  243.         playerPosition[nick] = nil
  244.     end},
  245.     ro = {on = 1, admin = 1, arg = 0, des = lg.ro_des, func = function(nick, args)
  246.         for key,val in pairs(tfm.get.room.objectList) do
  247.             table.insert(ob, key)
  248.         end
  249.         for key,val in pairs(ob) do
  250.             tfm.exec.removeObject(val)
  251.         end
  252.         ob = {}
  253.     end},
  254.     meep = {on = 1, admin = 1, arg = 1, des = lg.meep_des, func = function(nick, args)
  255.         tfm.exec.giveMeep(args[2])
  256.     end},
  257.     ban = {on = 1, admin = 1, arg = 1, des = lg.ban_des, func = function(nick, args)
  258.         ban[args[2]] = true
  259.     end},
  260.     unban = {on = 1, admin = 1, arg = 1, des = lg.unban_des, func = function(nick, args)
  261.         ban[args[2]] = false
  262.     end},
  263.     admin = {on = 1, admin = 1, arg = 1, des = lg.admin_des, func = function(nick, args)
  264.         table.insert(admins, args[2])
  265.     end},
  266.     unadmin = {on = 1, admin = 2, arg = 1, des = lg.unadmin_des, func = function(nick, args)
  267.         for i=1,#admins,1 do
  268.             if admins[i] == args[2] then
  269.                 table.remove(admins, i)
  270.             end
  271.         end
  272.     end},
  273.     score = {on = 1, admin = 1, arg = 1, arg2 = 2, des = lg.score_des, func = function(nick, args)
  274.         tfm.exec.setPlayerScore(args[2], args[3], 0)
  275.     end},
  276.     mapname = {on = 1, admin = 1, arg = -1, des = lg.mapname_des, func = function(nick, args)
  277.         tfm.exec.setUIMapName(bbcode(rest))
  278.     end},
  279.     shamname = {on = 1, admin = 1, arg = -1, des = lg.shamname_des, func = function(nick, args)
  280.         tfm.exec.setUIShamanName(bbcode(rest))
  281.     end},
  282.     respawn = {on = 1, admin = 1, arg = 0, arg2 = 1, des = lg.respawn_des, func = function(nick, args)
  283.         tfm.exec.respawnPlayer(name(1))
  284.     end},
  285.     autorespawn = {on = 1, admin = 1, arg = 1, des = lg.autorespawn_des, func = function(nick, args)
  286.         if args[2] == 'off' then
  287.             settings.autorespawn.on = 0
  288.         else   
  289.             settings.autorespawn.on = 1
  290.         end
  291.     end},
  292.     color = {on = 1, admin = 1, arg = 1, arg = 2, des = lg.color_des, func = function(nick, args)
  293.         tfm.exec.setNameColor(args[2],'0x'..args[3])
  294.     end},
  295.     queue = {on = 1, admin = 1, arg = 1, des = lg.queue_des, func = function(nick, args)
  296.         if args[2] == 'off' then
  297.             settings.queue.on = 0
  298.             tfm.exec.disableAutoNewGame(false)
  299.         else
  300.             settings.queue.on = 1
  301.             tfm.exec.disableAutoNewGame(true)
  302.             message('all', 'Włączono kolejkowanie', 'green')
  303.         end
  304.     end},
  305.     maps = {on = 1, admin = 0, arg = 0, des = lg.maps_des, func = function(nick, args)
  306.         showQueue(nick)
  307.     end},
  308.     np = {on = 1, admin = 0, arg = 1, des = lg.np_des, func = function(nick, args)
  309.         tfm.exec.newGame(args[2])
  310.     end},
  311.     npp = {on = 1, admin = 0, arg = 1, des = lg.npp_des, func = function(nick, args)
  312.         if #maps - mapNumber == 17 then
  313.             message(nick, 'Nie możesz dodać więcej map', 'red')
  314.         else
  315.             local code = args[2]
  316.             if args[2] == 'xml' then
  317.                 if not xml[nick] then
  318.                     return false
  319.                 end
  320.                 code = xml[nick].xml
  321.             end
  322.             local mapNr = #maps+1;
  323.             maps[mapNr] = {}
  324.             maps[mapNr].code = code
  325.             maps[mapNr].name = args[2]
  326.             maps[mapNr].nick = nick
  327.         end
  328.     end},
  329.     meep = {on = 1, admin = 0, arg = 0, des = lg.meep_des, func = function(nick, args)
  330.         tfm.exec.giveMeep(nick)
  331.     end},
  332.     mort = {on = 1, admin = 0, arg = 0, des = lg.mort_des, func = function(nick, args)
  333.         tfm.exec.killPlayer(nick)
  334.     end},
  335.     off = {on = 1, admin = 1, arg = 1, des = lg.off_des, func = function(nick, args)
  336.         if args[2] == 'off' or args[2] == 'on' then
  337.        
  338.         elseif not commands[args[2]] then
  339.             message(nick, 'Nie ma takiej komendy', 'red')
  340.         else
  341.             commands[args[2]].on = 0
  342.             message(nick, 'Wyłączono "'..args[2]..'"', 'green')
  343.         end
  344.     end},
  345.     on = {on = 1, admin = 1, arg = 1, des = lg.on_des, func = function(nick, args)
  346.         if not commands[args[2]] then
  347.             message(nick, 'Nie ma takiej komendy', 'red')
  348.         else
  349.             commands[args[2]].on = 1
  350.             message(nick, 'Włączono "'..args[2]..'"', 'green')
  351.         end
  352.     end},
  353.     cmd = {on = 1, admin = 0, arg = 0, des = lg.cmd_des, func = function(nick, args)
  354.         showCmd(nick)
  355.     end},
  356.     pet = {on = 1, admin = 1, arg = 1, des = lg.pet_des, func = function(nick, args)
  357.         pet[args[2]] = nick
  358.     end},
  359.     unpet = {on = 1, admin = 1, arg = 1, des = lg.unpet,func = function(nick, args)
  360.         pet[args[2]] = nil
  361.     end},
  362.     set = {on = 1, admin = 0, arg = 0, des = lg.set_des, func = function(nick, args)
  363.         options(nick)
  364.     end},
  365.     xml = {on = 1, admin = 0, arg = -1, des = lg.xml_des, func = function(nick, args)
  366.         if args[2] == 'start' then
  367.             xml[nick] = {}
  368.             xml[nick].f = 1
  369.             xml[nick].xml = ' '
  370.         elseif args[2] == 'play' then
  371.             if xml[nick] ~= nil then
  372.                 tfm.exec.newGame(xml[nick].xml)    
  373.             end
  374.         elseif xml[nick] ~= nil then
  375.             if xml[nick].f == 1 then
  376.                 xml[nick].xml = string.gsub(rest, "&lt;", "<")
  377.                 xml[nick].f = 0
  378.             else
  379.                 xml[nick].xml = xml[nick].xml..string.gsub(rest, "&lt;", "<")
  380.             end
  381.         end
  382.     end},
  383.     house = {on = 1, admin = 0, arg = 1, des = lg.house_des, func = function(nick, args)
  384.         if args[2] == 'off' then
  385.             house = nil
  386.             tfm.exec.disableAfkDeath(false)
  387.             tfm.exec.disableAutoShaman(false)
  388.             tfm.exec.disableAutoNewGame(false)
  389.         else
  390.             tfm.exec.disableAfkDeath(true)
  391.             tfm.exec.disableAutoShaman(true)
  392.             tfm.exec.disableAutoNewGame(true)
  393.            
  394.             if args[2] == 'xml' then
  395.                 house = xml[nick]
  396.                 tfm.exec.newGame(xml[nick])
  397.             else
  398.                 house = args[2]
  399.                 tfm.exec.newGame(args[2])
  400.             end
  401.            
  402.         end
  403.     end},
  404.     help = {on = 1, admin = 0, arg = 0, des = lg.help_des, func = function(nick, args)
  405.         showHelp(nick)
  406.     end},
  407.     vampire = {on = 1, admin = 0, arg = 0, arg2 = 1, des = lg.vampire_des, func = function(nick, args)
  408.         tfm.exec.setVampirePlayer(name(1)) 
  409.     end},
  410.     log = {on = 1, admin = 2, arg = 0, arg2 = 0, des = lg.log_des, func = function(nick, args)
  411.         ui.addTextArea(3,  Log:sub(1, 2000), nick, 250, 40, 300, 335, nil, nil,0.7)
  412.     end},
  413.     module = {on = 1, admin = 0, arg = 0, arg2 = 1, des = lg.module_des, func = function(nick, args)
  414.         if not args[2] then
  415.             showModules(nick)
  416.         elseif module.on == 1 and (args[2] == 'stop' or args[2] == 'off')and isAdmin(nick) then
  417.             if modules[module.play].off then
  418.                 modules[module.play]:off(args)
  419.             end
  420.             module.on = 0
  421.             module.play = ''
  422.         elseif isAdmin(nick) and modules[args[2]] then
  423.             modulePlay(nick, args[2])
  424.         end
  425.     end},
  426.     settime = {on = 1, admin = 1, arg = 1, des = lg.settime_des, func = function(nick, args)
  427.         tfm.exec.setGameTime(args[2])  
  428.     end},
  429.     snow = {on = 1, admin = 1, arg = 0, des = lg.snow_des, func = function(nick, args)
  430.         tfm.exec.snow()
  431.     end},
  432.  
  433.     -- own commands / własne komendy
  434.    
  435.  
  436.    
  437.     -- end of own commands / koniec własnych komend   
  438. }
  439.  
  440. settings = {
  441.     queue = {on = 0, def = 0,
  442.         des = lg.queue_set,
  443.         fOn = function() end,
  444.         fOff = function() end},
  445.     autorespawn = {on = 0, def = 0,
  446.         des = lg.autorespawn_set,
  447.         fOn = function() end,
  448.         fOff = function() end},
  449.     autoTimeLeft = {on = 0, def = 0,
  450.         des = lg.autoTimeLeft_set,
  451.         fOn = function() tfm.exec.disableAutoTimeLeft(false) end,
  452.         fOff = function() tfm.exec.disableAutoTimeLeft(true) end},
  453.     afk = {on = 1, def = 0,
  454.         des = lg.afk_set,
  455.         fOn = function() tfm.exec.disableAfkDeath(false) end,
  456.         fOff = function() tfm.exec.disableAfkDeath(true) end},
  457.     autoNewGame = {on = 1, def = 1,
  458.         des = lg.autoNewGame_set,
  459.         fOn = function() tfm.exec.disableAutoNewGame(false) end,
  460.         fOff = function() tfm.exec.disableAutoNewGame(true) end},
  461.     autoScore = {on = 1, def = 1,
  462.         des = lg.autoScore_set,
  463.         fOn = function() tfm.exec.disableAutoScore(false) end,
  464.         fOff = function() tfm.exec.disableAutoScore(true) end},
  465.     autoShaman = {on = 1, def = 1,
  466.         des = lg.autoShaman_set,
  467.         fOn = function() tfm.exec.disableAutoShaman(false) end,
  468.         fOff = function() tfm.exec.disableAutoShaman(true) end},
  469.     shamanSkills = {on = 1, def = 1,
  470.         des = lg.shamanSkills_set,
  471.         fOn = function() tfm.exec.disableAllShamanSkills(false) end,
  472.         fOff = function() tfm.exec.disableAllShamanSkills(true) end},
  473.     -- own settings / własne ustawienia
  474.    
  475.    
  476.    
  477.     -- end of own settings / koniec własnych ustawień        
  478. }
  479.  
  480. -- moduły
  481. module = {on = 0, play = ''}
  482. modules = {
  483.     racing = {name = 'Racing''normal'
  484.             tfm.exec.newGame(self.maps[math.random(#self.maps)])
  485.             tfm.exec.disableAutoNewGame(true)
  486.             tfm.exec.disableAutoShaman(true)
  487.             tfm.exec.disableAutoTimeLeft(true)
  488.         end,
  489.         off = function(self)
  490.             tfm.exec.disableAutoNewGame(false)
  491.             tfm.exec.disableAutoShaman(true)
  492.             tfm.exec.disableAutoTimeLeft(false)
  493.         end,
  494.         eventLoop = function(self, t1, t2)
  495.             if self.mode == 'drunk' then
  496.                 if math.random(5) == 1 then
  497.                     for key,val in pairs(tfm.get.room.playerList) do
  498.                         x = math.random(-50, 50)
  499.                         if x ~= 0 then
  500.                             tfm.exec.movePlayer(key, 0, 0, true, math.random(-50, 50), 0, true)
  501.                         end
  502.                     end
  503.                 end
  504.             end
  505.             if t2<=0 then
  506.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  507.             end
  508.         end,
  509.         eventPlayerWon = function(self, name)
  510.             local i=0
  511.             for k,v in pairs(tfm.get.room.playerList) do
  512.                 if not v.isDead then
  513.                     i=i+1
  514.                 end
  515.             end
  516.             if i==0 then
  517.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  518.             end
  519.         end,
  520.         eventPlayerDied = function(self, name)
  521.             local i=0
  522.             for k,v in pairs(tfm.get.room.playerList) do
  523.                 if not v.isDead then
  524.                     i=i+1
  525.                 end
  526.             end
  527.             if i==0 then
  528.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  529.             end
  530.         end,
  531.         eventChatCommand = function(self, name, msg)
  532.             if msg == 'mode drunk' then
  533.                 self.mode = 'drunk'
  534.             elseif msg == 'mode normal' then
  535.                 self.mode = 'normal'
  536.             end
  537.         end,
  538.         eventNewGame = function(self)
  539.             tfm.exec.setGameTime(63)
  540.         end
  541.     },
  542.     survivor = {name = 'Simple survivor', maps = {276534,279689,280120,280159,281431,281479,281492,281649,289932,289964,290388,290546,290725,290865,290971,290974,291399,291643,292592,292672,292678,293222,293487,295988,296033,299123,300404,302224,304198,304482,305748,305753,306106,306360,306382,307930,311496,390383,390386,390649,390657,391057,391643,391664,391738,392616,392646,393406,395246,397066,459284,464787,478116,479091,481676,489470,489829,490248,492283,495880,500312,521931,540495,573817,697561,741041,770675,787131,793117,797964,799141,802958,802975,803074,811211,848697,852617,866256,908739,937383,958881,1026249,1277941,1388662,1463332,1492805,1514928,1515058,1519483,1522692,1525486,1528388,1533333,1533374,1539148,1543937,1545834,1659906,1661909,1794873,1794907,1812056,2387888,2408376,2526952,2732060,2842113,2931068,2939549,3061252,3067251,3107377,3146721,3175437,3295213,3322939,3349286,3400319,3419948,3473722,3480467,3540608,3549404,3550350,3584123,3584826,3587860,3620709,3670885,3685564,3699989},
  543.         func = function(self)
  544.             tfm.exec.newGame(self.maps[math.random(#self.maps)])
  545.             tfm.exec.disableAutoNewGame(true)
  546.         end,
  547.         off = function(self)
  548.             tfm.exec.disableAutoNewGame(false)
  549.         end,
  550.         eventLoop = function(self, t1, t2)
  551.             if t2<=0 then
  552.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  553.             end
  554.         end,
  555.         eventPlayerDied = function(self, name)
  556.             local i=0
  557.             for k,v in pairs(tfm.get.room.playerList) do
  558.                 if not v.isDead then
  559.                     i=i+1
  560.                 end
  561.             end
  562.             if i==0 then
  563.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  564.             end
  565.         end,
  566.     },
  567.    
  568.     vampire = {name = 'Vampire survivor', maps = {258972,334445,423793,615791,760329,812007,946893,955523,1296883,1542025,1638989,1676629,1782151,2389613,2393716,2403639,2428213,2429313,2435372,2541364,2561153,2563004,2680717,2683284,2686097,2693083,2761246,2821033,2910904,2929496,2938327,2940045,2944932,2951616,2953590,2956031,2956156,2971085,2975699,2976059,2983430,2986318,2999898,3001393,3006311,3020988,3027934,3032840,3033710,3044452,3057493,3061098,3068111,3069138,3079426,3090849,3101671,3103683,3105156,3110659,3119050,3120924,3128337,3140275,3167932,3170618,3187755,3195331,3197349,3225462,3240230,3270111,3292389,3296041,3333339,3334083,3337200,3359267,3377553,3430472,3435288,3460936,3482009,3485896,3488764,3509662,3515991,3611033,3745155,3745168,3808004,3946003},
  569.         func = function(self)
  570.             tfm.exec.newGame(self.maps[math.random(#self.maps)])
  571.             tfm.exec.disableAutoNewGame(true)
  572.         end,
  573.         off = function(self)
  574.             tfm.exec.disableAutoNewGame(false)
  575.         end,
  576.         eventLoop = function(self, t1, t2)
  577.             if t2<=0 then
  578.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  579.             end
  580.             local i=0
  581.             for k,v in pairs(tfm.get.room.playerList) do
  582.                 if not v.isDead then
  583.                     i = i+1
  584.                 end
  585.             end
  586.             local x = 0
  587.             for k,v in pairs(tfm.get.room.playerList) do
  588.                 if v.isVampire then
  589.                     x = x+1
  590.                 end
  591.             end
  592.             if i == 0 or x == i then
  593.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  594.             end
  595.         end,
  596.     },
  597.     bootcamp = {name = 'Bootcamp', maps = {155517,156510,159116,159145,167333,170007,175454,176615,177652,186855,187035,195453,197368,212322,215933,229974,235717,249760,253469,255943,257092,258289,259854,266398,277631,277835,280949,281668,281985,285589,285961,292668,292808,293658,294478,295487,296020,298424,301559,305680,313138,313214,322922,330590,342640,343875,346684,353356,357837,366809,368585,371579,374995,392861,431873,503679,507341,507884,515684,544695,549759,554154,591528,593003,597348,597804,621850,639878,651656,655207,658960,720672,733146,763368,814311,1102513,1110982,1134969,1296299,1350382,1526368,1533335,1584555,1610638,1636814,1642725,1646448,1657819,1705006,1719709,1737297,1737800,1737914,1766343,1802012,1802528,1828801,1830551,1852910,1853529,1853689,1869912,1872179,1949730,1951944,1952415,1962695,2009003,2031184,2033229,2036898,2050389,2080400,2082776,2128560,2132250,2176211,2202628,2208924,2239788,2242899,2252731,2297260,2309030,2341982,2346943,2357991,2362046,2378364,2395201,2420714,2427910,2432090,2444812,2448730,2466489,2474044,2484316,2574744,2574960,2601214,2636207,2643916,2668918,2669415,2673019,2682583,2692883,2693344,2693587,2704483,2707566,2708585,2718406,2719419,2738370,2747525,2750014,2758747,2772507,2777168,2789121,2797076,2803483,2805938,2811229,2812309,2817711,2818330,2819876,2828481,2844637,2850177,2854813,2858882,2860211,2860683,2869337,2877042,2884392,2887929,2890123,2901717,2914456,2917286,2918822,2920826,2925531,2925762,2933011,2933215,2933390,2941840,2945156,2947140,2961800,2963166,2967631,2974387,2996951,2998268,2999994,3000006,3003490,3008319,3008515,3012178,3012311,3016226,3023941,3024238,3024606,3034308,3041105,3042080,3043779,3053202,3062939,3075090,3076903,3085218,3089270,3099302,3118161,3118286,3133917,3137929,3142783,3146209,3149125,3161324,3163166,3164813,3182006,3182487,3185979,3200001,3219400,3225624,3241030,3242050,3243455,3250426,3264848,3278138,3281758,3292308,3293485,3295954,3295960,3311534,3330219,3337127,3338283,3343092,3343148,3374634,3386996,3395605,3399831,3402881,3404894,3424529,3428069,3430712,3434941,3447134,3459986,3463050,3471016,3473704,3473925,3478040,3483300,3484437,3491601,3493456,3493490,3500755,3513929,3521460,3526517,3527399,3530999,3535850,3547571,3560999,3561333,3571256,3576303,3588395,3603631,3619320,3637540,3645415,3659983,3668877,3690128,3702819,3707630,3725142,3734988,3734989,3734990,3734991,3734996,3734997,3734998,3734999,3745158,3747520,3750360,3759157,3767893,3768117,3779861,3780618,3799357,3804078,3815568,3820467,3820501,3826546,3846632,3849999,3860578,3866660,3866663,3875019,3920916,3937567,3938895,3944386,3944814,3958217,3959785,3964892,3969628,3976725,3976766,3995343,3999991,3999992,3999997,4000007,4000008,4000009,4019421,4027263,4038388,4039451,4058168,4093488,4107909,4121359,4237910,4241333,4283009,113156,124000,149422,149451,150607,150651,150664,151655,152260,152733,153996,155480,155606,155611,155628,155765,156720,157004,157203,157805,157960,158345,158417,158909,159131,159187,159298,159932,160841,161023,161434,162482,163094,163159,163172,163506,163531,163596,164544,164916,165186,166032,166037,166056,166271,166333,166361,166430,166805,167075,167903,168204,168754,169059,169076,169110,169139,169228,170514,171148,171480,171482,171776,172501,172512,172520,172547,172605,172621,172951,172976,173623,173816,174223,175204,175280,176253,176507,176619,176710,176729,179005,179488,179492,179807,180801,182370,182769,183139,183141,184648,184817,184868,185289,185428,185529,185873,185887,186066,186220,186378,189819,190646,190996,191177,191203,191205,191443,191642,192158,192959,193662,195116,197229,198988,199210,199710,199826,201000,202574,203664,204488,204647,205240,205506,206396,208056,208373,208653,208940,209848,213752,213755,213874,214631,214755,216171,216173,217261,220352,222377,222910,223174,223947,224108,225744,226266,230588,231137,231921,232469,232678,235037,236768,237091,250153,254785,257218,257324,257715,258160,258192,258908,259319,261298,261814,263819,263926,264091,268915,270143,270924,271193,271411,272402,272518,272689,277427,277513,277824,279337,281948,282584,284134,286254,289865,290824,295630,295932,297442,299942,299983,301610,302080,303151,303939,304861,305567,305614,305705,305820,306365,306384,306655,307324,313216,314743,315666,315800,316012,318129,319443,320483,320626,322582,327354,327743,329200,329318,329571,330933,330967,331344,331988,332130,332906,333002,336305,337644,342035,343456,354984,361500,365061,368839,372255,372419,373105,375455,376704,378704,380516,383358,391924,392240,393426,394132,395216,395310,395961,397467,397469,397478,398116,399364,401630,403755,403940,406154,408577,408643,410040,410045,412467,412913,419335,419369,419635,420877,422981,423311,424604,424685,424900,425747,425884,431433,431749,432501,435812,438333,438364,438449,439092,444589,447805,449496,454049,455271,457726,458528,460961,467137,476706,478236,482791,492222,492399,496610,496886,497965,499986,500000,500690,500748,500894,504485,505619,506032,506613,506940,510996,511136,512887,514311,522719,523270,528032,531084,536905,541223,541693,541729,543010,551317,552986,556575,556841,556973,557066,557074,560526,560583,562897,563436,564198,568122,571683,574183,575497,584783,586901,587501,592189,593164,593204,593431,593530,596239,598845,605255,608368,612415,618999,654894,684566,692650,692740,698992,721319,722837,729863,758595,783547,801683,815336,834297,842019,842167,868262,881158,898934,912356,914570,919484,970919,976944,999963,1000006,1004622,1014313,1018394,1046877,1066607,1111252,1130256,1156092,1157281,1162831,1164086,1226207,1242584,1255359,1256085,1265789,1301649,1303323,1323048,1333846,1383297,1384078,1390405,1398609,1403454,1410539,1413528,1427980,1435902,1494499,1503203,1526894,1531604,1540221,1580356,1580835,1593066,1595965,1615753,1615949,1620703,1647131,1678634,1722755,1733211,1788490,1807217,1809410,1923584,1955745,1989803,1990413,2024960,2040569,2130169,2178800,2311703,2329940,2416969,2423300,2451444,2469365,2520540,2636519,2788517,2794566,2795201,2846829,2989803,3038589,3136410,3199998,3242049,3295967,3326197,3333223,3380788,3456260,3551333,3668866,3668888,3690269,3907267,3908151,3988424,4067327,4074214},
  598.         help = [[
  599.     !s or !ss to save position
  600.     !l or l key to load
  601.     !new to new map
  602. ]],
  603.         func = function(self)
  604.             self.save = {}
  605.             for k,v in pairs(tfm.get.room.playerList) do
  606.                eventNewPlayer(k)
  607.             end
  608.             system.disableChatCommandDisplay('ss', true)
  609.             system.disableChatCommandDisplay('s', true)
  610.             system.disableChatCommandDisplay('l', true)
  611.             tfm.exec.disableAutoShaman(true)
  612.             tfm.exec.disableAutoNewGame(true)
  613.             tfm.exec.disableAutoTimeLeft(true)
  614.             tfm.exec.disableAfkDeath(true)
  615.             tfm.exec.newGame(self.maps[math.random(#self.maps)])
  616.         end,
  617.         off = function(self)
  618.             tfm.exec.disableAutoShaman(false)
  619.             tfm.exec.disableAutoNewGame(false)
  620.             tfm.exec.disableAutoTimeLeft(false)
  621.             tfm.exec.disableAfkDeath(false)
  622.             system.disableChatCommandDisplay('ss', false)
  623.             system.disableChatCommandDisplay('s', false)
  624.             system.disableChatCommandDisplay('l', false)
  625.         end,
  626.         eventLoop = function(self, t1, t2)
  627.             if t2<=0 then
  628.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  629.             end
  630.         end,
  631.         eventPlayerDied = function(self, name)
  632.             tfm.exec.respawnPlayer(name)
  633.         end,
  634.         eventPlayerWon = function(self, name)
  635.             tfm.exec.respawnPlayer(name)
  636.         end,
  637.         eventNewPlayer = function(self, name)
  638.             tfm.exec.respawnPlayer(name)
  639.             tfm.exec.bindKeyboard(name,76,true,true)
  640.         end,
  641.         eventNewGame = function(self)
  642.             tfm.exec.setGameTime(300)
  643.             self.save = {}
  644.         end,
  645.         eventChatCommand = function(self, name, msg)
  646.             if msg == 's' or msg == 'ss' then
  647.                 if not self.save[name] then
  648.                     self.save[name] ={}
  649.                 end
  650.                 self.save[name].x = tfm.get.room.playerList[name].x
  651.                 self.save[name].y = tfm.get.room.playerList[name].y
  652.                 self.save[name].cheese = tfm.get.room.playerList[name].hasCheese
  653.             elseif msg == 'l' then
  654.                 if self.save[name] then
  655.                     tfm.exec.movePlayer(name, self.save[name].x, self.save[name].y)
  656.                     if self.save[name].cheese then
  657.                         tfm.exec.giveCheese(name)
  658.                     end
  659.                 end
  660.             elseif msg == 'next' then
  661.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  662.             end
  663.         end,
  664.         eventKeyboard = function(self, name, key, down, x, y)
  665.             if key == 76 then
  666.                 if self.save[name] then
  667.                     tfm.exec.movePlayer(name, self.save[name].x, self.save[name].y, false, 1, 1)
  668.                     if self.save[name].cheese then
  669.                         tfm.exec.giveCheese(name)
  670.                     end
  671.                 end
  672.             end
  673.         end,
  674.     },
  675.     ffa = {name = 'Free for all', author = 'Shamousey', maps={521833,401421,541917,541928,541936,541943,527935,559634,559644,888052,878047,885641,770600,770656,772172,891472,589736,589800,589708,900012,901062,754380,901337,901411,907870,910078,1190467,1252043,1124380,1016258,1252299,1255902,1256808,986790,1285380,1271249,1255944,1255983,1085344,1273114,1276664,1279258,1286824,1280135,1280342,1284861,1287556,1057753,1196679,1288489,1292983,1298164,1298521,1293189,1296949,1308378,1311136,1314419,1314982,1318248,1312411,1312589,1312845,1312933,1313969,1338762,1339474,1349878,1297154,644588,1351237,1354040,1354375,1362386,1283234,1370578,1306592,1360889,1362753,1408124,1407949,1407849,1343986,1408028,1441370,1443416,1389255,1427349,1450527,1424739,869836,1459902,1392993,1426457,1542824,1533474,1561467,1563534,1566991,1587241,1416119,1596270,1601580,1525751,1582146,1558167,1420943,1466487,1642575,1648013,1646094,1393097,1643446,1545219,1583484,1613092,1627981,1633374,1633277,1633251,1585138,1624034,1616785,1625916,1667582,1666996,1675013,1675316,1531316,1665413,1681719,1699880,1688696,623770,1727243,1531329,1683915,1689533,1738601,3756146,912118,3326933,3722005,3566478,1456622,1357994,1985670,1884075,1708065,1700322,2124484,3699046,2965313,4057963,4019126,3335202,2050466},
  676.         func = function(self)
  677.             tfm.exec.disableAutoNewGame(true)
  678.             tfm.exec.disableAutoShaman(true)
  679.             self.players={}
  680.             self.toDespawn={}
  681.             for name,player in pairs(tfm.get.room.playerList) do
  682.                 eventNewPlayer(name)
  683.             end
  684.  
  685.             tfm.exec.newGame(self.maps[math.random(#self.maps)])
  686.         end,
  687.         off = function(self)
  688.             tfm.exec.disableAutoNewGame(false)
  689.             tfm.exec.disableAutoShaman(false)
  690.             tfm.exec.newGame()
  691.         end,
  692.         eventNewPlayer = function(self, name)
  693.             for i,key in pairs({32,40,83}) do
  694.                 tfm.exec.bindKeyboard(name,key,true,true)
  695.             end
  696.             self.players[name]={
  697.                 timestamp=os.time(),
  698.                 offsets={x=2, y=10}
  699.             }
  700.         end,
  701.         eventKeyboard = function(self, name,key,down,x,y)
  702.             if (key==32 or key==40 or key==83) and not tfm.get.room.playerList[name].isDead and self.started then
  703.                 if self.players[name].timestamp < os.time()-1000 then
  704.                     local id
  705.                     if tfm.get.room.playerList[name].isFacingRight then
  706.                         id=tfm.exec.addShamanObject(19,x+self.players[name].offsets.x,y+self.players[name].offsets.y)
  707.                     else
  708.                         id=tfm.exec.addShamanObject(20,x+self.players[name].offsets.x,y+self.players[name].offsets.y)
  709.                     end
  710.                     self.players[name].timestamp=os.time()
  711.                     table.insert(self.toDespawn,{os.time(),id})
  712.                 end
  713.             end
  714.         end,
  715.         eventNewGame = function(self)
  716.             self.started=false
  717.         end,
  718.         eventLoop = function (self, t1,t2)
  719.             if t1 >= 3000 and not started then
  720.                 self.started=true
  721.             end
  722.             if t2<=0 then
  723.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  724.             end
  725.             for i,cannon in ipairs(self.toDespawn) do
  726.                 if cannon[1] <= os.time()-3000 then
  727.                     tfm.exec.removeObject(cannon[2])
  728.                     table.remove(self.toDespawn,i)
  729.                 end
  730.             end
  731.         end,
  732.         eventPlayerDied = function(self, name)
  733.             local i=0
  734.             local n
  735.             for pname,player in pairs(tfm.get.room.playerList) do
  736.                 if not player.isDead then
  737.                     i=i+1
  738.                     n=pname
  739.                 end
  740.             end
  741.             if i==0 then
  742.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  743.             elseif i==1 then
  744.                 tfm.exec.giveCheese(n)
  745.                 tfm.exec.playerVictory(n)
  746.                 tfm.exec.setGameTime(5)
  747.             end
  748.         end,
  749.     },
  750.     -- own modulese / własne moduły
  751.    
  752.    
  753.    
  754.     -- end of own modulese / koniec własnych modułów
  755. }
  756.  
  757. ---- sortowanie tablic (skopiowane)
  758. function spairs(t, order)
  759.     -- collect the keys
  760.     local keys = {}
  761.     for k in pairs(t) do keys[#keys+1] = k end
  762.     -- if order function given, sort by it by passing the table and keys a, b,
  763.     -- otherwise just sort the keys
  764.     if order then
  765.         table.sort(keys, function(a,b) return order(t, a, b) end)
  766.     else
  767.         table.sort(keys)
  768.     end
  769.     -- return the iterator function
  770.     local i = 0
  771.     return function()
  772.         i = i + 1
  773.         if keys[i] then
  774.             return keys[i], t[keys[i]]
  775.         end
  776.     end
  777. end
  778.  
  779. -- sparwdzanie czy admin
  780. function isAdmin(nick)
  781.     for key, val in pairs(admins) do
  782.         if val == nick then
  783.             return true
  784.         end
  785.     end
  786.     return false
  787. end
  788.  
  789. ---- sprawdzanie komend
  790. function cmd(com, args, nick)
  791.     if commands[args[1]] then
  792.         if not commands[com].arg2 then
  793.             commands[com].arg2 = commands[com].arg
  794.         end
  795.         if  commands[com].on == 1 and (((#args - 1) >= commands[com].arg and (#args - 1) <= commands[com].arg2) or commands[com].arg == -1) then
  796.             if commands[com].admin == 1 then
  797.                 for key,val in pairs(admins) do
  798.                     if val == nick then
  799.                         commands[com].func(nick, args)
  800.                         return true
  801.                     end
  802.                 end
  803.                 return false
  804.             elseif commands[com].admin == 2 then
  805.                 for key,val in pairs(superAdmin) do
  806.                     if val == nick then
  807.                         commands[com].func(nick, args)
  808.                         return true
  809.                     end
  810.                 end
  811.                 return false
  812.             end
  813.             commands[com].func(nick, args)
  814.             return true
  815.         end
  816.     end
  817.     return false
  818. end
  819.  
  820. ---- BBcode
  821. function bbcode(text)
  822.     text = string.gsub(text, "%[(.?)b%]", "<%1b>")
  823.     text = string.gsub(text, "%[(.?)i%]", "<%1i>")
  824.     text = string.gsub(text, "%[(.?)u%]", "<%1u>")
  825.     text = string.gsub(text, "%[/color%]", "</font>")
  826.     text = string.gsub(text, '%[color=#?(......)%]', '<font color="#%1">')
  827.     return text
  828. end
  829.  
  830. ---- wyświetlanie komunikatów
  831. function message(nick, msg, color)
  832.     local nick2 = nick
  833.     if nick == 'all' then
  834.         nick2 = nil
  835.     end
  836.     if color == 'red' then
  837.         cr = '#CB546B'
  838.     elseif color == 'green' then
  839.         cr = '#2ECF73'
  840.     elseif color == 'blue' then
  841.         cr = '#2F7FCC'
  842.     end
  843.     ui.addTextArea(2, '<font color="'..cr..'">'..msg..'</font>', nick2, 10, 30, 300, 18, nil, nil,0.9)
  844.     timer[nick] = {}
  845.     timer[nick].tim = 4
  846.     timer[nick].make = function() ui.removeTextArea(2, nick2) end
  847. end
  848.  
  849. ---- teraźniejszy czas
  850. function time()
  851.     local utc = 2
  852.     local h = math.floor(os.time()/1000%86400/60/60) + utc
  853.     local m = math.floor(os.time()/1000%86400/60%60)
  854.     local s = math.floor(os.time()/1000%86400%60%60)
  855.  
  856.     if h >= 24 then h = h -24 end
  857.     if h < 10 then h = '0'..h end
  858.     if m < 10 then m = '0'..m end
  859.     if s < 10 then s = '0'..s end
  860.     return h..':'..m..':'..s
  861. end
  862.  
  863. ---- licz spacje
  864. function countSpace(nr, text, d, o)
  865.     local xx = nr - string.len(text)
  866.     if d ~= nil then
  867.         xx  = xx/d
  868.     end
  869.     if o ~= nil then
  870.         xx = xx - string.len(o)
  871.     end
  872.     local space = ' '
  873.     for i=2,xx,1 do
  874.         space = space..' '
  875.     end
  876.     return space
  877. end
  878.  
  879. ---- show Help
  880. function showHelp(nick, kx, ky)
  881.     local space = countSpace(48, ' ['..lg.refresh..']['..lg.close..']')
  882.     local text = '<font face="Courier"><font color="#5DB9D8"><a href="event:move 1">≡</a>'..space..'<a href="event:refresh 1">['..lg.refresh..']</a><a href="event:close">['..lg.close..']</a></font></font>\n'..lg.help
  883.     if kx == nil and ky == nil then
  884.         kx, ky = 200, 40
  885.     end
  886.     if module.on == 1 then
  887.         local h = ''
  888.         if modules[module.play].help then
  889.             h = modules[module.play].help
  890.         end
  891.         text = text..'___________________________________________________\n\n<font size="12px"><b>'..lg.minigame..'</b></font> '..modules[module.play].name..'\n\n'..h
  892.     end
  893.     ui.addTextArea(8, text, nick, kx, ky, 400, 300, nil, nil,0.6)
  894.  
  895.  
  896. end
  897.  
  898. ---- Pokaż kolejke map
  899. function showQueue(nick, kx, ky)
  900.     if kx == nil and ky == nil then
  901.         kx, ky = 250, 40
  902.     end
  903.     if settings.queue.on == 0 then
  904.         kolejka = '<font color="#EB1D51">'..lg.disabled..'</font>'
  905.     else
  906.         kolejka = '<VP>'..lg.enabled
  907.     end
  908.     local space = countSpace(38, ' ['..lg.refresh..']['..lg.close..']')
  909.     local napis = '<font face="Courier"><font color="#ED67EA"><a href="event:move 1">≡</a>'..space..'<a href="event:refresh 1">['..lg.refresh..']</a><a href="event:close">['..lg.close..']</a></font>\n'
  910.     napis = napis..'<p align="center"><font  size="20px" color="#ffffff">'..lg.maps_queue..'</font></p>'..lg.queuing..' '..kolejka..'\n<n>'..lg.played..' <j>'..mapNumber..'<n> '..lg.maps2..'\n'
  911.     local x = 1
  912.     for key,val in pairs(maps) do
  913.         if key > mapNumber then
  914.             local space = countSpace(37,x..'. '..maps[key].name..' - '..maps[key].nick..'['..lg.delete..']')           
  915.             napis = napis..'<n>'..x..'. <vp>'..maps[key].name..'<n> - <t>'..maps[key].nick..space..'<a href="event:delmap '..key..'"><font color="#CB546B">['..lg.delete..']</font></a>\n'
  916.             x = x+1
  917.         end
  918.     end
  919.     ui.addTextArea(1, napis, nick, kx, ky, 300, 300, nil, nil,0.6)
  920. end
  921.  
  922. ---- pokaż opcje
  923. function options(nick, kx, ky)
  924.     if kx == nil and ky == nil then
  925.         kx, ky = 10, 40
  926.     end
  927.     local adm = ' '
  928.     local add = ' '
  929.     for key,val in pairs(admins) do
  930.         adm = adm..'<font color="#BABD2F">'..val..'</font>, '
  931.         add = add..val..', '
  932.     end
  933.     local space = countSpace(96 , ' ['..lg.refresh..']['..lg.close..']')
  934.     local space2 = countSpace(95 , lg.admins..':'..add..'  - '..lg.enabled..'    - '..lg.disabled)
  935.     local text = [[<font face="Courier"><a href="event:move 6"></a>]]..space..[[<a href="event:refresh3">[]]..lg.refresh..[[]</a><a href="event:close">[]]..lg.close..[[]</a></font>
  936. <p align="center"><font size="19px">]]..lg.settings..[[</font></p>]]..[[
  937.  
  938. <font face="Courier">]]..lg.admins..[[:]]..adm..space2..[[<font color="#40B033">- ]]..lg.enabled..[[</font>  <font color="#E33D3D">- ]]..lg.disabled..[[</font></font>
  939. ]]
  940.     local color
  941.     x = 1
  942.     for key,val in spairs(settings) do
  943.         local onOff
  944.         if val.on == 1 then
  945.             color  = '#40B033'
  946.             onOff = '[<a href="event:set off '..key..'"><font color="#E33D3D">'..lg.enable..'</font></a>]'
  947.         else
  948.             color  = '#E33D3D'
  949.             onOff = '[<a href="event:set on '..key..'"><font color="#40B033">'..lg.disable..'</font></a>]'
  950.         end
  951.         if not isAdmin(nick) then onOff = ''end
  952.         local line = onOff..' <font color="'..color..'">'..key..'</font>  - '..val.des..'\n'
  953.        
  954.         text = text..line
  955.        
  956.         x = x+1
  957.     end
  958.     text = text..'\n<font color="#ED67EA"><a href="event:stat_reset">['..lg.reset_settings..']</a></font>'
  959.     ui.addTextArea(6, text, nick, kx, ky, 780, 335, 0x424C6B, nil,0.7)
  960. end
  961.  
  962. ---- pokaż liste komend
  963. function showCmd(nick, kx, ky)
  964.     if kx == nil and ky == nil then
  965.         kx, ky = 10, 40
  966.     end
  967.     local adm = ' '
  968.     local add = ' '
  969.     for key,val in pairs(admins) do
  970.         adm = adm..'<font color="#BABD2F">'..val..'</font>, '
  971.         add = add..val..', '
  972.     end
  973.    
  974.     local space = countSpace(96 , ' ['..lg.refresh..']['..lg.close..']')
  975.     local space2 = countSpace(96 , lg.admins..': '..add..'  - '..lg.enabled..'    - '..lg.disabled..'  * - '..lg.for_admins)
  976.     local text = [[<font face="Courier"><a href="event:move 3"></a>]]..space..[[<a href="event:refresh3"><font color="">[]]..lg.refresh..[[]</font></a><a href="event:close"><font color="">[]]..lg.close..[[]</font></a>
  977. <p align="center"><font size="19px">]]..lg.commands..[[</font></p>]]..lg.admins..[[:]]..adm..space2..[[<font color="#40B033">- ]]..lg.enabled..[[</font>  <font color="#E33D3D">- ]]..lg.disabled..[[</font>  <font color="#B32EAA">* - ]]..lg.for_admins..[[</font></font>]]
  978.     local text1 = '<font face="Courier">'
  979.     local text2 = '<font face="Courier">'
  980.     local color
  981.     x = 1
  982.     for key,val in spairs(commands) do
  983.         local arg = ''
  984.         local arg2 = ''
  985.         local star = ' '
  986.         for i=1, val.arg, 1 do
  987.             arg = arg..'&lt;arg'..i..'> '
  988.         end
  989.         if val.arg2 ~= nil then
  990.             for i=1, val.arg2 - val.arg, 1 do  
  991.                 arg2 = arg2..'[arg'..i..'] '
  992.         end end
  993.         if val.admin == 1 then
  994.             star = '<font color="#B32EAA">*</font>'
  995.         end
  996.         if val.on == 1 then
  997.             color  = '#40B033'
  998.         else
  999.             color  = '#E33D3D'
  1000.         end
  1001.         local line = star..'<font color="'..color..'">!'..key..' '..arg..arg2..'- '..val.des..'</font>\n'
  1002.         if string.len('!'..key..arg..arg2..' - '..val.des) > 47 then
  1003.             x = x+1
  1004.         end
  1005.         if x>22 then
  1006.             text2 = text2..line
  1007.         else   
  1008.             text1 = text1..line
  1009.         end
  1010.         x = x+1
  1011.     end
  1012.     text1 = text1..'</font>'
  1013.     text2 = text2..'</font>'
  1014.  
  1015.     ui.addTextArea(3, text, nick, kx, ky, 780, 335, 0x424C6B, nil,0.9)
  1016.     ui.addTextArea(4, text1, nick, kx, ky+45, 385, 305, 0x000000, nil,0.6)
  1017.     ui.addTextArea(5, text2, nick, kx+395, ky+45, 385, 305, 0x000000, nil,0.6)
  1018. end
  1019.  
  1020. -- pokaż minigry
  1021. function showModules(nick, kx, ky)
  1022.     if kx == nil and ky == nil then
  1023.         kx, ky = 200, 40
  1024.     end
  1025.     local space = countSpace(49 , '  ['..lg.close..']')
  1026.     local text = [[<font face="Courier"><a href="event:move 7"></a>]]..space..[[<a href="event:close">[]]..lg.close..[[]</a></font>
  1027. <font size="19px"><p align="center">]]..lg.minigames..[[</p></font>
  1028. <font color="#BABD2F">]]..lg.module_stop..[[</font>
  1029.  
  1030.  
  1031. ]]
  1032.     local color
  1033.     x = 1
  1034.     for key,val in spairs(modules) do
  1035.         local author = ''
  1036.         if modules[key].author then
  1037.             author = ' by '..modules[key].author
  1038.         end
  1039.         text = text..'<font color="#40B033"><a href="event:module '..key..'">!module '..key..'</a></font> - '..modules[key].name..author..'\n'
  1040.     end
  1041.     ui.addTextArea(7, text, nick, kx, ky, 400, 335, 0x424C6B, nil, 0.7)
  1042. end
  1043.  
  1044. --
  1045. function modulePlay(nick, name)
  1046.     if commands.module.admin > 0 then
  1047.         if not isAdmin(nick) then
  1048.             return
  1049.         end
  1050.     end
  1051.     module.on = 1
  1052.     module.play = name
  1053.     message('all', lg.minigame..': '..modules[name].name, 'blue')
  1054.     if modules[name].func then
  1055.         modules[name]:func(args)
  1056.     end
  1057.  
  1058. end
  1059.  
  1060. -------- EVENTS --------
  1061. -- nowy gracz
  1062. function eventNewPlayer(nick)
  1063.     if module.on == 1 then
  1064.         -- modules on
  1065.         if modules[module.play].eventNewPlayer then
  1066.             modules[module.play]:eventNewPlayer(nick)
  1067.         end
  1068.     else
  1069.         -- modules off
  1070.        
  1071.     end
  1072.     -- rest
  1073.     ui.addTextArea(0, ' ', nick, 10, 30, 1, 1, 0x56F73D, 0x56F73D, 0.5)
  1074.     system.bindMouse(nick,true)
  1075.     for key,val in pairs({27, 72, 73, 77, 79}) do
  1076.         tfm.exec.bindKeyboard(nick,val,true,true)
  1077.     end
  1078.     for key,val in pairs({72, 73, 77}) do
  1079.         tfm.exec.bindKeyboard(nick,val,false,true)
  1080.     end
  1081.    
  1082. end
  1083.  
  1084.  
  1085.  
  1086. -- eventPlayerDied
  1087. function eventPlayerDied(nick)
  1088.     if module.on == 1 then
  1089.         -- modules on
  1090.         if modules[module.play].eventPlayerDied then
  1091.             modules[module.play]:eventPlayerDied(nick)
  1092.         end
  1093.     else
  1094.         -- modules off
  1095.        
  1096.     end
  1097.     if settings.autorespawn.on == 1 or house ~= nil then
  1098.         tfm.exec.respawnPlayer(nick)
  1099.     end
  1100. end
  1101.  
  1102. -- eventPlayerWon(String playerName)
  1103. function eventPlayerWon(nick)
  1104.     if module.on == 1 then
  1105.         -- modules on
  1106.         if modules[module.play].eventPlayerWon then
  1107.             modules[module.play]:eventPlayerWon(nick)
  1108.         end
  1109.     else
  1110.         -- modules off
  1111.        
  1112.     end
  1113.     if house ~= nil then
  1114.         tfm.exec.respawnPlayer(nick)
  1115.     end
  1116. end
  1117.  
  1118. ---- pętla
  1119. function eventLoop(t1, t2)
  1120.     if module.on == 1 then
  1121.         -- modules on
  1122.         if modules[module.play].eventLoop then
  1123.             modules[module.play]:eventLoop(t1, t2)
  1124.         end
  1125.     else
  1126.         -- modules off
  1127.        
  1128.     end
  1129.     if wait ~= 0 then
  1130.         wait = wait -1
  1131.     end
  1132.     -- queue on, nowa mapa
  1133.     if settings.queue.on == 1 and #maps > mapNumber and t2 < t1 and wait == 0 then
  1134.         mapNumber = mapNumber +1
  1135.         if not tfm.exec.newGame(maps[mapNumber].code) then
  1136.             wait = 6
  1137.         end
  1138.     -- wszyscy martwi
  1139.     elseif settings.queue.on == 1 and wait == 0 then
  1140.         local dead = 1
  1141.         for key,val in pairs(tfm.get.room.playerList) do
  1142.             if not tfm.get.room.playerList[key].isDead then
  1143.                 dead = 0
  1144.                 break
  1145.             end
  1146.         end
  1147.         if dead == 1 then
  1148.             if #maps > mapNumber then
  1149.                 mapNumber = mapNumber +1
  1150.                 if not tfm.exec.newGame(maps[mapNumber].code) then
  1151.                     wait = 6
  1152.                 end
  1153.             else
  1154.                 tfm.exec.newGame(0)
  1155.             end
  1156.         end
  1157.     end
  1158.     -- komunikaty
  1159.     for key,val in pairs(timer) do
  1160.         if timer[key].tim == 0 then
  1161.             timer[key].make()
  1162.         else
  1163.             timer[key].tim = timer[key].tim - 1
  1164.         end
  1165.     end
  1166.     -- auto teleportacja
  1167.     for key,val in pairs(playerPosition) do
  1168.         local x = playerPosition[key].x
  1169.         local y = playerPosition[key].y
  1170.         tfm.exec.movePlayer(key, x, y, 0, -1,-1)
  1171.     end
  1172.     -- piesek
  1173.     for key,val in pairs(pet) do   
  1174.         local x = tfm.get.room.playerList[val].x
  1175.         local y = tfm.get.room.playerList[val].y
  1176.         tfm.exec.movePlayer(key, x, y, 0, -1,-1)
  1177.     end
  1178. end
  1179.  
  1180. -- klawiatura
  1181. function eventKeyboard(nick ,key ,down ,x ,y)
  1182.     if module.on == 1 then
  1183.         -- modules on
  1184.         if modules[module.play].eventKeyboard then
  1185.             modules[module.play]:eventKeyboard(nick ,key ,down ,x ,y)
  1186.         end
  1187.     else
  1188.         -- modules off
  1189.        
  1190.     end
  1191.     -- esc
  1192.     if key == 27 then
  1193.         for i=1, 10, 1 do
  1194.             ui.removeTextArea(i, nick)
  1195.         end
  1196.     -- m - modules
  1197.     elseif key == 77 then
  1198.         if down then
  1199.             showModules(nick)
  1200.         else
  1201.             ui.removeTextArea(7, nick)
  1202.         end
  1203.     -- o - opcje
  1204.     elseif key == 79 then
  1205.         options(nick)
  1206.     -- h - help
  1207.     elseif key == 72 then
  1208.         if down then
  1209.             showHelp(nick)
  1210.         else
  1211.             ui.removeTextArea(8, nick)
  1212.         end
  1213.     elseif key == 73 then
  1214.         if down then
  1215.             showCmd(nick)
  1216.         else
  1217.             ui.removeTextArea(3, nick)
  1218.             ui.removeTextArea(4, nick)
  1219.             ui.removeTextArea(5, nick) 
  1220.         end
  1221.     end
  1222. end
  1223.  
  1224. ---- kliknięcie
  1225. function eventMouse(nick, x, y)  
  1226.     if module.on == 1 then
  1227.         -- modules on
  1228.         if modules[module.play].eventMouse then
  1229.             modules[module.play]:eventMouse(nick, x, y)
  1230.         end
  1231.     else
  1232.         -- modules off
  1233.        
  1234.     end
  1235.     -- przenoszenie menu
  1236.     if move[nick] ~= nil then
  1237.         if move[nick] == 6 then
  1238.             options(nick, x-8, y-8)
  1239.         elseif move[nick] ==  1 then
  1240.             showQueue(nick, x-8, y-8)
  1241.         elseif move[nick] == 3 then
  1242.             showCmd(nick, x-8, y-8)
  1243.         elseif move[nick] == 8 then
  1244.             showHelp(nick, x-8, y-8)
  1245.         elseif move[nick] == 7 then
  1246.             showModules(nick, x-8, y-8)
  1247.         end
  1248.         move[nick] = nil
  1249.     else
  1250.         -- tp
  1251.         for key,val in pairs(tp) do
  1252.             if key == nick then
  1253.                 tpp[key] = nil
  1254.                 playerPosition[key] = nil
  1255.                 tfm.exec.movePlayer(val, x, y, 0, -1,-1)
  1256.                 break
  1257.             end
  1258.         end
  1259.         -- tpp
  1260.         for key,val in pairs(tpp) do
  1261.             if key == nick then
  1262.                 playerPosition[val] = {}
  1263.                 playerPosition[val].x = x
  1264.                 playerPosition[val].y = y
  1265.                 break
  1266.             end
  1267.         end
  1268.     end
  1269. end
  1270. function name(i, nick)
  1271.     if #args < (i+1) then
  1272.         return nick
  1273.     else
  1274.         return args[i+1]
  1275.     end
  1276. end
  1277. ---- !komendy
  1278. function eventChatCommand(nick, msg)
  1279.     if module.on == 1 then
  1280.         -- modules on
  1281.         if modules[module.play].eventChatCommand then
  1282.             modules[module.play]:eventChatCommand(nick, msg)
  1283.         end
  1284.     else
  1285.         -- modules off
  1286.        
  1287.     end
  1288.     -- log
  1289.     Log = '['..time()..'] '..nick..' - !'..msg..'\n'..Log
  1290.     -- dzielenie argumentów
  1291.     local args={}
  1292.     for arg in msg:gmatch("[^%s]+") do
  1293.         table.insert(args,arg)
  1294.     end
  1295.     rest = msg:match("%s(.*)") or ""
  1296.     -- wyłączenie dostępu dla tych z banem
  1297.     for key,val in pairs(ban) do
  1298.         for k,v in pairs(superAdmin) do
  1299.             if key == nick and val == true and nick ~= v then
  1300.                 message(nick, lg.banned, 'red')
  1301.                 return false
  1302.             end
  1303.         end
  1304.     end
  1305.     function name(i)
  1306.         if #args < (i+1) then
  1307.             return nick
  1308.         else
  1309.             return args[i+1]
  1310.         end
  1311.     end
  1312.     -------------
  1313.     cmd(args[1], args, nick)
  1314.    
  1315. end
  1316.  
  1317. ---- odwołania z <a>
  1318. function eventTextAreaCallback(id, nick, callback)
  1319.     if module.on == 1 then
  1320.         -- modules on
  1321.         if modules[module.play].eventTextAreaCallback then
  1322.             modules[module.play]:eventTextAreaCallback(id, nick, callback)
  1323.         end
  1324.     else
  1325.         -- modules off
  1326.        
  1327.     end
  1328.     local args={}
  1329.     for arg in callback:gmatch("[^%s]+") do
  1330.         table.insert(args,arg)
  1331.     end
  1332.     -- zamykanie
  1333.     if callback == 'close' then
  1334.         if id == 3 then
  1335.             ui.removeTextArea(3, nick)
  1336.             ui.removeTextArea(4, nick)
  1337.             ui.removeTextArea(5, nick)
  1338.         else
  1339.             ui.removeTextArea(id, nick)
  1340.         end
  1341.     -- odświeżanie
  1342.     elseif args[1] == 'refresh' then
  1343.         if id == 1 then
  1344.             showQueue(nick)
  1345.         elseif id == 6 then
  1346.             options(nick)
  1347.         end
  1348.     -- ustawienia
  1349.     elseif args[1] == 'set' then
  1350.         if args[2] ==  'on' then
  1351.             settings[args[3]].on = 1
  1352.             settings[args[3]].fOn()
  1353.         else
  1354.             settings[args[3]].on = 0
  1355.             settings[args[3]].fOff()
  1356.         end
  1357.         options(nick)
  1358.     -- przenoszenie textarea
  1359.     elseif args[1] == 'move' then
  1360.         move[nick] = id
  1361.     -- resetowanie ustawień
  1362.     elseif args[1] == 'stat_reset' then
  1363.         for key,val in pairs(settings) do
  1364.             settings[key].on = settings[key].def
  1365.         end
  1366.         options(nick)
  1367.     -- !maps usuwanie
  1368.     elseif args[1] == 'delmap' then
  1369.         if isAdmin(nick) then
  1370.             table.remove(maps, args[2])
  1371.             showQueue(nick)
  1372.         end
  1373.     -- moduły
  1374.     elseif args[1] == 'module' then
  1375.         modulePlay(nick, args[2])  
  1376.     end
  1377. end
  1378.  
  1379. function eventEmotePlayed(nick, emoteId)
  1380.     if module.on == 1 then
  1381.         -- modules on
  1382.         if modules[module.play].eventEmotePlayed then
  1383.             modules[module.play]:eventEmotePlayed(nick, emoteId)
  1384.         end
  1385.     else
  1386.         -- modules off
  1387.        
  1388.     end
  1389. end
  1390.  
  1391. function eventPlayerGetCheese(nick)
  1392.     if module.on == 1 then
  1393.         -- modules on
  1394.         if modules[module.play].eventPlayerGetCheese then
  1395.             modules[module.play]:eventPlayerGetCheese(nick)
  1396.         end
  1397.     else
  1398.         -- modules off
  1399.        
  1400.     end
  1401. end
  1402.  
  1403. function eventPlayerLeft(nick)
  1404.     if module.on == 1 then
  1405.         -- modules on
  1406.         if modules[module.play].eventPlayerLeft then
  1407.             modules[module.play]:eventPlayerLeft(nick)
  1408.         end
  1409.     else
  1410.         -- modules off
  1411.        
  1412.     end
  1413. end
  1414.  
  1415. function eventPlayerVampire(nick)
  1416.     if module.on == 1 then
  1417.         -- modules on
  1418.         if modules[module.play].eventPlayerVampire then
  1419.             modules[module.play]:eventPlayerVampire(nick)
  1420.         end
  1421.     else
  1422.         -- modules off
  1423.        
  1424.     end
  1425. end
  1426.  
  1427. function eventPlayerWon(nick)
  1428.     if module.on == 1 then
  1429.         -- modules on
  1430.         if modules[module.play].eventPlayerWon then
  1431.             modules[module.play]:eventPlayerWon(nick)
  1432.         end
  1433.     else
  1434.         -- modules off
  1435.        
  1436.     end
  1437. end
  1438.  
  1439. function eventPlayerRespawn(nick)
  1440.     if module.on == 1 then
  1441.         -- modules on
  1442.         if modules[module.play].eventPlayerRespawn then
  1443.             modules[module.play]:eventPlayerRespawn(nick)
  1444.         end
  1445.     else
  1446.         -- modules off
  1447.        
  1448.     end
  1449. end
  1450.  
  1451. function eventPopupAnswer(id, nick, answer)
  1452.     if module.on == 1 then
  1453.         -- modules on
  1454.         if modules[module.play].eventPopupAnswer then
  1455.             modules[module.play]:eventPopupAnswer(id, nick, answer)
  1456.         end
  1457.     else
  1458.         -- modules off
  1459.        
  1460.     end
  1461. end
  1462.  
  1463. function eventSummoningStart(nick, objectType, x, y, angle)
  1464.     if module.on == 1 then
  1465.         -- modules on
  1466.         if modules[module.play].eventSummoningStart then
  1467.             modules[module.play]:eventSummoningStart(nick, objectType, x, y, angle)
  1468.         end
  1469.     else
  1470.         -- modules off
  1471.        
  1472.     end
  1473. end
  1474.  
  1475. function eventSummoningCancel(nick)
  1476.     if module.on == 1 then
  1477.         -- modules on
  1478.         if modules[module.play].eventSummoningCancel then
  1479.             modules[module.play]:eventSummoningCancel(nick)
  1480.         end
  1481.     else
  1482.         -- modules off
  1483.        
  1484.     end
  1485. end
  1486.  
  1487. function eventSummoningEnd(nick, objectType, x, y, angle, xSpeed, ySpeed, objectType, other)
  1488.     if module.on == 1 then
  1489.         -- modules on
  1490.         if modules[module.play].eventSummoningEnd then
  1491.             modules[module.play]:eventSummoningEnd(nick, objectType, x, y, angle, xSpeed, ySpeed, objectType, other)
  1492.         end
  1493.     else
  1494.         -- modules off
  1495.        
  1496.     end
  1497. end
  1498.  
  1499. function eventNewGame()
  1500.     if module.on == 1 then
  1501.         -- modules on
  1502.         if modules[module.play].eventNewGame then
  1503.             modules[module.play]:eventNewGame()
  1504.         end
  1505.     else
  1506.         -- modules off
  1507.        
  1508.     end
  1509. end
  1510.  
  1511. -- wyłączenie widzialności komend
  1512. for k,v in pairs(commands) do
  1513. system.disableChatCommandDisplay(k, true)
  1514. end
  1515.  
  1516. -- wymuszenie nowego gracza
  1517. for playername,player in pairs(tfm.get.room.playerList) do
  1518.    eventNewPlayer(playername)
  1519. end
  1520.  
  1521. print 'Ultimate Tribe House Script loaded'
  1522.  
  1523. ---- koniec skryptu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement