Advertisement
Guest User

Untitled

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