Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 40.18 KB | None | 0 0
  1. --[[
  2. Questliberweiterung generiert by Mijago
  3. Link: http://questwriting.mijago.org/questlib/index.php?exec=1&updater=0&b1=1&b2=1&b10=1&b23=1&b41=1&b42=1&b43=1&b44=1&b45=1&b46=1&b47=1&b48=1&b60=1&b61=1&b101=1&b102=1&b103=1&b104=1&b106=1&b201=1&b301=1&b801=1&b802=1&b803=1&b804=1&b805=1&b806=1&b901=1&b902=1&b903=1&b904=1&b905=1&b1001=1&b1002=1&b1003=1&b1004=1&b2002=1
  4. Funktionen:
  5. split, mysql_query, mysql_query_old, duration, is_number, is_string,
  6. is_table, in_table, numlen, string.reverse, num_format, numtomoney,
  7. n_input, long_input, select2, select3, note (Notice Mod), Zeitrechnungen,
  8. Autoumbruch in Say, mysql_escape, account.set_pw, pc.check_inventory_place, do_for_other, local_pc_setqf,
  9. pc.trans, pc.warp_to, local_warp_pc, download, dot, dostr,
  10. wartungsmodus, create_folder, Ini-Parser, csay, Farbcodes, Apache-Funktionen,
  11. TS3-Funktionen
  12. --]]
  13.  
  14.  
  15. --[[
  16. @name split
  17. @author Internet (http://lua-users.org/wiki/SplitJoin)
  18. @descr
  19. Splittet einen String in eine Tabelle.
  20. --]]
  21. function split(str, delim, maxNb)
  22. if str == nil then return str end
  23. if string.find(str, delim) == nil then return { str } end
  24. if maxNb == nil or maxNb < 1 then maxNb = 0 end
  25. local result = {}
  26. local pat = "(.-)" .. delim .. "()"
  27. local nb = 0
  28. local lastPos
  29. for part, pos in string.gfind(str, pat) do
  30. nb = nb + 1
  31. result[nb] = part
  32. lastPos = pos
  33. if nb == maxNb then break end
  34. end
  35. if nb ~= maxNb then result[nb + 1] = string.sub(str, lastPos) end
  36. return result
  37. end
  38.  
  39.  
  40. --[[
  41. @name mysql_query
  42. @author Mijago
  43. @needs split
  44. @descr
  45. Mysql-Funktion der neuesten Generation.
  46. --]]
  47. mysql_query = function(query)
  48. if not pre then
  49. local rt = io.open('CONFIG','r'):read('*all')
  50. pre,_= string.gsub(rt,'.+PLAYER_SQL:%s(%S+)%s(%S+)%s(%S+)%s(%S+).+','-h%1 -u%2 -p%3 -D%4')
  51. end
  52. math.randomseed(os.time())
  53. local fi,t,out = 'mysql_data_'..math.random(10^9)+math.random(2^4,2^10),{},{}
  54. -- os.execute('mysql '..pre..' --e='..string.format('%q',query)..' > '..fi) -- für MySQL51
  55. os.execute('mysql '..pre..' -e'..string.format('%q',query)..' > '..fi) -- für MySQL55
  56. for av in io.open(fi,'r'):lines() do table.insert(t,split(av,'\t')) end; os.remove(fi);
  57. for i = 2, table.getn(t) do table.foreach(t[i],function(a,b)
  58. out[i-1] = out[i-1] or {}
  59. out[i-1][a] = tonumber(b) or b or 'NULL'
  60. out[t[1][a]] = out[t[1][a]] or {}
  61. out[t[1][a]][i-1] = tonumber(b) or b or 'NULL'
  62. end) end
  63. return out
  64. end
  65.  
  66.  
  67. --[[
  68. @name mysql_query_old
  69. @author Mijago
  70. @needs split
  71. @descr
  72. Die Alte Version der MySQL-Query-Funktion.
  73. --]]
  74. local ql = {
  75. ["user"] = "root",
  76. ["pass"] = "",
  77. ["ip"] = "localhost",
  78. ["db"] = "player"
  79. }
  80. function mysql_query_old(query,user,pass,db,ip)
  81. local pre = ''
  82. if query == '' or query == nil then
  83. error("Query muss gesetzt sein!")
  84. end
  85. user = user or ql.mysql["user"]
  86. pass = pass or ql.mysql["pass"]
  87. ip = ip or ql.mysql["ip"]
  88. if user ~= '' and user ~= nil then pre = pre..' -u'..user end
  89. if pass ~= '' and pass ~= nil then pre = pre..' -p'..pass end
  90. if db ~= '' and db ~= nil then pre = pre..' -D'..db end
  91. if ip ~= '' and ip ~= nil then pre = pre..' -h'..ip end
  92. math.randomseed(os.time()); local rand = math.random(0,10^7) -- Erstellen der Pfadvariable
  93. local path = 'data/mysql_output_'..os.time()..'_'..rand..'_'..pc.get_vid()
  94. os.execute ("mysql "..pre.." --e=\""..query.."\" > "..path) -- Laden und Auflisten der Dateiinhalte
  95. local fi,q = io.open(path,"r"),{["l"] = {},["out"]={}}
  96. if fi == nil then
  97. return "ERROR"
  98. end
  99. for line in fi:lines() do table.insert(q.l,(split(line,"\t"))) end
  100. os.remove(path)
  101. if type(q.l[1]) ~= "table" then
  102. return "ERROR"
  103. --error("Fehler bei der MySQL Verbindung oder bei der Rückgabe! Abbruch!")
  104. end
  105. local ix = 0
  106. table.foreachi(q.l,function(i,l)
  107. if i > 1 then table.foreach(l,function(i2,l2)
  108. if q.out[q.l[1][i2]] == nil then q.out[q.l[1][i2]] = {} end
  109. local c = tonumber(l2)
  110. if type(c) == "number" and l2 == tostring(c) then
  111. q.out[q.l[1][i2]][i-1] = c
  112. else
  113. q.out[q.l[1][i2]][i-1] = l2
  114. end
  115. end) end
  116. end)
  117. -- ENDE der eigentlichen MySQL-Funktion
  118. -- START Zusatz: Hanashi-Kompatibilität & Fehlerbehandlung
  119. q.out.__data = q.l[1]
  120. setmetatable(q.out, { __index = function(a,b)
  121. if type(b) == "number" then
  122. return (a[a.__data[b]] or {"ERROR"})
  123. end
  124. return "ERROR"
  125. --error("Fehler bei Indexierung: Index "..b.." ist nicht vorhanden!")
  126. end})
  127. return q.out
  128. end
  129.  
  130.  
  131. --[[
  132. @name duration
  133. @author Mijago
  134. @descr
  135. Gibt die verbleibende Zeit als String zurück.
  136. --]]
  137. function duration(ipe)
  138. local ipe,dat= ipe or 0,''
  139. local s,m,h,d,mo,y = tonumber(os.date('%S',ipe)),
  140. tonumber(os.date('%M',ipe)),
  141. tonumber(os.date('%H',ipe)),
  142. tonumber(os.date('%d',ipe))-1,
  143. tonumber(os.date('%m',ipe))-1,
  144. tonumber(os.date('%Y',ipe))-1970
  145. for x,c in {{s,"Sek."},{m,"Min."},{h,"Std."},{d,"Tage","Tag"},{mo,"Monate","Monat"},{y,"Jahre","Jahr"}} do
  146. if (c[1] or 0) > 0 then
  147. if x > 1 then dat = ' '..dat end
  148. if c[1] > 1 then
  149. dat = c[1]..' '..c[2]..dat
  150. else
  151. dat = c[1]..' '..(c[3] or c[2])..dat
  152. end
  153. end
  154. end
  155. return dat
  156. end
  157.  
  158.  
  159. --[[
  160. @name is_number
  161. @author Mijago
  162. @descr
  163. Prüft, ob eine Variable eine Zahl ist.
  164. --]]
  165. function is_number(var)
  166. return (type(var) == "number")
  167. end
  168.  
  169.  
  170. --[[
  171. @name is_string
  172. @author Mijago
  173. @descr
  174. Prüft, ob eine Variable ein String ist.
  175. --]]
  176. function is_string(var)
  177. return (type(var) == "string")
  178. end
  179.  
  180.  
  181. --[[
  182. @name is_table
  183. @author Mijago
  184. @descr
  185. Prüft, ob eine Variable eine Tabelle ist.
  186. --]]
  187. function is_table(var)
  188. return (type(var) == "table")
  189. end
  190.  
  191.  
  192. --[[
  193. @name in_table
  194. @author Mijago
  195. @descr
  196. Prüft, ob eine Variablei in einer Tabelle ist.
  197. Aufruf: in_table(var,table)
  198. --]]
  199. function in_table ( e, t )
  200. for _,v in pairs(t) do
  201. if (v==e) then
  202. return true
  203. end
  204. end
  205. return false
  206. end
  207.  
  208.  
  209. --[[
  210. @name numlen
  211. @author Mijago
  212. @descr
  213. Gibt die Anzahl der Ziffern einer Zahl wieder.
  214. --]]
  215. function numlen(i)
  216. local i,x = i or 0,0
  217. while i > 10^x do x=x+1 end
  218. return x
  219. end
  220.  
  221.  
  222. --[[
  223. @name string.reverse
  224. @author Mijago
  225. @descr
  226. Kehrt einen String um.
  227. --]]
  228. function string.reverse(str)
  229. local se = ''
  230. for i=1,string.len(str) do
  231. se = string.sub(str,i,i)..se
  232. end
  233. return se
  234. end
  235.  
  236.  
  237. --[[
  238. @name num_format
  239. @author Mijago; Idee von Benhero
  240. @needs string.reverse
  241. @descr
  242. Formatiert lange Zahlen mit Punkten.
  243.  
  244. --]]
  245. function num_format(num)
  246. if type(num) == "number" then num = tostring(num) end
  247. if string.len(num) <= 3 then return num end
  248. return string.reverse(string.gsub(string.reverse(num),'(%d%d%d)','%1.'))
  249. end
  250.  
  251.  
  252. --[[
  253. @name numtomoney
  254. @author Mijago
  255. @descr
  256. Formatiert zB 1234567 in 1.234.567.
  257. --]]
  258. function numtomoney(num)
  259. local num,out,x = tostring(num),'',0
  260. while string.len(num)-3 > 0 do
  261. out = string.gsub(num,'.-(%d%d%d)$','.%1')..out
  262. num = string.sub(num,0,string.len(num)-3)
  263. end
  264. return num..out
  265. end
  266.  
  267.  
  268. --[[
  269. @name n_input
  270. @author Mijago
  271. @descr
  272. Für Inputs nur für Zahlen.
  273. Die Zahl ist IMMER positiv. Wenn sie nicht gültig ist, ist sie 0.
  274. --]]
  275. function n_input()
  276. return math.abs(tonumber(input()) or 0)
  277. end
  278.  
  279.  
  280. --[[
  281. @name long_input
  282. @author Mijago
  283. @descr
  284. Ermöglicht es, längere Inputs zu nutzen.
  285. --]]
  286. function long_input()
  287. local str,t = "",input()
  288. while t ~= "" do
  289. str = str..t
  290. t = input()
  291. end
  292. return str, str ~= ""
  293. end
  294.  
  295.  
  296. --[[
  297. @name select2
  298. @author Mijago
  299. @needs split
  300. @descr
  301. Wie Select:
  302. Eine Tabelle oder eine Stringliste wird auf Seiten aufgeteilt.
  303. Weiter und Abbrechen Buttons.
  304. --]]
  305. function select2(tab,...)
  306. arg.n = nil
  307. if type(tab) ~= "table" and type(tab) == 'number' then
  308. table.insert(arg,1,tab)
  309. tab = arg
  310. elseif type(tab) ~= "table" and type(tab) == 'string' then
  311. table.insert(arg,1,tab)
  312. table.insert(arg,1,8)
  313. tab = arg
  314. elseif type(tab) == "table" and type(tab[1]) == 'string' then
  315. table.insert(tab,1,8)
  316. end
  317. local max = tab[1]; table.remove(tab,1)
  318. local tablen,outputstr,outputcount,nextc,incit = table.getn(tab),"",0,0,0
  319. table.foreach(tab,
  320. function(i,l)
  321. outputcount = outputcount + 1
  322. if outputcount == 1 then
  323. outputstr=outputstr..'sel = select("'..l..'"'
  324. elseif outputcount == max and tablen > outputcount+incit then
  325. if tablen ~= outputcount+incit+1 then
  326. outputstr=outputstr..',"'..l..'","Nächste Seite") + '..incit..' '
  327. if nextc > 0 then
  328. outputstr = outputstr..'end '
  329. end
  330. outputstr=outputstr..'; if sel == '..(incit+max+1)..' then ' -- Anfangen der neuen Abfrage
  331. nextc, outputcount, incit= nextc+1,0,incit+max
  332. else
  333. outputstr=outputstr..',"'..l..'"'
  334. end
  335. else
  336. outputstr=outputstr..',"'..l..'"'
  337. end
  338. end
  339. )
  340. outputstr = outputstr..') + '..incit
  341. if nextc > 0 then
  342. outputstr = outputstr..' end'
  343. end
  344. outputstr= outputstr.. '; return sel'
  345. print(outputstr)
  346. local sel = assert(loadstring(outputstr))()
  347. tablen,outputstr,outputcount,nextc,incit = nil,nil,nil,nil,nil -- Speicher freimachen
  348. return sel
  349. end
  350.  
  351.  
  352.  
  353. --[[
  354. @name select3
  355. @author Mijago
  356. @needs split
  357. @descr
  358. Wie Select2:
  359. Eine Tabelle oder eine Stringliste wird auf Seiten aufgeteilt.
  360. Weiter, Zurück und Abbrechen (-1) Buttons.
  361. --]]
  362. function select3(...)
  363. arg.n = nil
  364. local tp,max = arg,5
  365. if type(tp[1]) == 'number' then
  366. max = tp[1]
  367. if type(tp[2]) == 'table' then
  368. tp = tp[2]
  369. else
  370. table.remove(tp,1)
  371. end
  372. elseif type(tp[1]) == 'table' then
  373. if type(tp[1][1]) == 'number' then
  374. max = tp[1][1]
  375. table.remove(tp[1],1)
  376. tp = tp[1]
  377. end
  378. tp = tp[1]
  379. end
  380. local str = '{'
  381. local tablen,act,incit = table.getn(tp),0,0
  382. table.foreach(tp,function(i,l)
  383. act = act + 1
  384. if act == 1 then
  385. str = str .. '{'..string.format('%q',l)
  386. elseif act == max+1 and tablen > act+incit then
  387. if tablen ~= act+incit+1 then
  388. str = str..'},{'..string.format('%q',l)
  389. else
  390. str=str..','..string.format('%q',l)
  391. end
  392. incit = incit + max
  393. act = 1
  394. else
  395. str=str..','..string.format('%q',l)
  396. end
  397. end)
  398. local px = loadstring('return '..str ..'}}')()
  399. local function copy_tab(t) local p= {} for i = 1,table.getn(t) do p[i] = t[i] end return p end
  400. local pe = {}
  401. for i = 1,table.getn(px) do pe [i] = copy_tab(px[i]) end
  402. local function init(i,ip)
  403. pe[i] = copy_tab(px[i])
  404. local next,back,exit = 0,0,0
  405. if i < table.getn(pe) and table.getn(pe) ~=1 then table.insert(pe[i],table.getn(pe[i])+1,'Weiter zu Seite '..(i+1)); next = table.getn(pe[i]) end
  406. if i > 1 then table.insert(pe[i],table.getn(pe[i])+1,'Zurück zu Seite '..(i-1)); back = table.getn(pe[i]) end
  407. table.insert(pe[i],table.getn(pe[i])+1,'Abbruch'); exit = table.getn(pe[i])
  408. if table.getn(pe) > 1 then
  409. say('Seite '..i..' von '..table.getn(pe))
  410. end
  411. local e = select_table(pe[i])
  412. if e == next then return init(i+1,ip+max)
  413. elseif e == back then return init(i-1,ip-max)
  414. elseif e == exit then return -1
  415. else return e+ip,pe[i][e] end
  416. end
  417. return init(1,0) or -1
  418. end
  419.  
  420.  
  421. --[[
  422. @name note (Notice Mod)
  423. @author Mijago
  424. @descr
  425. Wie Notice, nur mit Spielername davor.
  426. --]]
  427. function note(text)
  428. notice_all(pc.get_name()..': '..text)
  429. end
  430.  
  431.  
  432. --[[
  433. @name Zeitrechnungen
  434. @author Mijago
  435. @descr
  436. Funktionen zum Umrechenen von Zeit.
  437. --]]
  438. zt = zt or {}
  439. zt.d_j = function(d)
  440. return d/365
  441. end
  442. zt.d_mo = function(d)
  443. return d/12
  444. end
  445. zt.d_h = function(d)
  446. return d*24
  447. end
  448. zt.d_m = function(d)
  449. return d*24*60
  450. end
  451. zt.d_s = function(d)
  452. return d*24*60*60
  453. end
  454. zt.d_hs = function(d)
  455. return d*24*60*60*100
  456. end
  457. zt.d_ms = function(d)
  458. return d*24*60*60*1000
  459. end
  460. --- Stunden
  461. zt.h_j = function(h)
  462. return h/24/365
  463. end
  464. zt.h_mo = function(h)
  465. return h/24/12
  466. end
  467. zt.h_d = function(h)
  468. return h/24
  469. end
  470. zt.h_m = function(h)
  471. return h*60
  472. end
  473. zt.h_s = function(h)
  474. return h*60*60
  475. end
  476. zt.h_hs = function(h)
  477. return h*60*60*100
  478. end
  479. zt.h_ms = function(h)
  480. return h*60*60*1000
  481. end
  482. --- Minuten
  483. zt.m_j = function(m)
  484. return m/60/24/365
  485. end
  486. zt.m_mo = function(m)
  487. return m/60/24/12
  488. end
  489. zt.m_d = function(m)
  490. return m/60/24
  491. end
  492. zt.m_h = function(m)
  493. return m/60
  494. end
  495. zt.m_s = function(m)
  496. return m*60
  497. end
  498. zt.m_hs = function(m)
  499. return m*60*100
  500. end
  501. zt.m_ms = function(m)
  502. return m*60*1000
  503. end
  504. --- Sekunden
  505. zt.s_j = function(s)
  506. return s/60/60/24/365
  507. end
  508. zt.s_mo = function(s)
  509. return s/60/60/24/12
  510. end
  511. zt.s_d = function(s)
  512. return s/60/60/24
  513. end
  514. zt.s_h = function(s)
  515. return s/60/60
  516. end
  517. zt.s_m = function(s)
  518. return s/60
  519. end
  520. zt.s_hs = function(s)
  521. return s*100
  522. end
  523. zt.s_ms = function(s)
  524. return s*1000
  525. end
  526.  
  527.  
  528. --[[
  529. @name Autoumbruch in Say
  530. @author Mijago
  531. @descr
  532. Fügt die Funktion say2 an.
  533. Mit ihr werden Texte automatisch umgebrochen.
  534. --]]
  535. function say2(str,dx)
  536. local maxl,actl,pat = dx or 50,0,'(.-)(%[.-%])()'
  537. local result,nb,lastPos,outp = {},0,0,''
  538. local function bere(stx)
  539. for le in string.gfind(stx,'((%S+)%s*)') do
  540. if actl + string.len(le) > maxl then
  541. outp = outp..'[ENTER]'
  542. actl = 0
  543. end
  544. outp = outp..le
  545. actl = actl + string.len(le)
  546. end
  547. end
  548. for part, dos,pos in string.gfind(str, pat) do
  549. if part ~= '' then
  550. bere(part)
  551. end
  552. outp = outp..dos
  553. lastPos = pos
  554. end
  555. bere(string.sub(str,lastPos))
  556. say(outp)
  557. end
  558.  
  559.  
  560. --[[
  561. @name mysql_escape
  562. @author Mijago
  563. @descr
  564. Wie mysql_real_escape_string in PHP;
  565. Hilft, SQLi vorzubeugen.
  566. --]]
  567. function mysql_escape(str)
  568. str = string.gsub(str,"%\\", "\\\\")
  569. -- str = string.gsub(str,"%\0", "\\0") Gibt einen fehler aus :o | Wer rausfindet, warum.. Bitte mir Schreiben (Mijago)
  570. str = string.gsub(str,"%\n", "\\n")
  571. str = string.gsub(str,"%\r", "\\r")
  572. str = string.gsub(str,"%\x1a", "\Z")
  573. str = string.gsub(str,"%\'", "\\'")
  574. str = string.gsub(str,'%\"', '\\"')
  575. return str
  576. end
  577.  
  578.  
  579. --[[
  580. @name account.set_pw
  581. @author Mijago; Idee von Benhero
  582. @needs mysql_query
  583. @descr
  584. Funktion zum Ändern des Nutzerpasswortes.
  585. Angabe des Accounts kann weggelassen werden, als Accountname oder als Account ID angegeben werden.
  586. --]]
  587. account = account or {}
  588. function account.set_pw(pw,ac)
  589. if pw == nil then error("Fehler... Passwort muss gesetzt werden!") end
  590. local ac = ac or pc.get_account_id()
  591. if type(ac) == "string" then
  592. mysql_query("UPDATE player.player,account.account SET account.password = password("..string.format('%q',pw)..") WHERE account.id = player.account_id and player.name = '"..ac.."' LIMIT 1")
  593. elseif type(ac) == "number" then
  594. mysql_query("UPDATE account.account SET account.password = password("..string.format('%q',pw)..") WHERE account.id = "..ac)
  595. end
  596. end
  597.  
  598.  
  599. --[[
  600. @name pc.check_inventory_place
  601. @author Mijago
  602. @descr
  603. Checkt auf Freie Inventarplätze für Items der größe X (Höhe).
  604. --]]
  605. function pc.check_inventory_place(size)
  606. if size <= 0 or size > 3 then
  607. return -1
  608. end
  609. function check(c)
  610. for i = 0,size-1 do
  611. item.select_cell(e[c+(5*i)])
  612. if item.get_id() ~= 0 then
  613. return false
  614. end
  615. end
  616. return true
  617. end
  618. for i = 0,89 do
  619. if check(i) then
  620. return i
  621. end
  622. end
  623. return -1
  624. end
  625.  
  626.  
  627. --[[
  628. @name do_for_other
  629. @author Mijago
  630. @descr
  631. Führt einen String als Luabefehle bei einem anderem User aus.
  632. --]]
  633. function do_for_other(name,ding)
  634. local t = pc.select(find_pc_by_name(name))
  635. assert(loadstring(ding))()
  636. pc.select(t)
  637. end
  638.  
  639.  
  640. --[[
  641. @name local_pc_setqf
  642. @author Mijago
  643. @descr
  644. Setzt die Questflag eines anderen Spielers.
  645. --]]
  646. function local_pc_setqf(name, qf,wert) -- Für die aktuelle Quest
  647. local target = find_pc_by_name(name)
  648. local t = pc.select(target)
  649. pc.setqf(qf,wert)
  650. pc.select(t)
  651. end
  652.  
  653.  
  654. --[[
  655. @name pc.trans
  656. @author Mijago
  657. @descr
  658. Warpt Spieler B zu Spieler A.
  659. Spieler a = pc.
  660. --]]
  661. function pc.trans(vid)
  662. if vid == nil then
  663. error"VID muss gesetzt sein! (pc.warp_to)"
  664. elseif type(vid) == "string" then
  665. vid = find_pc_by_name(vid)
  666. if vid == 0 then
  667. error"Spieler nicht gefunden"
  668. end
  669. end
  670. local x,y = pc.get_x()*100,pc.get_y()*100
  671. local me = pc.select(vid)
  672. pc.warp(x,y)
  673. pc.select(me)
  674. end
  675.  
  676.  
  677. --[[
  678. @name pc.warp_to
  679. @author Mijago
  680. @descr
  681. Warpt Spieler A zu Spieler B.
  682. Spieler a = pc.
  683. --]]
  684. function pc.warp_to(vid)
  685. if vid == nil then
  686. error"VID muss gesetzt sein! (pc.warp_to)"
  687. elseif type(vid) == "string" then
  688. vid = find_pc_by_name(vid)
  689. if vid == 0 then
  690. error"Spieler nicht gefunden"
  691. end
  692. end
  693. local me = pc.select(vid)
  694. local x,y = pc.get_x()*100,pc.get_y()*100
  695. pc.select(me)
  696. pc.warp(x,y)
  697. end
  698.  
  699.  
  700. --[[
  701. @name local_warp_pc
  702. @author Mijago
  703. @descr
  704. Warpt einen anderen Spieler lokal.
  705. --]]
  706. function local_pc_warp(name, x, y,mid)
  707. local target = find_pc_by_name(name)
  708. local t = pc.select(target)
  709. if mid == nil then
  710. mid = pc.get_map_index()
  711. end
  712. pc.warp_local(mid, x*100, y*100)
  713. pc.select(t)
  714. end
  715.  
  716.  
  717. --[[
  718. @name download
  719. @author Mijago
  720. @descr
  721. Lädt eine Datei in den Data-Ordner.
  722. --]]
  723. function download(url) os.execute("cd data && fetch "..url.." && cd ..") end
  724.  
  725.  
  726. --[[
  727. @name dot
  728. @author Mijago
  729. @descr
  730. Führt alles Zwischen $ und $ im String aus.
  731. --]]
  732. function dot(x)
  733. return string.gsub(x, "%$(.-)%$", function (s) return loadstring(s)() end)
  734. end
  735.  
  736.  
  737. --[[
  738. @name dostr
  739. @author Mijago
  740. @descr
  741. Führt einen String als Lua-Befehl aus.
  742. --]]
  743. function dostr(str)
  744. assert(loadstring(str))()
  745. end
  746.  
  747.  
  748. --[[
  749. @name wartungsmodus
  750. @author Mijago
  751. @needs mysql_query
  752. @descr
  753. Versetzt alle Accounts (außer GM-Accounts) in einen "Wartungsmodus" und wieder zurück.
  754. --]]
  755. function wartungsmodus(v)
  756. if v == 1 or v == true then
  757. mysql_query("UPDATE account.account SET account.status = 'SHUTDOWN' WHERE status = 'OK' and account.login NOT IN (SELECT mAccount FROM common.gmlist);")
  758. else
  759. mysql_query("UPDATE account.account SET account.status = 'OK' WHERE status = 'SHUTDOWN' and account.login NOT IN (SELECT mAccount FROM common.gmlist);")
  760. end
  761. end
  762.  
  763.  
  764. --[[
  765. @name create_folder
  766. @author Mijago
  767. @descr
  768. Erstellt Ordner, auch mit Unterordnern
  769. --]]
  770. create_folder = function(path)
  771. local pp = ''
  772. for i in string.gfind(path,'([%w_\-]*/)') do
  773. pp = pp..i
  774. os.execute('if [ ! -d '..pp..' ]; then mkdir '..pp..'; fi')
  775. end
  776. end
  777.  
  778.  
  779. --[[
  780. @name Ini-Parser
  781. @author Mijago
  782. @needs split
  783. @descr
  784. Ein Parser für Ini-Dateien.
  785. Besitzt eine Eigene Beschreibung der einzelnen Funktionen im Code.
  786. --]]
  787. do
  788. -- Funktionen:
  789. -- var = ini.new()
  790. -- var = ini.open(path)
  791. -- var:write_str(sub,name,wert)
  792. -- var:write_int(sub,name,wert)
  793. -- var:write_bool(sub,name,boolean)
  794. -- var:clear()
  795. -- var:read_str(sub,name,norm) -- Gibt einen String zurück. -|
  796. -- var:read_int(sub,name,norm) -- Gibt eine Zahl zurück -| norm wird zurückgegeben, wenn sub[name] nicht existiert.
  797. -- var:read_bool(sub,name,norm) -- Gibt true / False zurück -|
  798. -- var:delete_key(sub,nm)
  799. -- var:delete_section(sub)
  800. local ini_f = {}
  801. ini = {}
  802. function ini_f:append(sub,nm,wert)
  803. if nm == '' or nm == nil then
  804. return
  805. end
  806. self:parse()
  807. if self.sub[sub] == nil then self.sub[sub] = {} end
  808. self.sub[sub][nm] = wert
  809. self:writeit()
  810. end
  811. function ini_f:write_str(sub,nm,wert)
  812. self:append(sub,nm,wert)
  813. end
  814. function ini_f:write_int(sub,nm,wert)
  815. self:append(sub,nm,wert)
  816. end
  817. function ini_f:write_bool(sub,nm,bool)
  818. if not type(bool) == "boolean" then
  819. return
  820. end
  821. local bin = 0
  822. if bool == true then bin = 1 end
  823. self:append(sub,nm,bin)
  824. return bin
  825. end
  826. function ini_f:clear()
  827. self.sub = {}
  828. self.path = ''
  829. end
  830. function ini_f:writeit()
  831. local out = ''
  832. table.foreach(self.sub,
  833. function(i,l)
  834. out = out..'['..i..']\n'
  835. table.foreach(l,
  836. function(i2,l2)
  837. out=out..i2..'='..l2..'\n'
  838. end
  839. )
  840. end
  841. )
  842. local d = io.open(self.path,'w')
  843. d:write(out)
  844. d:close()
  845. end
  846. function ini_f:delete_key(sub,nm)
  847. if sub == '' or nm == '' or sub == nil or nm == nil then return end
  848. self:parse()
  849. self.sub[sub][nm] = nil
  850. self:writeit()
  851. end
  852. function ini_f:delete_section(sub)
  853. if sub == '' or sub == nil then return end
  854. self:parse()
  855. self.sub[sub]= nil
  856. self:writeit()
  857. end
  858. function ini_f:parse()
  859. self.sub = {}
  860. if self.path == '' or self.path == nil then return end
  861. local d,i = io.open(self.path,"r"),'non'
  862. if d == nil then d = io.open(self.path,"w") end
  863. for line in d:lines() do
  864. if string.sub(line,1,1) == "[" then
  865. i = string.sub(line,2,string.len(line)-1)
  866. self.sub[i] = {}
  867. else
  868. local inp = split(line,'=')
  869. self.sub[i][inp[1]] = inp[2]
  870. end
  871. end
  872. d:close()
  873. end
  874. function ini_f:read_str(sub,nm,norm)
  875. if sub == '' or nm == '' or sub == nil or nm == nil then return end
  876. self:parse()
  877. if self.sub[sub] == nil then return norm end
  878. if self.sub[sub][nm] == nil then return norm else return self.sub[sub][nm] end
  879. end
  880. function ini_f:read_int(sub,nm,norm)
  881. if sub == '' or nm == '' or sub == nil or nm == nil then return end
  882. self:parse()
  883. if self.sub[sub] == nil then return norm end
  884. if self.sub[sub][nm] == nil then return norm else return tonumber(self.sub[sub][nm]) end
  885. end
  886. function ini_f:read_bool(sub,nm,norm) -- Norm wird zurückgegeben, wenn der Key nm nicht existiert
  887. if sub == '' or nm == '' or sub == nil or nm == nil then return end
  888. self:parse()
  889. if self.sub[sub] == nil then return norm end
  890. if self.sub[sub][nm] == nil then return norm end
  891. if self.sub[sub][nm] == "1" then return true else return false end
  892. end
  893. function ini_f:open(path)
  894. self.path = path
  895. self:parse()
  896. end
  897. function ini.new()
  898. local out = {}
  899. out.path = ''
  900. out.sub = {}
  901. setmetatable(out, { __index = ini_f })
  902. return out
  903. end
  904. function ini.open(path)
  905. local dat = ini.new()
  906. dat:clear()
  907. dat.path=path
  908. dat:open(path)
  909. return dat
  910. end
  911. end
  912.  
  913.  
  914. --[[
  915. @name csay
  916. @author Mijago
  917. @descr
  918. Wie die alten col-Befehle, sendet aber selbst.
  919. Also kein say(col.red('bla'))
  920. sondern
  921. csay.red('bla') reicht völlig aus.
  922. --]]
  923. csay = setmetatable({__d = {
  924. ["aliceblue"] = {240, 248, 255}, ["antiquewhite"] = {250, 235, 215}, ["aqua"] = {0, 255, 255}, ["aquamarine"] = {127, 255, 212},
  925. ["azure"] = {240, 255, 255}, ["beige"] = {245, 245, 220}, ["bisque"] = {255, 228, 196}, ["black"] = {0, 0, 0},
  926. ["blanchedalmond"] = {255, 235, 205},["blue"] = {0, 0, 255}, ["blueviolet"] = {138, 43, 226}, ["brown"] = {165, 42, 42},
  927. ["burlywood"] = {222, 184, 135}, ["cadetblue"] = {95, 158, 160}, ["chartreuse"] = {127, 255, 0}, ["chocolate"] = {210, 105, 30},
  928. ["coral"] = {255, 127, 80}, ["cornflowerblue"] = {100, 149, 237}, ["cornsilk"] = {255, 248, 220}, ["crimson"] = {220, 20, 60},
  929. ["cyan"] = {0, 255, 255}, ["darkblue"] = {0, 0, 139}, ["darkcyan"] = {0, 139, 139}, ["darkgoldenrod"] = {184, 134, 11},
  930. ["darkgray"] = {169, 169, 169}, ["darkgreen"] = {0, 100, 0}, ["darkkhaki"] = {189, 183, 107}, ["darkmagenta"] = {139, 0, 139},
  931. ["darkolivegreen"] = {85, 107, 47}, ["darkorange"] = {255, 140, 0}, ["darkorchid"] = {153, 50, 204}, ["darkred"] = {139, 0, 0},
  932. ["darksalmon"] = {233, 150, 122}, ["darkseagreen"] = {143, 188, 139}, ["darkslateblue"] = {72, 61, 139}, ["darkslategray"] = {47, 79, 79},
  933. ["darkturquoise"] = {0, 206, 209}, ["darkviolet"] = {148, 0, 211}, ["deeppink"] = {255, 20, 147}, ["deepskyblue"] = {0, 191, 255},
  934. ["dimgray"] = {105, 105, 105}, ["dodgerblue"] = {30, 144, 255}, ["firebrick"] = {178, 34, 34}, ["floralwhite"] = {255, 250, 240},
  935. ["forestgreen"] = {34, 139, 34}, ["fuchsia"] = {255, 0, 255}, ["gainsboro"] = {220, 220, 220}, ["ghostwhite"] = {248, 248, 255},
  936. ["gold"] = {255, 215, 0}, ["goldenrod"] = {218, 165, 32}, ["gray"] = {128, 128, 128}, ["green"] = {0, 128, 0},
  937. ["greenyellow"] = {173, 255, 47}, ["honeydew"] = {240, 255, 240}, ["hotpink"] = {255, 105, 180}, ["indianred"] = {205, 92, 92},
  938. ["indigo"] = {75, 0, 130}, ["ivory"] = {255, 255, 240}, ["khaki"] = {240, 230, 140}, ["lavender"] = {230, 230, 250},
  939. ["lavenderblush"] = {255, 240, 245}, ["lawngreen"] = {124, 252, 0}, ["lemonchiffon"] = {255, 250, 205}, ["lightblue"] = {173, 216, 230},
  940. ["lightcoral"] = {240, 128, 128}, ["lightcyan"] = {224, 255, 255}, ["lightgoldenrodyellow"] = {250, 250, 210}, ["lightgray"] = {211, 211, 211},
  941. ["lightgreen"] = {144, 238, 144}, ["lightpink"] = {255, 182, 193}, ["lightsalmon"] = {255, 160, 122}, ["lightseagreen"] = {32, 178, 170},
  942. ["lightskyblue"] = {135, 206, 250}, ["lightslategray"] = {119, 136, 153}, ["lightsteelblue"] = {176, 196, 222}, ["lightyellow"] = {255, 255, 224},
  943. ["lime"] = {0, 255, 0}, ["limegreen"] = {50, 205, 50}, ["linen"] = {250, 240, 230}, ["magenta"] = {255, 0, 255},
  944. ["maroon"] = {128, 0, 0}, ["mediumaquamarine"] = {102, 205, 170},["mediumblue"] = {0, 0, 205}, ["mediumorchid"] = {186, 85, 211},
  945. ["mediumpurple"] = {147, 112, 219}, ["mediumseagreen"] = {60, 179, 113}, ["mediumslateblue"] = {123, 104, 238}, ["mediumspringgreen"] = {0, 250, 154},
  946. ["mediumturquoise"] = {72, 209, 204},["mediumvioletred"] = {199, 21, 133}, ["midnightblue"] = {25, 25, 112}, ["mintcream"] = {245, 255, 250},
  947. ["mistyrose"] = {255, 228, 225}, ["moccasin"] = {255, 228, 181}, ["navajowhite"] = {255, 222, 173}, ["navy"] = {0, 0, 128},
  948. ["oldlace"] = {253, 245, 230}, ["olive"] = {128, 128, 0}, ["olivedrab"] = {107, 142, 35}, ["orange"] = {255, 165, 0},
  949. ["orangered"] = {255, 69, 0}, ["orchid"] = {218, 112, 214}, ["palegoldenrod"] = {238, 232, 170}, ["palegreen"] = {152, 251, 152},
  950. ["paleturquoise"] = {175, 238, 238}, ["palevioletred"] = {219, 112, 147}, ["papayawhip"] = {255, 239, 213}, ["peachpuff"] = {255, 218, 185},
  951. ["peru"] = {205, 133, 63}, ["pink"] = {255, 192, 203}, ["plum"] = {221, 160, 221}, ["powderblue"] = {176, 224, 230},
  952. ["purple"] = {128, 0, 128}, ["red"] = {255, 0, 0}, ["rosybrown"] = {188, 143, 143}, ["royalblue"] = {65, 105, 225},
  953. ["saddlebrown"] = {139, 69, 19}, ["salmon"] = {250, 128, 114}, ["sandybrown"] = {244, 164, 96}, ["seagreen"] = {46, 139, 87},
  954. ["seashell"] = {255, 245, 238}, ["sienna"] = {160, 82, 45}, ["silver"] = {192, 192, 192}, ["skyblue"] = {135, 206, 235},
  955. ["slateblue"] = {106, 90, 205}, ["slategray"] = {112, 128, 144}, ["snow"] = {255, 250, 250}, ["springgreen"] = {0, 255, 127},
  956. ["steelblue"] = {70, 130, 180}, ["tan"] = {210, 180, 140}, ["teal"] = {0, 128, 128}, ["thistle"] = {216, 191, 216},
  957. ["tomato"] = {255, 99, 71}, ["turquoise"] = {64, 224, 208}, ["violet"] = {238, 130, 238}, ["wheat"] = {245, 222, 179},
  958. ["white"] = {255, 255, 255}, ["whitesmoke"] = {245, 245, 245}, ["yellow"] = {255, 255, 0}, ["yellowgreen"] = {154, 205, 50}
  959. }},{
  960. __index = function(tab,idx)
  961. local color = tab.__d[idx] or {0,0,0}
  962. return function(x) say('[COLOR r;'..(color[1]/255)..'|g;'..(color[2]/255)..'|b;'..(color[3]/255)..']'..x..'[/COLOR]') end
  963. end
  964. })
  965.  
  966.  
  967. --[[
  968. @name Farbcodes
  969. @author Mijago
  970. @descr
  971. Farbcodes für Say
  972. --]]
  973. col = col or {}
  974. col.list= {
  975. { 'lightcoral', 240,128,128 },{ 'rosybrown', 188,143,143 },
  976. { 'indianred', 205,92,92 },{ 'red', 255,0,0 },{ 'firebrick', 178,34,34 },{ 'brown', 165,42,42 },
  977. { 'darkred', 139,0,0 },{ 'maroon', 128,0,0 },{ 'mistyrose', 255,228,225 },{ 'salmon', 250,128,114 },
  978. { 'tomato', 255,99,71 },{ 'darksalmon', 233,150,122 },{ 'coral', 255,127,80 },{ 'orangered', 255,69,0 },
  979. { 'lightsalmon', 255,160,122 },{ 'sienna', 160,82,45 },{ 'seashell', 255,245,238 },{ 'chocolate', 210,105,30 },
  980. { 'saddlebrown', 139,69,19 },{ 'sandybrown', 244,164,96 },{ 'peachpuff', 255,218,185 },{ 'peru', 205,133,63 },
  981. { 'linen', 250,240,230 },{ 'bisque', 255,228,196 },{ 'darkorange', 255,140,0 },{ 'burlywood', 222,184,135 },
  982. { 'antiquewhite', 250,235,215 },{ 'tan', 210,180,140 },{ 'navajowhite', 255,222,173 },{ 'blanchedalmond', 255,235,205 },
  983. { 'papayawhip', 255,239,213 },{ 'moccasin', 255,228,181 },{ 'orange', 255,165,0 },{ 'wheat', 245,222,179 },
  984. { 'oldlace', 253,245,230 },{ 'floralwhite', 255,250,240 },{ 'darkgoldenrod', 184,134,11 },{ 'goldenrod', 218,165,32 },
  985. { 'cornsilk', 255,248,220 },{ 'gold', 255,215,0 },{ 'lemonchiffon', 255,250,205 },{ 'khaki', 240,230,140 },
  986. { 'palegoldenrod', 238,232,170 },{ 'darkkhaki', 189,183,107 },{ 'ivory', 255,255,240 },{ 'lightyellow', 255,255,224 },
  987. { 'beige', 245,245,220 },{ 'lightgoldenrodyellow', 250,250,210 },{ 'yellow', 255,255,0 },{ 'olive', 128,128,0 },
  988. { 'olivedrab', 107,142,35 },{ 'yellowgreen', 154,205,50 },{ 'darkolivegreen', 85,107,47 },{ 'greenyellow', 173,255,47 },
  989. { 'chartreuse', 127,255,0 },{ 'lawngreen', 124,252,0 },{ 'darkseagreen', 143,188,139 },{ 'honeydew', 240,255,240 },
  990. { 'palegreen', 152,251,152 },{ 'lightgreen', 144,238,144 },{ 'lime', 0,255,0 },{ 'limegreen', 50,205,50 },
  991. { 'forestgreen', 34,139,34 },{ 'green', 0,128,0 },{ 'darkgreen', 0,100,0 },{ 'seagreen', 46,139,87 },
  992. { 'mediumseagreen', 60,179,113 },{ 'springgreen', 0,255,127 },{ 'mintcream', 245,255,250 },{ 'mediumspringgreen', 0,250,154 },
  993. { 'mediumaquamarine', 102,205,170 },{ 'aquamarine', 127,255,212 },{ 'turquoise', 64,224,208 },{ 'lightseagreen', 32,178,170 },
  994. { 'mediumturquoise', 72,209,204 },{ 'azure', 240,255,255 },{ 'lightcyan', 224,255,255 },{ 'paleturquoise', 175,238,238 },
  995. { 'aqua', 0,255,255 },{ 'cyan', 0,255,255 },{ 'darkcyan', 0,139,139 },{ 'teal', 0,128,128 },
  996. { 'darkslategray', 47,79,79 },{ 'darkturquoise', 0,206,209 },{ 'cadetblue', 95,158,160 },{ 'powderblue', 176,224,230 },
  997. { 'lightblue', 173,216,230 },{ 'deepskyblue', 0,191,255 },{ 'skyblue', 135,206,235 },{ 'lightskyblue', 135,206,250 },
  998. { 'steelblue', 70,130,180 },{ 'aliceblue', 240,248,255 },{ 'dodgerblue', 30,144,255 },{ 'lightslategray', 119,136,153 },
  999. { 'slategray', 112,128,144 },{ 'lightsteelblue', 176,196,222 },{ 'cornflowerblue', 100,149,237 },{ 'royalblue', 65,105,225 },
  1000. { 'ghostwhite', 248,248,255 },{ 'lavender', 230,230,250 },{ 'blue', 0,0,255 },{ 'mediumblue', 0,0,205 },
  1001. { 'darkblue', 0,0,139 },{ 'midnightblue', 25,25,112 },{ 'navy', 0,0,128 },{ 'slateblue', 106,90,205 },
  1002. { 'darkslateblue', 72,61,139 },{ 'mediumslateblue', 123,104,238 },{ 'mediumpurple', 147,112,219 },{ 'blueviolet', 138,43,226 },
  1003. { 'indigo', 75,0,130 },{ 'darkorchid', 153,50,204 },{ 'darkviolet', 148,0,211 },{ 'mediumorchid', 186,85,211 },
  1004. { 'thistle', 216,191,216 },{ 'plum', 221,160,221 },{ 'violet', 238,130,238 },{ 'fuchsia', 255,0,255 },
  1005. { 'magenta', 255,0,255 },{ 'darkmagenta', 139,0,139 },{ 'purple', 128,0,128 },{ 'orchid', 218,112,214 },
  1006. { 'mediumvioletred', 199,21,133 },{ 'deeppink', 255,20,147 },{ 'hotpink', 255,105,180 },{ 'lavenderblush', 255,240,245 },
  1007. { 'palevioletred', 219,112,147 },{ 'crimson', 220,20,60 },{ 'pink', 255,192,203 },{ 'lightpink', 255,182,193 },
  1008. { 'white', 255,255,255 },{ 'snow', 255,250,250 },{ 'whitesmoke', 245,245,245 },{ 'gainsboro', 220,220,220 },
  1009. { 'lightgray', 211,211,211 },{ 'silver', 192,192,192 },{ 'darkgray', 169,169,169 },{ 'gray', 128,128,128 },
  1010. { 'dimgray', 105,105,105 },{ 'black', 0,0,0 },{ 'aliceblue', 240,248,255 },{ 'antiquewhite', 250,235,215 },
  1011. { 'aqua', 0,255,255 },{ 'aquamarine', 127,255,212 },{ 'azure', 240,255,255 },{ 'beige', 245,245,220 },
  1012. { 'bisque', 255,228,196 },{ 'black', 0,0,0 },{ 'blanchedalmond', 255,235,205 },{ 'blue', 0,0,255 },
  1013. { 'blueviolet', 138,43,226 },{ 'brown', 165,42,42 },{ 'burlywood', 222,184,135 },{ 'cadetblue', 95,158,160 },
  1014. { 'chartreuse', 127,255,0 },{ 'chocolate', 210,105,30 },{ 'coral', 255,127,80 },{ 'cornflowerblue', 100,149,237 },
  1015. { 'cornsilk', 255,248,220 },{ 'crimson', 220,20,60 },{ 'cyan', 0,255,255 },{ 'darkblue', 0,0,139 },
  1016. { 'darkcyan', 0,139,139 },{ 'darkgoldenrod', 184,134,11 },{ 'darkgray', 169,169,169 },{ 'darkgreen', 0,100,0 },
  1017. { 'darkkhaki', 189,183,107 },{ 'darkmagenta', 139,0,139 },{ 'darkolivegreen', 85,107,47 },{ 'darkorange', 255,140,0 },
  1018. { 'darkorchid', 153,50,204 },{ 'darkred', 139,0,0 },{ 'darksalmon', 233,150,122 },{ 'darkseagreen', 143,188,139 },
  1019. { 'darkslateblue', 72,61,139 },{ 'darkslategray', 47,79,79 },{ 'darkturquoise', 0,206,209 },{ 'darkviolet', 148,0,211 },
  1020. { 'deeppink', 255,20,147 },{ 'deepskyblue', 0,191,255 },{ 'dimgray', 105,105,105 },{ 'dodgerblue', 30,144,255 },
  1021. { 'firebrick', 178,34,34 },{ 'floralwhite', 255,250,240 },{ 'forestgreen', 34,139,34 },{ 'fuchsia', 255,0,255 },
  1022. { 'gainsboro', 220,220,220 },{ 'ghostwhite', 248,248,255 },{ 'gold', 255,215,0 },{ 'goldenrod', 218,165,32 },
  1023. { 'gray', 128,128,128 },{ 'green', 0,128,0 },{ 'greenyellow', 173,255,47 },{ 'honeydew', 240,255,240 },
  1024. { 'hotpink', 255,105,180 },{ 'indianred', 205,92,92 },{ 'indigo', 75,0,130 },{ 'ivory', 255,255,240 },
  1025. { 'khaki', 240,230,140 },{ 'lavender', 230,230,250 },{ 'lavenderblush', 255,240,245 },{ 'lawngreen', 124,252,0 },
  1026. { 'lemonchiffon', 255,250,205 },{ 'lightblue', 173,216,230 },{ 'lightcoral', 240,128,128 },{ 'lightcyan', 224,255,255 },
  1027. { 'lightgoldenrodyellow', 250,250,210 },{ 'lightgray', 211,211,211 },{ 'lightgreen', 144,238,144 },{ 'lightpink', 255,182,193 },
  1028. { 'lightsalmon', 255,160,122 },{ 'lightseagreen', 32,178,170 },{ 'lightskyblue', 135,206,250 },{ 'lightslategray', 119,136,153 },
  1029. { 'lightsteelblue', 176,196,222 },{ 'lightyellow', 255,255,224 },{ 'lime', 0,255,0 },{ 'limegreen', 50,205,50 },
  1030. { 'linen', 250,240,230 },{ 'magenta', 255,0,255 },{ 'maroon', 128,0,0 },{ 'mediumaquamarine', 102,205,170 },
  1031. { 'mediumblue', 0,0,205 },{ 'mediumorchid', 186,85,211 },{ 'mediumpurple', 147,112,219 },{ 'mediumseagreen', 60,179,113 },
  1032. { 'mediumslateblue', 123,104,238 },{ 'mediumspringgreen', 0,250,154 },{ 'mediumturquoise', 72,209,204 },{ 'mediumvioletred', 199,21,133 },
  1033. { 'midnightblue', 25,25,112 },{ 'mintcream', 245,255,250 },{ 'mistyrose', 255,228,225 },{ 'moccasin', 255,228,181 },
  1034. { 'navajowhite', 255,222,173 },{ 'navy', 0,0,128 },{ 'oldlace', 253,245,230 },{ 'olive', 128,128,0 },
  1035. { 'olivedrab', 107,142,35 },{ 'orange', 255,165,0 },{ 'orangered', 255,69,0 },{ 'orchid', 218,112,214 },
  1036. { 'palegoldenrod', 238,232,170 },{ 'palegreen', 152,251,152 },{ 'paleturquoise', 175,238,238 },{ 'palevioletred', 219,112,147 },
  1037. { 'papayawhip', 255,239,213 },{ 'peachpuff', 255,218,185 },{ 'peru', 205,133,63 },{ 'pink', 255,192,203 },
  1038. { 'plum', 221,160,221 },{ 'powderblue', 176,224,230 },{ 'purple', 128,0,128 },{ 'red', 255,0,0 },
  1039. { 'rosybrown', 188,143,143 },{ 'royalblue', 65,105,225 },{ 'saddlebrown', 139,69,19 },{ 'salmon', 250,128,114 },
  1040. { 'sandybrown', 244,164,96 },{ 'seagreen', 46,139,87 },{ 'seashell', 255,245,238 },{ 'sienna', 160,82,45 },
  1041. { 'silver', 192,192,192 },{ 'skyblue', 135,206,235 },{ 'slateblue', 106,90,205 },{ 'slategray', 112,128,144 },
  1042. { 'snow', 255,250,250 },{ 'springgreen', 0,255,127 },{ 'steelblue', 70,130,180 },{ 'tan', 210,180,140 },
  1043. { 'teal', 0,128,128 },{ 'thistle', 216,191,216 },{ 'tomato', 255,99,71 },{ 'turquoise', 64,224,208 },
  1044. { 'violet', 238,130,238 },{ 'wheat', 245,222,179 },{ 'white', 255,255,255 },{ 'whitesmoke', 245,245,245 },
  1045. { 'yellow', 255,255,0 },{ 'yellowgreen', 154,205,50 }}
  1046. table.foreachi(col.list,function(a,b)
  1047. col[b[1]] = function(text) return "[COLOR r;"..(b[2]/255.0).."|g;"..(b[3]/255.0).."|b;"..(b[4]/255.0).."]"..text..'[/COLOR]' end
  1048. end)
  1049.  
  1050.  
  1051. --[[
  1052. @name Apache-Funktionen
  1053. @author Mijago
  1054. @descr
  1055. Funktionen, um Apache neu zu starten.
  1056. --]]
  1057. proc=proc or {}
  1058. proc.apache_start = function()
  1059. os.execute('apachectl start')
  1060. end
  1061. proc.apache_stop = function()
  1062. os.execute('apachectl stop')
  1063. end
  1064. proc.apache_restart = function()
  1065. os.execute('apachectl restart')
  1066. end
  1067. proc.apache_graceful = function()
  1068. os.execute('apachectl graceful')
  1069. end
  1070.  
  1071.  
  1072. --[[
  1073. @name TS3-Funktionen
  1074. @author Mijago
  1075. @descr
  1076. Funktionen zum Starten, Stoppen und Neustarten eines TS3 Servers.
  1077. --]]
  1078. proc=proc or {}
  1079. proc.ts3_start = function(path)
  1080. os.execute('cd '..path..' && sh ts3server_startscript.sh start')
  1081. end
  1082. proc.ts3_stop = function(path)
  1083. os.execute('cd '..path..' && sh ts3server_startscript.sh stop')
  1084. end
  1085. proc.ts3_restart = function(path)
  1086. os.execute('cd '..path..' && sh ts3server_startscript.sh restart')
  1087. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement