Advertisement
Szel

UTHS_en

Oct 22nd, 2013
2,754
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 60.39 KB | None | 0 0
  1. ------------------
  2. -- UTHS by Szel --
  3. -- version 1.3  --
  4. ------------------
  5.  
  6. ---- CHANGE IT/ ZMIEŃ TO:
  7. superAdmin = {'nick1'}
  8. admins = {'nick1', 'nick2'}
  9. language = 'en' -- 'en' or 'pl'
  10.  
  11. -- cd. nie ruszać
  12. version = '1.3'
  13. lang = {}
  14. lang.en = {
  15.     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:
  16.     !cmd - shows commands
  17.     !set - shows settings
  18.     !help - shows help
  19. Hotkeys:
  20.     h - shows help
  21.     Esc - closes window
  22.     i - shows commands
  23.     o - shows settings
  24.     m - shows minigames
  25. ]],
  26.     disabled = 'disabled',
  27.     enabled = 'enabled',
  28.     disable = 'disable',
  29.     enable = 'enable',
  30.     refresh = 'refresh',
  31.     close = 'close',
  32.     minigames = 'Minigames',
  33.     minigame = 'Minigame',
  34.     module_stop = '!module stop - to turn off minigame',
  35.  
  36.     maps_queue = 'Maps queue',
  37.     queuing = 'Queuing',
  38.     played = 'played',
  39.     maps2 = 'maps',
  40.     delete = 'delete',
  41.     admins = 'Admins',
  42.     reset_settings = 'reset settings',
  43.     settings = 'Settings',
  44.     commands = 'Commands',
  45.     for_admins = 'for admins',
  46.     banned = 'You are banned',
  47.    
  48.     module_des = 'shows list of minigames',
  49.     made_des = 'new commend',
  50.     kill_des = 'kills',
  51.     ice_des = 'freezes',
  52.     sham_des = 'gives shaman',
  53.     ch_des = 'gives cheese',
  54.     tp_des = 'teleport',
  55.     utp_des = 'diesables teleport, [unglue player]',
  56.     tpp_des = 'teleport with glue',
  57.     ro_des = 'removes all objects',
  58.     meep_des = 'gives meep',
  59.     ban_des = 'disables commands for <name>',
  60.     unban_des = 'enables commands for <name>',
  61.     admin_des = 'gives admin rank',
  62.     unadmin_des = 'withdraws admin rank',
  63.     score_des = 'sets <player> score',
  64.     mapname_des = 'changes map name',
  65.     shamname_des = 'changes shaman name',
  66.     respawn_des = 'respawns',
  67.     autorespawn_des = 'on/off autorespawn',
  68.     color_des = 'sets nickname color',
  69.     queue_des = 'on/off maps queuing',
  70.     maps_des = 'shows maps queue',
  71.     np_des = 'plays map',
  72.     npp_des = 'adds map to queue',
  73.     mort_des = 'kill yourself',
  74.     off_des = 'disables command',
  75.     on_des = 'enables command',
  76.     cmd_des = 'shows commands list',
  77.     pet_des = 'converts <name> into pet',
  78.     unpet = 'withdraws !pet',
  79.     set_des = 'shows settings lists',
  80.     xml_des = 'plays map from xml code',
  81.     house_des = 'sets tribe house',
  82.     help_des = 'shows help',
  83.     vampire_des = 'turns into vampire',
  84.     log_des = 'shows !commands log',
  85.     queue_set = 'maps queuing',
  86.     autorespawn_set = 'auto respwan',
  87.     autoTimeLeft_set = 'automatic time change',
  88.     afk_set = 'AFK death',
  89.     autoNewGame_set = 'auto map change',
  90.     autoScore_set = 'auto score',
  91.     autoShaman_set = 'automatic selection of Shaman',
  92.     shamanSkills_set = 'shaman skills',
  93.     settime_des = 'sets game time',
  94.     snow_des = 'toggles snow',
  95.     _des = '',
  96.     _des = '',
  97.     _des = '',
  98.  
  99. }
  100. lang.pl = {
  101.     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:
  102.     !cmd - wszystkie komendy
  103.     !set - ustawienia
  104.     !help - pomoc
  105. Skróty klawiszowe:
  106.     h - help
  107.     Esc - zamyka okna
  108.     i - komendy
  109.     o - opcje
  110.     m - minigry
  111. ]],
  112.     disabled = 'wyłączone',
  113.     enabled = 'włączone',
  114.     disable = 'wyłącz',
  115.     enable = 'włącz  ',
  116.     refresh = 'odśwież',
  117.     close = 'zamknij',
  118.     minigame = 'Minigra',
  119.     minigames = 'Minigry',
  120.     module_stop = '!module stop - żeby wyłączyć minigre',
  121.  
  122.     maps_queue = 'Kolejka map',
  123.     queuing = 'Kolejkowanie',
  124.     played = 'Zagrano',
  125.     maps2 = 'map',
  126.     delete = 'usuń',
  127.     admins = 'Admini',
  128.     reset_settings = 'resetuj ustawienia',
  129.     settings = 'Ustawienia',
  130.     commands = 'Komendy',
  131.     for_admins = 'dla adminów',
  132.     banned = 'Masz bana',
  133.     a = '',
  134.     a = '',
  135.    
  136.     module_des = 'włącza minigrę',
  137.     made_des = 'nowa komenda',
  138.     kill_des = 'zabija',
  139.     ice_des = 'zamraża',
  140.     sham_des = 'daje szamana',
  141.     ch_des = 'daje ser',
  142.     tp_des = 'teleportuje',
  143.     utp_des = 'wyłącza teleportacje, [odkleja gracza]',
  144.     tpp_des = 'teleportuje i przykleja',
  145.     ro_des = 'usuwa wszystkie objekty',
  146.     meep_des = 'daje meep',
  147.     ban_des = 'wyłącza komendy dla <nick>',
  148.     unban_des = 'włącza komendy dla <nick>',
  149.     admin_des = 'daje admina',
  150.     unadmin_des = 'zabiera admina',
  151.     score_des = 'ustawia wynik',
  152.     mapname_des = 'zmienia nazwe mapy',
  153.     shamname_des = 'zmienia nazwe szamana',
  154.     respawn_des = 'odradza',
  155.     autorespawn_des = 'włącza/wyłącza automatyczne odradzanie',
  156.     datl_des = 'włącza/wyłącza czas',
  157.     color_des = 'Ustawia kolor nicka',
  158.     queue_des = 'włącza/wyłącza kolejkowanie map',
  159.     maps_des = 'pokazuje kolejke map',
  160.     np_des = 'włacza mape',
  161.     npp_des = 'dodaje mape do kolejki',
  162.     mort_des = 'zabija gracza',
  163.     off_des = 'wyłacza komende',
  164.     on_des = 'włącza komende',
  165.     cmd_des = 'pokazuje spis komend',
  166.     pet_des = 'zamienia <arg1> w zwierzątko',
  167.     unpet = 'wyłącza !pet',
  168.     set_des = 'pokazuje ustawienia',
  169.     xml_des = 'ładuje mapę z kodu XML',
  170.     house_des = 'ustawia chatkę plemienną',
  171.     help_des = 'pomoc',
  172.     vampire_des = 'zamienia w wampira',
  173.     log_des = 'pokazuje log !komend',
  174.     queue_set = 'kolejkowanie map',
  175.     autorespawn_set = 'automatyczne odradzanie',
  176.     autoTimeLeft_set = 'autoTimeLeft',
  177.     afk_set = 'śmiereć AFK',
  178.     autoNewGame_set = 'automatyczna zmiana map',
  179.     autoScore_set = 'automatyczne punkty',
  180.     autoShaman_set = 'atomatyczne wybieranie szamana',
  181.     shamanSkills_set = 'dodatkowe umiejętności szamana',
  182.     settime_des = 'ustaw czas',
  183.     snow_des = 'włącza śnieg',
  184.     _des = '',
  185.     _des = '',
  186.     _des = '',
  187.  
  188. }
  189. lg = lang[language]
  190. mapNumber = 0
  191. wait = 0
  192. Log = '\n'
  193. tp = {}
  194. tpp = {}          
  195. playerPosition = {}
  196. ban = {}
  197. maps = {}
  198. ob = {}
  199. timer = {}
  200. pet = {}
  201. move = {}
  202. xml = {}
  203. vote = {}
  204.  
  205. commands = {
  206.     kill = {on = 1, admin = 1, arg = 0, arg2 = 1, des = lg.kill_des, func = function(nick, args)
  207.         tfm.exec.killPlayer(name(1))
  208.     end},
  209.     ice = {on = 1, admin = 1, arg = 1, des = lg.ice_des, func = function(nick, args)
  210.         if tfm.get.room.playerList[args[2]] then
  211.             local y = tfm.get.room.playerList[args[2]].y
  212.             local x = tfm.get.room.playerList[args[2]].x
  213.             tfm.exec.addShamanObject(54, x, y, 0, 0, 0, false)
  214.             tfm.exec.killPlayer(args[2])
  215.         end
  216.     end},
  217.     sham = {on = 1, admin = 1, arg = 0, arg2 = 1, des = lg.sham_des, func = function(nick, args)
  218.         tfm.exec.setShaman(name(1))
  219.     end},
  220.     ch = {on = 1, admin = 1, arg = 0, arg2 = 1, des = lg.ch_des, func = function(nick, args)
  221.         tfm.exec.giveCheese(name(1))
  222.     end},
  223.     tp = {on = 1, admin = 1, arg = 0, arg2 = 1, des = lg.tp_des, func = function(nick, args)
  224.         system.bindMouse(nick,true)
  225.         tpp[nick] = nil
  226.         tp[nick] = args[2] 
  227.     end},
  228.     tpp = {on = 1, admin = 1, arg = 0, arg = 1, des = lg.tpp_des, func = function(nick, args)
  229.         system.bindMouse(nick,true)
  230.         tp[nick] = nil
  231.         tpp[nick] = args[2]
  232.     end},
  233.     utp = {on = 1, admin = 1, arg = 0, arg2 = 1, des = lg.utp_des, func = function(nick, args)
  234.         playerPosition[name(1)] = nil
  235.         tpp[nick] = nil
  236.         tp[nick] = nil
  237.         playerPosition[nick] = nil
  238.     end},
  239.     ro = {on = 1, admin = 1, arg = 0, des = lg.ro_des, func = function(nick, args)
  240.         for key,val in pairs(tfm.get.room.objectList) do
  241.             table.insert(ob, key)
  242.         end
  243.         for key,val in pairs(ob) do
  244.             tfm.exec.removeObject(val)
  245.         end
  246.         ob = {}
  247.     end},
  248.     meep = {on = 1, admin = 1, arg = 1, des = lg.meep_des, func = function(nick, args)
  249.         tfm.exec.giveMeep(args[2])
  250.     end},
  251.     ban = {on = 1, admin = 1, arg = 1, des = lg.ban_des, func = function(nick, args)
  252.         ban[args[2]] = true
  253.     end},
  254.     unban = {on = 1, admin = 1, arg = 1, des = lg.unban_des, func = function(nick, args)
  255.         ban[args[2]] = false
  256.     end},
  257.     admin = {on = 1, admin = 1, arg = 1, des = lg.admin_des, func = function(nick, args)
  258.         table.insert(admins, args[2])
  259.     end},
  260.     unadmin = {on = 1, admin = 2, arg = 1, des = lg.unadmin_des, func = function(nick, args)
  261.         for i=1,#admins,1 do
  262.             if admins[i] == args[2] then
  263.                 table.remove(admins, i)
  264.             end
  265.         end
  266.     end},
  267.     score = {on = 1, admin = 1, arg = 1, arg2 = 2, des = lg.score_des, func = function(nick, args)
  268.         tfm.exec.setPlayerScore(args[2], args[3], 0)
  269.     end},
  270.     mapname = {on = 1, admin = 1, arg = -1, des = lg.mapname_des, func = function(nick, args)
  271.         tfm.exec.setUIMapName(bbcode(rest))
  272.     end},
  273.     shamname = {on = 1, admin = 1, arg = -1, des = lg.shamname_des, func = function(nick, args)
  274.         tfm.exec.setUIShamanName(bbcode(rest))
  275.     end},
  276.     respawn = {on = 1, admin = 1, arg = 0, arg2 = 1, des = lg.respawn_des, func = function(nick, args)
  277.         tfm.exec.respawnPlayer(name(1))
  278.     end},
  279.     autorespawn = {on = 1, admin = 1, arg = 1, des = lg.autorespawn_des, func = function(nick, args)
  280.         if args[2] == 'off' then
  281.             settings.autorespawn.on = 0
  282.         else   
  283.             settings.autorespawn.on = 1
  284.         end
  285.     end},
  286.     color = {on = 1, admin = 1, arg = 1, arg = 2, des = lg.color_des, func = function(nick, args)
  287.         tfm.exec.setNameColor(args[2],'0x'..args[3])
  288.     end},
  289.     queue = {on = 1, admin = 1, arg = 1, des = lg.queue_des, func = function(nick, args)
  290.         if args[2] == 'off' then
  291.             settings.queue.on = 0
  292.             tfm.exec.disableAutoNewGame(false)
  293.         else
  294.             settings.queue.on = 1
  295.             tfm.exec.disableAutoNewGame(true)
  296.             message('all', 'Włączono kolejkowanie', 'green')
  297.         end
  298.     end},
  299.     maps = {on = 1, admin = 0, arg = 0, des = lg.maps_des, func = function(nick, args)
  300.         showQueue(nick)
  301.     end},
  302.     np = {on = 1, admin = 0, arg = 1, des = lg.np_des, func = function(nick, args)
  303.         tfm.exec.newGame(args[2])
  304.     end},
  305.     npp = {on = 1, admin = 0, arg = 1, des = lg.npp_des, func = function(nick, args)
  306.         if #maps - mapNumber == 17 then
  307.             message(nick, 'Nie możesz dodać więcej map', 'red')
  308.         else
  309.             local code = args[2]
  310.             if args[2] == 'xml' then
  311.                 if not xml[nick] then
  312.                     return false
  313.                 end
  314.                 code = xml[nick].xml
  315.             end
  316.             local mapNr = #maps+1;
  317.             maps[mapNr] = {}
  318.             maps[mapNr].code = code
  319.             maps[mapNr].name = args[2]
  320.             maps[mapNr].nick = nick
  321.         end
  322.     end},
  323.     meep = {on = 1, admin = 0, arg = 0, des = lg.meep_des, func = function(nick, args)
  324.         tfm.exec.giveMeep(nick)
  325.     end},
  326.     mort = {on = 1, admin = 0, arg = 0, des = lg.mort_des, func = function(nick, args)
  327.         tfm.exec.killPlayer(nick)
  328.     end},
  329.     off = {on = 1, admin = 1, arg = 1, des = lg.off_des, func = function(nick, args)
  330.         if args[2] == 'off' or args[2] == 'on' then
  331.        
  332.         elseif not commands[args[2]] then
  333.             message(nick, 'Nie ma takiej komendy', 'red')
  334.         else
  335.             commands[args[2]].on = 0
  336.             message(nick, 'Wyłączono "'..args[2]..'"', 'green')
  337.         end
  338.     end},
  339.     on = {on = 1, admin = 1, arg = 1, des = lg.on_des, func = function(nick, args)
  340.         if not commands[args[2]] then
  341.             message(nick, 'Nie ma takiej komendy', 'red')
  342.         else
  343.             commands[args[2]].on = 1
  344.             message(nick, 'Włączono "'..args[2]..'"', 'green')
  345.         end
  346.     end},
  347.     cmd = {on = 1, admin = 0, arg = 0, des = lg.cmd_des, func = function(nick, args)
  348.         showCmd(nick)
  349.     end},
  350.     pet = {on = 1, admin = 1, arg = 1, des = lg.pet_des, func = function(nick, args)
  351.         pet[args[2]] = nick
  352.     end},
  353.     unpet = {on = 1, admin = 1, arg = 1, des = lg.unpet,func = function(nick, args)
  354.         pet[args[2]] = nil
  355.     end},
  356.     set = {on = 1, admin = 0, arg = 0, des = lg.set_des, func = function(nick, args)
  357.         options(nick)
  358.     end},
  359.     xml = {on = 1, admin = 0, arg = -1, des = lg.xml_des, func = function(nick, args)
  360.         if args[2] == 'start' then
  361.             xml[nick] = {}
  362.             xml[nick].f = 1
  363.             xml[nick].xml = ' '
  364.         elseif args[2] == 'play' then
  365.             if xml[nick] ~= nil then
  366.                 tfm.exec.newGame(xml[nick].xml)    
  367.             end
  368.         elseif xml[nick] ~= nil then
  369.             if xml[nick].f == 1 then
  370.                 xml[nick].xml = string.gsub(rest, "&lt;", "<")
  371.                 xml[nick].f = 0
  372.             else
  373.                 xml[nick].xml = xml[nick].xml..string.gsub(rest, "&lt;", "<")
  374.             end
  375.         end
  376.     end},
  377.     house = {on = 1, admin = 0, arg = 1, des = lg.house_des, func = function(nick, args)
  378.         if args[2] == 'off' then
  379.             house = nil
  380.             tfm.exec.disableAfkDeath(false)
  381.             tfm.exec.disableAutoShaman(false)
  382.             tfm.exec.disableAutoNewGame(false)
  383.         else
  384.             tfm.exec.disableAfkDeath(true)
  385.             tfm.exec.disableAutoShaman(true)
  386.             tfm.exec.disableAutoNewGame(true)
  387.            
  388.             if args[2] == 'xml' then
  389.                 house = xml[nick]
  390.                 tfm.exec.newGame(xml[nick])
  391.             else
  392.                 house = args[2]
  393.                 tfm.exec.newGame(args[2])
  394.             end
  395.            
  396.         end
  397.     end},
  398.     help = {on = 1, admin = 0, arg = 0, des = lg.help_des, func = function(nick, args)
  399.         showHelp(nick)
  400.     end},
  401.     vampire = {on = 1, admin = 0, arg = 0, arg2 = 1, des = lg.vampire_des, func = function(nick, args)
  402.         tfm.exec.setVampirePlayer(name(1)) 
  403.     end},
  404.     log = {on = 1, admin = 2, arg = 0, arg2 = 0, des = lg.log_des, func = function(nick, args)
  405.         ui.addTextArea(3,  Log:sub(1, 2000), nick, 250, 40, 300, 335, nil, nil,0.7)
  406.     end},
  407.     module = {on = 1, admin = 0, arg = 0, arg2 = 1, des = lg.module_des, func = function(nick, args)
  408.         if not args[2] then
  409.             showModules(nick)
  410.         elseif module.on == 1 and (args[2] == 'stop' or args[2] == 'off')and isAdmin(nick) then
  411.             if modules[module.play].off then
  412.                 modules[module.play]:off(args)
  413.             end
  414.             module.on = 0
  415.             module.play = ''
  416.         elseif isAdmin(nick) and modules[args[2]] then
  417.             modulePlay(nick, args[2])
  418.         end
  419.     end},
  420.     settime = {on = 1, admin = 1, arg = 1, des = lg.settime_des, func = function(nick, args)
  421.         tfm.exec.setGameTime(args[2])  
  422.     end},
  423.     snow = {on = 1, admin = 1, arg = 0, des = lg.snow_des, func = function(nick, args)
  424.         tfm.exec.snow()
  425.     end},
  426.  
  427.     -- own commands / własne komendy
  428.    
  429.  
  430.    
  431.     -- end of own commands / koniec własnych komend   
  432. }
  433.  
  434. settings = {
  435.     queue = {on = 0, def = 0,
  436.         des = lg.queue_set,
  437.         fOn = function() end,
  438.         fOff = function() end},
  439.     autorespawn = {on = 0, def = 0,
  440.         des = lg.autorespawn_set,
  441.         fOn = function() end,
  442.         fOff = function() end},
  443.     autoTimeLeft = {on = 0, def = 0,
  444.         des = lg.autoTimeLeft_set,
  445.         fOn = function() tfm.exec.disableAutoTimeLeft(false) end,
  446.         fOff = function() tfm.exec.disableAutoTimeLeft(true) end},
  447.     afk = {on = 1, def = 0,
  448.         des = lg.afk_set,
  449.         fOn = function() tfm.exec.disableAfkDeath(false) end,
  450.         fOff = function() tfm.exec.disableAfkDeath(true) end},
  451.     autoNewGame = {on = 1, def = 1,
  452.         des = lg.autoNewGame_set,
  453.         fOn = function() tfm.exec.disableAutoNewGame(false) end,
  454.         fOff = function() tfm.exec.disableAutoNewGame(true) end},
  455.     autoScore = {on = 1, def = 1,
  456.         des = lg.autoScore_set,
  457.         fOn = function() tfm.exec.disableAutoScore(false) end,
  458.         fOff = function() tfm.exec.disableAutoScore(true) end},
  459.     autoShaman = {on = 1, def = 1,
  460.         des = lg.autoShaman_set,
  461.         fOn = function() tfm.exec.disableAutoShaman(false) end,
  462.         fOff = function() tfm.exec.disableAutoShaman(true) end},
  463.     shamanSkills = {on = 1, def = 1,
  464.         des = lg.shamanSkills_set,
  465.         fOn = function() tfm.exec.disableAllShamanSkills(false) end,
  466.         fOff = function() tfm.exec.disableAllShamanSkills(true) end},
  467.     -- own settings / własne ustawienia
  468.    
  469.    
  470.    
  471.     -- end of own settings / koniec własnych ustawień        
  472. }
  473.  
  474. -- moduły
  475. module = {on = 0, play = ''}
  476. modules = {
  477.     racing = {name = 'Racing''normal'
  478.             tfm.exec.newGame(self.maps[math.random(#self.maps)])
  479.             tfm.exec.disableAutoNewGame(true)
  480.             tfm.exec.disableAutoShaman(true)
  481.             tfm.exec.disableAutoTimeLeft(true)
  482.         end,
  483.         off = function(self)
  484.             tfm.exec.disableAutoNewGame(false)
  485.             tfm.exec.disableAutoShaman(true)
  486.             tfm.exec.disableAutoTimeLeft(false)
  487.         end,
  488.         eventLoop = function(self, t1, t2)
  489.             if self.mode == 'drunk' then
  490.                 if math.random(5) == 1 then
  491.                     for key,val in pairs(tfm.get.room.playerList) do
  492.                         x = math.random(-50, 50)
  493.                         if x ~= 0 then
  494.                             tfm.exec.movePlayer(key, 0, 0, true, math.random(-50, 50), 0, true)
  495.                         end
  496.                     end
  497.                 end
  498.             end
  499.             if t2<=0 then
  500.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  501.             end
  502.         end,
  503.         eventPlayerWon = function(self, name)
  504.             local i=0
  505.             for k,v in pairs(tfm.get.room.playerList) do
  506.                 if not v.isDead then
  507.                     i=i+1
  508.                 end
  509.             end
  510.             if i==0 then
  511.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  512.             end
  513.         end,
  514.         eventPlayerDied = function(self, name)
  515.             local i=0
  516.             for k,v in pairs(tfm.get.room.playerList) do
  517.                 if not v.isDead then
  518.                     i=i+1
  519.                 end
  520.             end
  521.             if i==0 then
  522.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  523.             end
  524.         end,
  525.         eventChatCommand = function(self, name, msg)
  526.             if msg == 'mode drunk' then
  527.                 self.mode = 'drunk'
  528.             elseif msg == 'mode normal' then
  529.                 self.mode = 'normal'
  530.             end
  531.         end,
  532.         eventNewGame = function(self)
  533.             tfm.exec.setGameTime(63)
  534.         end
  535.     },
  536.     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},
  537.         func = function(self)
  538.             tfm.exec.newGame(self.maps[math.random(#self.maps)])
  539.             tfm.exec.disableAutoNewGame(true)
  540.         end,
  541.         off = function(self)
  542.             tfm.exec.disableAutoNewGame(false)
  543.         end,
  544.         eventLoop = function(self, t1, t2)
  545.             if t2<=0 then
  546.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  547.             end
  548.         end,
  549.         eventPlayerDied = function(self, name)
  550.             local i=0
  551.             for k,v in pairs(tfm.get.room.playerList) do
  552.                 if not v.isDead then
  553.                     i=i+1
  554.                 end
  555.             end
  556.             if i==0 then
  557.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  558.             end
  559.         end,
  560.     },
  561.    
  562.     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},
  563.         func = function(self)
  564.             tfm.exec.newGame(self.maps[math.random(#self.maps)])
  565.             tfm.exec.disableAutoNewGame(true)
  566.         end,
  567.         off = function(self)
  568.             tfm.exec.disableAutoNewGame(false)
  569.         end,
  570.         eventLoop = function(self, t1, t2)
  571.             if t2<=0 then
  572.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  573.             end
  574.             local i=0
  575.             for k,v in pairs(tfm.get.room.playerList) do
  576.                 if not v.isDead then
  577.                     i = i+1
  578.                 end
  579.             end
  580.             local x = 0
  581.             for k,v in pairs(tfm.get.room.playerList) do
  582.                 if v.isVampire then
  583.                     x = x+1
  584.                 end
  585.             end
  586.             if i == 0 or x == i then
  587.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  588.             end
  589.         end,
  590.     },
  591.     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},
  592.         help = [[
  593.     !s or !ss to save position
  594.     !l or l key to load
  595.     !new to new map
  596. ]],
  597.         func = function(self)
  598.             self.save = {}
  599.             for k,v in pairs(tfm.get.room.playerList) do
  600.                eventNewPlayer(k)
  601.             end
  602.             system.disableChatCommandDisplay('ss', true)
  603.             system.disableChatCommandDisplay('s', true)
  604.             system.disableChatCommandDisplay('l', true)
  605.             tfm.exec.disableAutoShaman(true)
  606.             tfm.exec.disableAutoNewGame(true)
  607.             tfm.exec.disableAutoTimeLeft(true)
  608.             tfm.exec.disableAfkDeath(true)
  609.             tfm.exec.newGame(self.maps[math.random(#self.maps)])
  610.         end,
  611.         off = function(self)
  612.             tfm.exec.disableAutoShaman(false)
  613.             tfm.exec.disableAutoNewGame(false)
  614.             tfm.exec.disableAutoTimeLeft(false)
  615.             tfm.exec.disableAfkDeath(false)
  616.             system.disableChatCommandDisplay('ss', false)
  617.             system.disableChatCommandDisplay('s', false)
  618.             system.disableChatCommandDisplay('l', false)
  619.         end,
  620.         eventLoop = function(self, t1, t2)
  621.             if t2<=0 then
  622.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  623.             end
  624.         end,
  625.         eventPlayerDied = function(self, name)
  626.             tfm.exec.respawnPlayer(name)
  627.         end,
  628.         eventPlayerWon = function(self, name)
  629.             tfm.exec.respawnPlayer(name)
  630.         end,
  631.         eventNewPlayer = function(self, name)
  632.             tfm.exec.respawnPlayer(name)
  633.             tfm.exec.bindKeyboard(name,76,true,true)
  634.         end,
  635.         eventNewGame = function(self)
  636.             tfm.exec.setGameTime(300)
  637.             self.save = {}
  638.         end,
  639.         eventChatCommand = function(self, name, msg)
  640.             if msg == 's' or msg == 'ss' then
  641.                 if not self.save[name] then
  642.                     self.save[name] ={}
  643.                 end
  644.                 self.save[name].x = tfm.get.room.playerList[name].x
  645.                 self.save[name].y = tfm.get.room.playerList[name].y
  646.                 self.save[name].cheese = tfm.get.room.playerList[name].hasCheese
  647.             elseif msg == 'l' then
  648.                 if self.save[name] then
  649.                     tfm.exec.movePlayer(name, self.save[name].x, self.save[name].y)
  650.                     if self.save[name].cheese then
  651.                         tfm.exec.giveCheese(name)
  652.                     end
  653.                 end
  654.             elseif msg == 'next' then
  655.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  656.             end
  657.         end,
  658.         eventKeyboard = function(self, name, key, down, x, y)
  659.             if key == 76 then
  660.                 if self.save[name] then
  661.                     tfm.exec.movePlayer(name, self.save[name].x, self.save[name].y, false, 1, 1)
  662.                     if self.save[name].cheese then
  663.                         tfm.exec.giveCheese(name)
  664.                     end
  665.                 end
  666.             end
  667.         end,
  668.     },
  669.     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},
  670.         func = function(self)
  671.             tfm.exec.disableAutoNewGame(true)
  672.             tfm.exec.disableAutoShaman(true)
  673.             self.players={}
  674.             self.toDespawn={}
  675.             for name,player in pairs(tfm.get.room.playerList) do
  676.                 eventNewPlayer(name)
  677.             end
  678.  
  679.             tfm.exec.newGame(self.maps[math.random(#self.maps)])
  680.         end,
  681.         off = function(self)
  682.             tfm.exec.disableAutoNewGame(false)
  683.             tfm.exec.disableAutoShaman(false)
  684.             tfm.exec.newGame()
  685.         end,
  686.         eventNewPlayer = function(self, name)
  687.             for i,key in pairs({32,40,83}) do
  688.                 tfm.exec.bindKeyboard(name,key,true,true)
  689.             end
  690.             self.players[name]={
  691.                 timestamp=os.time(),
  692.                 offsets={x=2, y=10}
  693.             }
  694.         end,
  695.         eventKeyboard = function(self, name,key,down,x,y)
  696.             if (key==32 or key==40 or key==83) and not tfm.get.room.playerList[name].isDead and self.started then
  697.                 if self.players[name].timestamp < os.time()-1000 then
  698.                     local id
  699.                     if tfm.get.room.playerList[name].isFacingRight then
  700.                         id=tfm.exec.addShamanObject(19,x+self.players[name].offsets.x,y+self.players[name].offsets.y)
  701.                     else
  702.                         id=tfm.exec.addShamanObject(20,x+self.players[name].offsets.x,y+self.players[name].offsets.y)
  703.                     end
  704.                     self.players[name].timestamp=os.time()
  705.                     table.insert(self.toDespawn,{os.time(),id})
  706.                 end
  707.             end
  708.         end,
  709.         eventNewGame = function(self)
  710.             self.started=false
  711.         end,
  712.         eventLoop = function (self, t1,t2)
  713.             if t1 >= 3000 and not started then
  714.                 self.started=true
  715.             end
  716.             if t2<=0 then
  717.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  718.             end
  719.             for i,cannon in ipairs(self.toDespawn) do
  720.                 if cannon[1] <= os.time()-3000 then
  721.                     tfm.exec.removeObject(cannon[2])
  722.                     table.remove(self.toDespawn,i)
  723.                 end
  724.             end
  725.         end,
  726.         eventPlayerDied = function(self, name)
  727.             local i=0
  728.             local n
  729.             for pname,player in pairs(tfm.get.room.playerList) do
  730.                 if not player.isDead then
  731.                     i=i+1
  732.                     n=pname
  733.                 end
  734.             end
  735.             if i==0 then
  736.                 tfm.exec.newGame(self.maps[math.random(#self.maps)])
  737.             elseif i==1 then
  738.                 tfm.exec.giveCheese(n)
  739.                 tfm.exec.playerVictory(n)
  740.                 tfm.exec.setGameTime(5)
  741.             end
  742.         end,
  743.     },
  744.     -- own modulese / własne moduły
  745.    
  746.    
  747.    
  748.     -- end of own modulese / koniec własnych modułów
  749. }
  750.  
  751. ---- sortowanie tablic (skopiowane)
  752. function spairs(t, order)
  753.     -- collect the keys
  754.     local keys = {}
  755.     for k in pairs(t) do keys[#keys+1] = k end
  756.     -- if order function given, sort by it by passing the table and keys a, b,
  757.     -- otherwise just sort the keys
  758.     if order then
  759.         table.sort(keys, function(a,b) return order(t, a, b) end)
  760.     else
  761.         table.sort(keys)
  762.     end
  763.     -- return the iterator function
  764.     local i = 0
  765.     return function()
  766.         i = i + 1
  767.         if keys[i] then
  768.             return keys[i], t[keys[i]]
  769.         end
  770.     end
  771. end
  772.  
  773. -- sparwdzanie czy admin
  774. function isAdmin(nick)
  775.     for key, val in pairs(admins) do
  776.         if val == nick then
  777.             return true
  778.         end
  779.     end
  780.     return false
  781. end
  782.  
  783. ---- sprawdzanie komend
  784. function cmd(com, args, nick)
  785.     if commands[args[1]] then
  786.         if not commands[com].arg2 then
  787.             commands[com].arg2 = commands[com].arg
  788.         end
  789.         if  commands[com].on == 1 and (((#args - 1) >= commands[com].arg and (#args - 1) <= commands[com].arg2) or commands[com].arg == -1) then
  790.             if commands[com].admin == 1 then
  791.                 for key,val in pairs(admins) do
  792.                     if val == nick then
  793.                         commands[com].func(nick, args)
  794.                         return true
  795.                     end
  796.                 end
  797.                 return false
  798.             elseif commands[com].admin == 2 then
  799.                 for key,val in pairs(superAdmin) do
  800.                     if val == nick then
  801.                         commands[com].func(nick, args)
  802.                         return true
  803.                     end
  804.                 end
  805.                 return false
  806.             end
  807.             commands[com].func(nick, args)
  808.             return true
  809.         end
  810.     end
  811.     return false
  812. end
  813.  
  814. ---- BBcode
  815. function bbcode(text)
  816.     text = string.gsub(text, "%[(.?)b%]", "<%1b>")
  817.     text = string.gsub(text, "%[(.?)i%]", "<%1i>")
  818.     text = string.gsub(text, "%[(.?)u%]", "<%1u>")
  819.     text = string.gsub(text, "%[/color%]", "</font>")
  820.     text = string.gsub(text, '%[color=#?(......)%]', '<font color="#%1">')
  821.     return text
  822. end
  823.  
  824. ---- wyświetlanie komunikatów
  825. function message(nick, msg, color)
  826.     local nick2 = nick
  827.     if nick == 'all' then
  828.         nick2 = nil
  829.     end
  830.     if color == 'red' then
  831.         cr = '#CB546B'
  832.     elseif color == 'green' then
  833.         cr = '#2ECF73'
  834.     elseif color == 'blue' then
  835.         cr = '#2F7FCC'
  836.     end
  837.     ui.addTextArea(2, '<font color="'..cr..'">'..msg..'</font>', nick2, 10, 30, 300, 18, nil, nil,0.9)
  838.     timer[nick] = {}
  839.     timer[nick].tim = 4
  840.     timer[nick].make = function() ui.removeTextArea(2, nick2) end
  841. end
  842.  
  843. ---- teraźniejszy czas
  844. function time()
  845.     local utc = 2
  846.     local h = math.floor(os.time()/1000%86400/60/60) + utc
  847.     local m = math.floor(os.time()/1000%86400/60%60)
  848.     local s = math.floor(os.time()/1000%86400%60%60)
  849.  
  850.     if h >= 24 then h = h -24 end
  851.     if h < 10 then h = '0'..h end
  852.     if m < 10 then m = '0'..m end
  853.     if s < 10 then s = '0'..s end
  854.     return h..':'..m..':'..s
  855. end
  856.  
  857. ---- licz spacje
  858. function countSpace(nr, text, d, o)
  859.     local xx = nr - string.len(text)
  860.     if d ~= nil then
  861.         xx  = xx/d
  862.     end
  863.     if o ~= nil then
  864.         xx = xx - string.len(o)
  865.     end
  866.     local space = ' '
  867.     for i=2,xx,1 do
  868.         space = space..' '
  869.     end
  870.     return space
  871. end
  872.  
  873. ---- show Help
  874. function showHelp(nick, kx, ky)
  875.     local space = countSpace(48, ' ['..lg.refresh..']['..lg.close..']')
  876.     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
  877.     if kx == nil and ky == nil then
  878.         kx, ky = 200, 40
  879.     end
  880.     if module.on == 1 then
  881.         local h = ''
  882.         if modules[module.play].help then
  883.             h = modules[module.play].help
  884.         end
  885.         text = text..'___________________________________________________\n\n<font size="12px"><b>'..lg.minigame..'</b></font> '..modules[module.play].name..'\n\n'..h
  886.     end
  887.     ui.addTextArea(8, text, nick, kx, ky, 400, 300, nil, nil,0.6)
  888.  
  889.  
  890. end
  891.  
  892. ---- Pokaż kolejke map
  893. function showQueue(nick, kx, ky)
  894.     if kx == nil and ky == nil then
  895.         kx, ky = 250, 40
  896.     end
  897.     if settings.queue.on == 0 then
  898.         kolejka = '<font color="#EB1D51">'..lg.disabled..'</font>'
  899.     else
  900.         kolejka = '<VP>'..lg.enabled
  901.     end
  902.     local space = countSpace(38, ' ['..lg.refresh..']['..lg.close..']')
  903.     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'
  904.     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'
  905.     local x = 1
  906.     for key,val in pairs(maps) do
  907.         if key > mapNumber then
  908.             local space = countSpace(37,x..'. '..maps[key].name..' - '..maps[key].nick..'['..lg.delete..']')           
  909.             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'
  910.             x = x+1
  911.         end
  912.     end
  913.     ui.addTextArea(1, napis, nick, kx, ky, 300, 300, nil, nil,0.6)
  914. end
  915.  
  916. ---- pokaż opcje
  917. function options(nick, kx, ky)
  918.     if kx == nil and ky == nil then
  919.         kx, ky = 10, 40
  920.     end
  921.     local adm = ' '
  922.     local add = ' '
  923.     for key,val in pairs(admins) do
  924.         adm = adm..'<font color="#BABD2F">'..val..'</font>, '
  925.         add = add..val..', '
  926.     end
  927.     local space = countSpace(96 , ' ['..lg.refresh..']['..lg.close..']')
  928.     local space2 = countSpace(95 , lg.admins..':'..add..'  - '..lg.enabled..'    - '..lg.disabled)
  929.     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>
  930. <p align="center"><font size="19px">]]..lg.settings..[[</font></p>]]..[[
  931.  
  932. <font face="Courier">]]..lg.admins..[[:]]..adm..space2..[[<font color="#40B033">- ]]..lg.enabled..[[</font>  <font color="#E33D3D">- ]]..lg.disabled..[[</font></font>
  933. ]]
  934.     local color
  935.     x = 1
  936.     for key,val in spairs(settings) do
  937.         local onOff
  938.         if val.on == 1 then
  939.             color  = '#40B033'
  940.             onOff = '[<a href="event:set off '..key..'"><font color="#E33D3D">'..lg.enable..'</font></a>]'
  941.         else
  942.             color  = '#E33D3D'
  943.             onOff = '[<a href="event:set on '..key..'"><font color="#40B033">'..lg.disable..'</font></a>]'
  944.         end
  945.         if not isAdmin(nick) then onOff = ''end
  946.         local line = onOff..' <font color="'..color..'">'..key..'</font>  - '..val.des..'\n'
  947.        
  948.         text = text..line
  949.        
  950.         x = x+1
  951.     end
  952.     text = text..'\n<font color="#ED67EA"><a href="event:stat_reset">['..lg.reset_settings..']</a></font>'
  953.     ui.addTextArea(6, text, nick, kx, ky, 780, 335, 0x424C6B, nil,0.7)
  954. end
  955.  
  956. ---- pokaż liste komend
  957. function showCmd(nick, kx, ky)
  958.     if kx == nil and ky == nil then
  959.         kx, ky = 10, 40
  960.     end
  961.     local adm = ' '
  962.     local add = ' '
  963.     for key,val in pairs(admins) do
  964.         adm = adm..'<font color="#BABD2F">'..val..'</font>, '
  965.         add = add..val..', '
  966.     end
  967.    
  968.     local space = countSpace(96 , ' ['..lg.refresh..']['..lg.close..']')
  969.     local space2 = countSpace(96 , lg.admins..': '..add..'  - '..lg.enabled..'    - '..lg.disabled..'  * - '..lg.for_admins)
  970.     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>
  971. <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>]]
  972.     local text1 = '<font face="Courier">'
  973.     local text2 = '<font face="Courier">'
  974.     local color
  975.     x = 1
  976.     for key,val in spairs(commands) do
  977.         local arg = ''
  978.         local arg2 = ''
  979.         local star = ' '
  980.         for i=1, val.arg, 1 do
  981.             arg = arg..'&lt;arg'..i..'> '
  982.         end
  983.         if val.arg2 ~= nil then
  984.             for i=1, val.arg2 - val.arg, 1 do  
  985.                 arg2 = arg2..'[arg'..i..'] '
  986.         end end
  987.         if val.admin == 1 then
  988.             star = '<font color="#B32EAA">*</font>'
  989.         end
  990.         if val.on == 1 then
  991.             color  = '#40B033'
  992.         else
  993.             color  = '#E33D3D'
  994.         end
  995.         local line = star..'<font color="'..color..'">!'..key..' '..arg..arg2..'- '..val.des..'</font>\n'
  996.         if string.len('!'..key..arg..arg2..' - '..val.des) > 47 then
  997.             x = x+1
  998.         end
  999.         if x>22 then
  1000.             text2 = text2..line
  1001.         else   
  1002.             text1 = text1..line
  1003.         end
  1004.         x = x+1
  1005.     end
  1006.     text1 = text1..'</font>'
  1007.     text2 = text2..'</font>'
  1008.  
  1009.     ui.addTextArea(3, text, nick, kx, ky, 780, 335, 0x424C6B, nil,0.9)
  1010.     ui.addTextArea(4, text1, nick, kx, ky+45, 385, 305, 0x000000, nil,0.6)
  1011.     ui.addTextArea(5, text2, nick, kx+395, ky+45, 385, 305, 0x000000, nil,0.6)
  1012. end
  1013.  
  1014. -- pokaż minigry
  1015. function showModules(nick, kx, ky)
  1016.     if kx == nil and ky == nil then
  1017.         kx, ky = 200, 40
  1018.     end
  1019.     local space = countSpace(49 , '  ['..lg.close..']')
  1020.     local text = [[<font face="Courier"><a href="event:move 7"></a>]]..space..[[<a href="event:close">[]]..lg.close..[[]</a></font>
  1021. <font size="19px"><p align="center">]]..lg.minigames..[[</p></font>
  1022. <font color="#BABD2F">]]..lg.module_stop..[[</font>
  1023.  
  1024.  
  1025. ]]
  1026.     local color
  1027.     x = 1
  1028.     for key,val in spairs(modules) do
  1029.         local author = ''
  1030.         if modules[key].author then
  1031.             author = ' by '..modules[key].author
  1032.         end
  1033.         text = text..'<font color="#40B033"><a href="event:module '..key..'">!module '..key..'</a></font> - '..modules[key].name..author..'\n'
  1034.     end
  1035.     ui.addTextArea(7, text, nick, kx, ky, 400, 335, 0x424C6B, nil, 0.7)
  1036. end
  1037.  
  1038. --
  1039. function modulePlay(nick, name)
  1040.     if commands.module.admin > 0 then
  1041.         if not isAdmin(nick) then
  1042.             return
  1043.         end
  1044.     end
  1045.     module.on = 1
  1046.     module.play = name
  1047.     message('all', lg.minigame..': '..modules[name].name, 'blue')
  1048.     if modules[name].func then
  1049.         modules[name]:func(args)
  1050.     end
  1051.  
  1052. end
  1053.  
  1054. -------- EVENTS --------
  1055. -- nowy gracz
  1056. function eventNewPlayer(nick)
  1057.     if module.on == 1 then
  1058.         -- modules on
  1059.         if modules[module.play].eventNewPlayer then
  1060.             modules[module.play]:eventNewPlayer(nick)
  1061.         end
  1062.     else
  1063.         -- modules off
  1064.        
  1065.     end
  1066.     -- rest
  1067.     ui.addTextArea(0, ' ', nick, 10, 30, 1, 1, 0x56F73D, 0x56F73D, 0.5)
  1068.     system.bindMouse(nick,true)
  1069.     for key,val in pairs({27, 72, 73, 77, 79}) do
  1070.         tfm.exec.bindKeyboard(nick,val,true,true)
  1071.     end
  1072.     for key,val in pairs({72, 73, 77}) do
  1073.         tfm.exec.bindKeyboard(nick,val,false,true)
  1074.     end
  1075.    
  1076. end
  1077.  
  1078.  
  1079.  
  1080. -- eventPlayerDied
  1081. function eventPlayerDied(nick)
  1082.     if module.on == 1 then
  1083.         -- modules on
  1084.         if modules[module.play].eventPlayerDied then
  1085.             modules[module.play]:eventPlayerDied(nick)
  1086.         end
  1087.     else
  1088.         -- modules off
  1089.        
  1090.     end
  1091.     if settings.autorespawn.on == 1 or house ~= nil then
  1092.         tfm.exec.respawnPlayer(nick)
  1093.     end
  1094. end
  1095.  
  1096. -- eventPlayerWon(String playerName)
  1097. function eventPlayerWon(nick)
  1098.     if module.on == 1 then
  1099.         -- modules on
  1100.         if modules[module.play].eventPlayerWon then
  1101.             modules[module.play]:eventPlayerWon(nick)
  1102.         end
  1103.     else
  1104.         -- modules off
  1105.        
  1106.     end
  1107.     if house ~= nil then
  1108.         tfm.exec.respawnPlayer(nick)
  1109.     end
  1110. end
  1111.  
  1112. ---- pętla
  1113. function eventLoop(t1, t2)
  1114.     if module.on == 1 then
  1115.         -- modules on
  1116.         if modules[module.play].eventLoop then
  1117.             modules[module.play]:eventLoop(t1, t2)
  1118.         end
  1119.     else
  1120.         -- modules off
  1121.        
  1122.     end
  1123.     if wait ~= 0 then
  1124.         wait = wait -1
  1125.     end
  1126.     -- queue on, nowa mapa
  1127.     if settings.queue.on == 1 and #maps > mapNumber and t2 < t1 and wait == 0 then
  1128.         mapNumber = mapNumber +1
  1129.         if not tfm.exec.newGame(maps[mapNumber].code) then
  1130.             wait = 6
  1131.         end
  1132.     -- wszyscy martwi
  1133.     elseif settings.queue.on == 1 and wait == 0 then
  1134.         local dead = 1
  1135.         for key,val in pairs(tfm.get.room.playerList) do
  1136.             if not tfm.get.room.playerList[key].isDead then
  1137.                 dead = 0
  1138.                 break
  1139.             end
  1140.         end
  1141.         if dead == 1 then
  1142.             if #maps > mapNumber then
  1143.                 mapNumber = mapNumber +1
  1144.                 if not tfm.exec.newGame(maps[mapNumber].code) then
  1145.                     wait = 6
  1146.                 end
  1147.             else
  1148.                 tfm.exec.newGame(0)
  1149.             end
  1150.         end
  1151.     end
  1152.     -- komunikaty
  1153.     for key,val in pairs(timer) do
  1154.         if timer[key].tim == 0 then
  1155.             timer[key].make()
  1156.         else
  1157.             timer[key].tim = timer[key].tim - 1
  1158.         end
  1159.     end
  1160.     -- auto teleportacja
  1161.     for key,val in pairs(playerPosition) do
  1162.         local x = playerPosition[key].x
  1163.         local y = playerPosition[key].y
  1164.         tfm.exec.movePlayer(key, x, y, 0, -1,-1)
  1165.     end
  1166.     -- piesek
  1167.     for key,val in pairs(pet) do   
  1168.         local x = tfm.get.room.playerList[val].x
  1169.         local y = tfm.get.room.playerList[val].y
  1170.         tfm.exec.movePlayer(key, x, y, 0, -1,-1)
  1171.     end
  1172. end
  1173.  
  1174. -- klawiatura
  1175. function eventKeyboard(nick ,key ,down ,x ,y)
  1176.     if module.on == 1 then
  1177.         -- modules on
  1178.         if modules[module.play].eventKeyboard then
  1179.             modules[module.play]:eventKeyboard(nick ,key ,down ,x ,y)
  1180.         end
  1181.     else
  1182.         -- modules off
  1183.        
  1184.     end
  1185.     -- esc
  1186.     if key == 27 then
  1187.         for i=1, 10, 1 do
  1188.             ui.removeTextArea(i, nick)
  1189.         end
  1190.     -- m - modules
  1191.     elseif key == 77 then
  1192.         if down then
  1193.             showModules(nick)
  1194.         else
  1195.             ui.removeTextArea(7, nick)
  1196.         end
  1197.     -- o - opcje
  1198.     elseif key == 79 then
  1199.         options(nick)
  1200.     -- h - help
  1201.     elseif key == 72 then
  1202.         if down then
  1203.             showHelp(nick)
  1204.         else
  1205.             ui.removeTextArea(8, nick)
  1206.         end
  1207.     elseif key == 73 then
  1208.         if down then
  1209.             showCmd(nick)
  1210.         else
  1211.             ui.removeTextArea(3, nick)
  1212.             ui.removeTextArea(4, nick)
  1213.             ui.removeTextArea(5, nick) 
  1214.         end
  1215.     end
  1216. end
  1217.  
  1218. ---- kliknięcie
  1219. function eventMouse(nick, x, y)  
  1220.     if module.on == 1 then
  1221.         -- modules on
  1222.         if modules[module.play].eventMouse then
  1223.             modules[module.play]:eventMouse(nick, x, y)
  1224.         end
  1225.     else
  1226.         -- modules off
  1227.        
  1228.     end
  1229.     -- przenoszenie menu
  1230.     if move[nick] ~= nil then
  1231.         if move[nick] == 6 then
  1232.             options(nick, x-8, y-8)
  1233.         elseif move[nick] ==  1 then
  1234.             showQueue(nick, x-8, y-8)
  1235.         elseif move[nick] == 3 then
  1236.             showCmd(nick, x-8, y-8)
  1237.         elseif move[nick] == 8 then
  1238.             showHelp(nick, x-8, y-8)
  1239.         elseif move[nick] == 7 then
  1240.             showModules(nick, x-8, y-8)
  1241.         end
  1242.         move[nick] = nil
  1243.     else
  1244.         -- tp
  1245.         for key,val in pairs(tp) do
  1246.             if key == nick then
  1247.                 tpp[key] = nil
  1248.                 playerPosition[key] = nil
  1249.                 tfm.exec.movePlayer(val, x, y, 0, -1,-1)
  1250.                 break
  1251.             end
  1252.         end
  1253.         -- tpp
  1254.         for key,val in pairs(tpp) do
  1255.             if key == nick then
  1256.                 playerPosition[val] = {}
  1257.                 playerPosition[val].x = x
  1258.                 playerPosition[val].y = y
  1259.                 break
  1260.             end
  1261.         end
  1262.     end
  1263. end
  1264. function name(i, nick)
  1265.     if #args < (i+1) then
  1266.         return nick
  1267.     else
  1268.         return args[i+1]
  1269.     end
  1270. end
  1271. ---- !komendy
  1272. function eventChatCommand(nick, msg)
  1273.     if module.on == 1 then
  1274.         -- modules on
  1275.         if modules[module.play].eventChatCommand then
  1276.             modules[module.play]:eventChatCommand(nick, msg)
  1277.         end
  1278.     else
  1279.         -- modules off
  1280.        
  1281.     end
  1282.     -- log
  1283.     Log = '['..time()..'] '..nick..' - !'..msg..'\n'..Log
  1284.     -- dzielenie argumentów
  1285.     local args={}
  1286.     for arg in msg:gmatch("[^%s]+") do
  1287.         table.insert(args,arg)
  1288.     end
  1289.     rest = msg:match("%s(.*)") or ""
  1290.     -- wyłączenie dostępu dla tych z banem
  1291.     for key,val in pairs(ban) do
  1292.         for k,v in pairs(superAdmin) do
  1293.             if key == nick and val == true and nick ~= v then
  1294.                 message(nick, lg.banned, 'red')
  1295.                 return false
  1296.             end
  1297.         end
  1298.     end
  1299.     function name(i)
  1300.         if #args < (i+1) then
  1301.             return nick
  1302.         else
  1303.             return args[i+1]
  1304.         end
  1305.     end
  1306.     -------------
  1307.     cmd(args[1], args, nick)
  1308.    
  1309. end
  1310.  
  1311. ---- odwołania z <a>
  1312. function eventTextAreaCallback(id, nick, callback)
  1313.     if module.on == 1 then
  1314.         -- modules on
  1315.         if modules[module.play].eventTextAreaCallback then
  1316.             modules[module.play]:eventTextAreaCallback(id, nick, callback)
  1317.         end
  1318.     else
  1319.         -- modules off
  1320.        
  1321.     end
  1322.     local args={}
  1323.     for arg in callback:gmatch("[^%s]+") do
  1324.         table.insert(args,arg)
  1325.     end
  1326.     -- zamykanie
  1327.     if callback == 'close' then
  1328.         if id == 3 then
  1329.             ui.removeTextArea(3, nick)
  1330.             ui.removeTextArea(4, nick)
  1331.             ui.removeTextArea(5, nick)
  1332.         else
  1333.             ui.removeTextArea(id, nick)
  1334.         end
  1335.     -- odświeżanie
  1336.     elseif args[1] == 'refresh' then
  1337.         if id == 1 then
  1338.             showQueue(nick)
  1339.         elseif id == 6 then
  1340.             options(nick)
  1341.         end
  1342.     -- ustawienia
  1343.     elseif args[1] == 'set' then
  1344.         if args[2] ==  'on' then
  1345.             settings[args[3]].on = 1
  1346.             settings[args[3]].fOn()
  1347.         else
  1348.             settings[args[3]].on = 0
  1349.             settings[args[3]].fOff()
  1350.         end
  1351.         options(nick)
  1352.     -- przenoszenie textarea
  1353.     elseif args[1] == 'move' then
  1354.         move[nick] = id
  1355.     -- resetowanie ustawień
  1356.     elseif args[1] == 'stat_reset' then
  1357.         for key,val in pairs(settings) do
  1358.             settings[key].on = settings[key].def
  1359.         end
  1360.         options(nick)
  1361.     -- !maps usuwanie
  1362.     elseif args[1] == 'delmap' then
  1363.         if isAdmin(nick) then
  1364.             table.remove(maps, args[2])
  1365.             showQueue(nick)
  1366.         end
  1367.     -- moduły
  1368.     elseif args[1] == 'module' then
  1369.         modulePlay(nick, args[2])  
  1370.     end
  1371. end
  1372.  
  1373. function eventEmotePlayed(nick, emoteId)
  1374.     if module.on == 1 then
  1375.         -- modules on
  1376.         if modules[module.play].eventEmotePlayed then
  1377.             modules[module.play]:eventEmotePlayed(nick, emoteId)
  1378.         end
  1379.     else
  1380.         -- modules off
  1381.        
  1382.     end
  1383. end
  1384.  
  1385. function eventPlayerGetCheese(nick)
  1386.     if module.on == 1 then
  1387.         -- modules on
  1388.         if modules[module.play].eventPlayerGetCheese then
  1389.             modules[module.play]:eventPlayerGetCheese(nick)
  1390.         end
  1391.     else
  1392.         -- modules off
  1393.        
  1394.     end
  1395. end
  1396.  
  1397. function eventPlayerLeft(nick)
  1398.     if module.on == 1 then
  1399.         -- modules on
  1400.         if modules[module.play].eventPlayerLeft then
  1401.             modules[module.play]:eventPlayerLeft(nick)
  1402.         end
  1403.     else
  1404.         -- modules off
  1405.        
  1406.     end
  1407. end
  1408.  
  1409. function eventPlayerVampire(nick)
  1410.     if module.on == 1 then
  1411.         -- modules on
  1412.         if modules[module.play].eventPlayerVampire then
  1413.             modules[module.play]:eventPlayerVampire(nick)
  1414.         end
  1415.     else
  1416.         -- modules off
  1417.        
  1418.     end
  1419. end
  1420.  
  1421. function eventPlayerWon(nick)
  1422.     if module.on == 1 then
  1423.         -- modules on
  1424.         if modules[module.play].eventPlayerWon then
  1425.             modules[module.play]:eventPlayerWon(nick)
  1426.         end
  1427.     else
  1428.         -- modules off
  1429.        
  1430.     end
  1431. end
  1432.  
  1433. function eventPlayerRespawn(nick)
  1434.     if module.on == 1 then
  1435.         -- modules on
  1436.         if modules[module.play].eventPlayerRespawn then
  1437.             modules[module.play]:eventPlayerRespawn(nick)
  1438.         end
  1439.     else
  1440.         -- modules off
  1441.        
  1442.     end
  1443. end
  1444.  
  1445. function eventPopupAnswer(id, nick, answer)
  1446.     if module.on == 1 then
  1447.         -- modules on
  1448.         if modules[module.play].eventPopupAnswer then
  1449.             modules[module.play]:eventPopupAnswer(id, nick, answer)
  1450.         end
  1451.     else
  1452.         -- modules off
  1453.        
  1454.     end
  1455. end
  1456.  
  1457. function eventSummoningStart(nick, objectType, x, y, angle)
  1458.     if module.on == 1 then
  1459.         -- modules on
  1460.         if modules[module.play].eventSummoningStart then
  1461.             modules[module.play]:eventSummoningStart(nick, objectType, x, y, angle)
  1462.         end
  1463.     else
  1464.         -- modules off
  1465.        
  1466.     end
  1467. end
  1468.  
  1469. function eventSummoningCancel(nick)
  1470.     if module.on == 1 then
  1471.         -- modules on
  1472.         if modules[module.play].eventSummoningCancel then
  1473.             modules[module.play]:eventSummoningCancel(nick)
  1474.         end
  1475.     else
  1476.         -- modules off
  1477.        
  1478.     end
  1479. end
  1480.  
  1481. function eventSummoningEnd(nick, objectType, x, y, angle, xSpeed, ySpeed, objectType, other)
  1482.     if module.on == 1 then
  1483.         -- modules on
  1484.         if modules[module.play].eventSummoningEnd then
  1485.             modules[module.play]:eventSummoningEnd(nick, objectType, x, y, angle, xSpeed, ySpeed, objectType, other)
  1486.         end
  1487.     else
  1488.         -- modules off
  1489.        
  1490.     end
  1491. end
  1492.  
  1493. function eventNewGame()
  1494.     if module.on == 1 then
  1495.         -- modules on
  1496.         if modules[module.play].eventNewGame then
  1497.             modules[module.play]:eventNewGame()
  1498.         end
  1499.     else
  1500.         -- modules off
  1501.        
  1502.     end
  1503. end
  1504.  
  1505. -- wyłączenie widzialności komend
  1506. for k,v in pairs(commands) do
  1507. system.disableChatCommandDisplay(k, true)
  1508. end
  1509.  
  1510. -- wymuszenie nowego gracza
  1511. for playername,player in pairs(tfm.get.room.playerList) do
  1512.    eventNewPlayer(playername)
  1513. end
  1514.  
  1515. print 'Ultimate Tribe House Script loaded'
  1516.  
  1517. ---- koniec skryptu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement