Rancoroso 604 Posted January 18, 2013 Bom novas funções para quem precisa.Add no questlib.lua: --[[ Questliberweiterung generiert by Mijago Link: http://mijago.mi.funpic.de/questing/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&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&b1001=1&b1002=1&b1003=1&b1004=1&b2002=1 Funktionen: split, mysql_query, mysql_query_old, duration, is_number, is_string, is_table, in_table, numlen, string.reverse, num_format, numtomoney, n_input, select2, select3, note (Notice Mod), Zeitrechnungen, Autoumbruch in Say, mysql_escape, account.set_pw, pc.check_inventory_place, do_for_other, local_pc_setqf, pc.trans, pc.warp_to, local_warp_pc, download, dot, dostr, wartungsmodus, Ini-Parser, csay, Farbcodes, Apache-Funktionen, TS3-Funktionen--]]--[[ @name split @author Internet @descrSplittet einen String in eine Tabelle.--]]function split(str, delim, maxNb) if str == nil then return str end if string.find(str, delim) == nil then return { str } end if maxNb == nil or maxNb &--#60; 1 then maxNb = 0 end local result = {} local pat = "(.-)" .. delim .. "()" local nb = 0 local lastPos for part, pos in string.gfind(str, pat) do nb = nb + 1 result[nb] = part lastPos = pos if nb == maxNb then break end end if nb ~= maxNb then result[nb + 1] = string.sub(str, lastPos) end return resultend--[[ @name mysql_query @author Mijago @needs split @descrMysql-Funktion der neuesten Generation.--]]mysql_query = function(query) if not pre then local rt = io.open('CONFIG','r'):read('*all') pre,_= string.gsub(rt,'.+PLAYER_SQL:%s(%S+)%s(%S+)%s(%S+)%s(%S+).+','-h%1 -u%2 -p%3 -D%4') end math.randomseed(os.time()) local fi,t,out = 'mysql_data_'..math.random(10^9)+math.random(2^4,2^10),{},{} os.execute('mysql '..pre..' --e='..string.format('%q',query)..' &--#62; '..fi) -- para MySQL5.1 -- os.execute('mysql '..pre..' -e'..string.format('%q',query)..' &--#62; '..fi) -- para MySQL5.5 for av in io.open(fi,'r'):lines() do table.insert(t,split(av,'t')) end; os.remove(fi); for i = 2, table.getn(t) do table.foreach(t[i],function(a,b) out[i-1] = out[i-1] or {} out[i-1][a] = tonumber(b) or b or 'NULL' out[t[1][a]] = out[t[1][a]] or {} out[t[1][a]][i-1] = tonumber(b) or b or 'NULL' end) end out.__lines = t[1] return outend--[[ @name mysql_query_old @author Mijago @needs split @descrDie Alte Version der MySQL-Query-Funktion.--]]function mysql_query_old(query,user,pass,db,ip) local pre = '' if query == '' or query == nil then error("Query muss gesetzt sein!") end user = user or ql.mysql["user"] pass = pass or ql.mysql["pass"] ip = ip or ql.mysql["ip"] if user ~= '' and user ~= nil then pre = pre..' -u'..user end if pass ~= '' and pass ~= nil then pre = pre..' -p'..pass end if db ~= '' and db ~= nil then pre = pre..' -D'..db end if ip ~= '' and ip ~= nil then pre = pre..' -h'..ip end math.randomseed(os.time()); local rand = math.random(0,10^7) -- Erstellen der Pfadvariable local path = 'data/mysql_output_'..os.time()..'_'..rand..'_'..pc.get_vid() os.execute ("mysql "..pre.." --e=""..query.."" &--#62; "..path) -- Laden und Auflisten der Dateiinhalte local fi,q = io.open(path,"r"),{["l"] = {},["out"]={}} if fi == nil then return "ERROR" end for line in fi:lines() do table.insert(q.l,(split(line,"t"))) end os.remove(path) if type(q.l[1]) ~= "table" then return "ERROR" --error("Fehler bei der MySQL Verbindung oder bei der Rückgabe! Abbruch!") end local ix = 0 table.foreachi(q.l,function(i,l) if i &--#62; 1 then table.foreach(l,function(i2,l2) if q.out[q.l[1][i2]] == nil then q.out[q.l[1][i2]] = {} end local c = tonumber(l2) if type(c) == "number" and l2 == tostring(c) then q.out[q.l[1][i2]][i-1] = c else q.out[q.l[1][i2]][i-1] = l2 end end) end end) -- ENDE der eigentlichen MySQL-Funktion -- START Zusatz: Hanashi-Kompatibilität & Fehlerbehandlung q.out.__data = q.l[1] setmetatable(q.out, { __index = function(a,b) if type(b) == "number" then return (a[a.__data[b]] or {"ERROR"}) end return "ERROR" --error("Fehler bei Indexierung: Index "..b.." ist nicht vorhanden!") end}) return q.outend--[[ @name duration @author Mijago @descrGibt die verbleibende Zeit als String zurück.--]]function duration(ipe) local ipe,dat= ipe or 0,'' local s,m,h,d,y = tonumber(os.date('%S',ipe)), tonumber(os.date('%M',ipe)), tonumber(os.date('%H',ipe)), tonumber(os.date('%d',ipe))-1, tonumber(os.date('%Y',ipe))-1970 print(s,m,h,d,y) for x,c in {{s,"Sek."},{m,"Min."},{h,"Std."},{d,"Tage"},{Y,"Jahre"}} do if (c[1] or 0) &--#62; 0 then if x &--#62; 1 then dat = ' '..dat end dat = c[1]..' '..c[2]..dat end end return datend--[[ @name is_number @author Mijago @descrPrüft, ob eine Variable eine Zahl ist.--]]function is_number(var) return (type(var) == "number")end --[[ @name is_string @author Mijago @descrPrüft, ob eine Variable ein String ist.--]]function is_string(var) return (type(var) == "string")end--[[ @name is_table @author Mijago @descrPrüft, ob eine Variable eine Tabelle ist.--]]function is_table(var) return (type(var) == "table")end--[[ @name in_table @author Mijago @descrPrüft, ob eine Variablei in einer Tabelle ist.Aufruf: in_table(var,table)--]]function in_table ( e, t ) for _,v in pairs(t) do if (v==e) then return true end end return falseend--[[ @name numlen @author Mijago @descrGibt die Anzahl der Ziffern einer Zahl wieder.--]]function numlen(i) local i,x = i or 0,0 while i &--#62; 10^x do x=x+1 end return xend--[[ @name string.reverse @author Mijago @descrKehrt einen String um.--]]function string.reverse(str) local se = '' for i=1,string.len(str) do se = string.sub(str,i,i)..se end return seend--[[ @name num_format @author Mijago; Idee von Benhero @needs string.reverse @descrFormatiert lange Zahlen mit Punkten.--]]function num_format(num) if type(num) == "number" then num = tostring(num) end if string.len(num) &--#60;= 3 then return num end return string.reverse(string.gsub(string.reverse(num),'(%d%d%d)','%1.'))end--[[ @name numtomoney @author Mijago @descrFormatiert zB 1234567 in 1.234.567.--]]function numtomoney(num) local num,out,x = tostring(num),'',0 while string.len(num)-3 &--#62; 0 do out = string.gsub(num,'.-(%d%d%d)$','.%1')..out num = string.sub(num,0,string.len(num)-3) end return num..outend--[[ @name n_input @author Mijago @descrFür Inputs nur für Zahlen.Die Zahl ist IMMER positiv. Wenn sie nicht gültig ist, ist sie 0.--]]function n_input() return math.abs(tonumber(input()) or 0)end--[[ @name select2 @author Mijago @needs split @descrWie Select:Eine Tabelle oder eine Stringliste wird auf Seiten aufgeteilt.Weiter und Abbrechen Buttons.--]]function select2(tab,...) arg.n = nil if type(tab) ~= "table" and type(tab) == 'number' then table.insert(arg,1,tab) tab = arg elseif type(tab) ~= "table" and type(tab) == 'string' then table.insert(arg,1,tab) table.insert(arg,1,8) tab = arg elseif type(tab) == "table" and type(tab[1]) == 'string' then table.insert(tab,1,8) end local max = tab[1]; table.remove(tab,1) local tablen,outputstr,outputcount,nextc,incit = table.getn(tab),"",0,0,0 table.foreach(tab, function(i,l) outputcount = outputcount + 1 if outputcount == 1 then outputstr=outputstr..'sel = select("'..l..'"' elseif outputcount == max and tablen &--#62; outputcount+incit then if tablen ~= outputcount+incit+1 then outputstr=outputstr..',"'..l..'","Nächste Seite") + '..incit..' ' if nextc &--#62; 0 then outputstr = outputstr..'end ' end outputstr=outputstr..'; if sel == '..(incit+max+1)..' then ' -- Anfangen der neuen Abfrage nextc, outputcount, incit= nextc+1,0,incit+max else outputstr=outputstr..',"'..l..'"' end else outputstr=outputstr..',"'..l..'"' end end ) outputstr = outputstr..') + '..incit if nextc &--#62; 0 then outputstr = outputstr..' end' end outputstr= outputstr.. '; return sel' print(outputstr) local sel = assert(loadstring(outputstr))() tablen,outputstr,outputcount,nextc,incit = nil,nil,nil,nil,nil -- Speicher freimachen return selend--[[ @name select3 @author Mijago @needs split @descrWie Select2:Eine Tabelle oder eine Stringliste wird auf Seiten aufgeteilt.Weiter, Zurück und Abbrechen (-1) Buttons.--]]function select3(...) arg.n = nil local tp,max = arg,5 if type(tp[1]) == 'number' then max = tp[1] if type(tp[2]) == 'table' then tp = tp[2] else table.remove(tp,1) end elseif type(tp[1]) == 'table' then if type(tp[1][1]) == 'number' then max = tp[1][1] table.remove(tp[1],1) tp = tp[1] end tp = tp[1] end local str = '{' local tablen,act,incit = table.getn(tp),0,0 table.foreach(tp,function(i,l) act = act + 1 if act == 1 then str = str .. '{'..string.format('%q',l) elseif act == max+1 and tablen &--#62; act+incit then if tablen ~= act+incit+1 then str = str..'},{'..string.format('%q',l) else str=str..','..string.format('%q',l) end incit = incit + max act = 1 else str=str..','..string.format('%q',l) end end) local px = loadstring('return '..str ..'}}')() local function copy_tab(t) local p= {} for i = 1,table.getn(t) do p[i] = t[i] end return p end local pe = {} for i = 1,table.getn(px) do pe [i] = copy_tab(px[i]) end local function init(i,ip) pe[i] = copy_tab(px[i]) local next,back,exit = 0,0,0 if i &--#60; table.getn(pe) and table.getn(pe) ~=1 then table.insert(pe[i],table.getn(pe[i])[img]http://cyber-gamers.org/public/style_emoticons/<#EMO_DIR#>/451960.gif[/img],'Weiter zu Seite '..(i+1)); next = table.getn(pe[i]) end if i &--#62; 1 then table.insert(pe[i],table.getn(pe[i])[img]http://cyber-gamers.org/public/style_emoticons/<#EMO_DIR#>/451960.gif[/img],'Zurück zu Seite '..(i-1)); back = table.getn(pe[i]) end table.insert(pe[i],table.getn(pe[i])[img]http://cyber-gamers.org/public/style_emoticons/<#EMO_DIR#>/451960.gif[/img],'Abbruch'); exit = table.getn(pe[i]) if table.getn(pe) &--#62; 1 then say('Seite '..i..' von '..table.getn(pe)) end local e = select_table(pe[i]) if e == next then return init(i+1,ip+max) elseif e == back then return init(i-1,ip-max) elseif e == exit then return -1 else return e+ip,pe[i][e] end end return init(1,0) or -1end--[[ @name note (Notice Mod) @author Mijago @descrWie Notice, nur mit Spielername davor.--]]function note(text) notice_all(pc.get_name()..': '..text)end--[[ @name Zeitrechnungen @author Mijago @descrFunktionen zum Umrechenen von Zeit.--]]zt = zt or {}zt.d_j = function(d) return d/365 endzt.d_mo = function(d) return d/12 endzt.d_h = function(d) return d*24 endzt.d_m = function(d) return d*24*60 endzt.d_s = function(d) return d*24*60*60 endzt.d_hs = function(d) return d*24*60*60*100 endzt.d_ms = function(d) return d*24*60*60*1000 end--- Stundenzt.h_j = function(h) return h/24/365 endzt.h_mo = function(h) return h/24/12 endzt.h_d = function(h) return h/24 endzt.h_m = function(h) return h*60 endzt.h_s = function(h) return h*60*60 endzt.h_hs = function(h) return h*60*60*100 endzt.h_ms = function(h) return h*60*60*1000 end--- Minutenzt.m_j = function(m) return m/60/24/365 endzt.m_mo = function(m) return m/60/24/12 endzt.m_d = function(m) return m/60/24 endzt.m_h = function(m) return m/60 endzt.m_s = function(m) return m*60 endzt.m_hs = function(m) return m*60*100 endzt.m_ms = function(m) return m*60*1000 end--- Sekundenzt.s_j = function(s) return s/60/60/24/365 endzt.s_mo = function(s) return s/60/60/24/12 endzt.s_d = function(s) return s/60/60/24 endzt.s_h = function(s) return s/60/60 endzt.s_m = function(s) return s/60 endzt.s_hs = function(s) return s*100 endzt.s_ms = function(s) return s*1000 end --[[ @name Autoumbruch in Say @author Mijago @descrFügt die Funktion say2 an.Mit ihr werden Texte automatisch umgebrochen.--]]function say2(str,dx) local maxl,actl,pat = dx or 50,0,'(.-)(%[.-%])()' local result,nb,lastPos,outp = {},0,0,'' local function bere(stx) for le in string.gfind(stx,'((%S+)%s*)') do if actl + string.len(le) &--#62; maxl then outp = outp..'[ENTER]' actl = 0 end outp = outp..le actl = actl + string.len(le) end end for part, dos,pos in string.gfind(str, pat) do if part ~= '' then bere(part) end outp = outp..dos lastPos = pos end bere(string.sub(str,lastPos)) say(outp)end--[[ @name mysql_escape @author Mijago @descrWie mysql_real_escape_string in PHP;Hilft, SQLi vorzubeugen.--]]function mysql_escape(str) str = string.gsub(str,"%", "")-- str = string.gsub(str,"%0", "0") Gibt einen fehler aus :o | Wer rausfindet, warum.. Bitte mir Schreiben (Mijago) str = string.gsub(str,"%n", "n") str = string.gsub(str,"%r", "r") str = string.gsub(str,"%x1a", "Z") str = string.gsub(str,"%'", "'") str = string.gsub(str,'%"', '"') return strend--[[ @name account.set_pw @author Mijago; Idee von Benhero @needs mysql_query @descrFunktion zum Ändern des Nutzerpasswortes.Angabe des Accounts kann weggelassen werden, als Accountname oder als Account ID angegeben werden.--]]account = account or {}function account.set_pw(pw,ac) if pw == nil then error("Fehler... Passwort muss gesetzt werden!") end local ac = ac or pc.get_account_id() if type(ac) == "string" then 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") elseif type(ac) == "number" then mysql_query("UPDATE account.account SET account.password = password("..string.format('%q',pw)..") WHERE account.id = "..ac) endend--[[ @name pc.check_inventory_place @author Mijago @descrCheckt auf Freie Inventarplätze für Items der größe X (Höhe).--]]function pc.check_inventory_place(size) if size &--#60;= 0 or size &--#62; 3 then return -1 end function check(c) for i = 0,size-1 do item.select_cell(e[c+(5*i)]) if item.get_id() ~= 0 then return false end end return true end for i = 0,89 do if check(i) then return i end end return -1end--[[ @name do_for_other @author Mijago @descrFührt einen String als Luabefehle bei einem anderem User aus.--]]function do_for_other(name,ding) local t = pc.select(find_pc_by_name(name)) assert(loadstring(ding))() pc.select(t)end--[[ @name local_pc_setqf @author Mijago @descrSetzt die Questflag eines anderen Spielers.--]]function local_pc_setqf(name, qf,wert) -- Für die aktuelle Quest local target = find_pc_by_name(name) local t = pc.select(target) pc.setqf(qf,wert) pc.select(t)end--[[ @name pc.trans @author Mijago @descrWarpt Spieler B zu Spieler A.Spieler a = pc.--]]function pc.trans(vid) if vid == nil then error"VID muss gesetzt sein! (pc.warp_to)" elseif type(vid) == "string" then vid = find_pc_by_name(vid) if vid == 0 then error"Spieler nicht gefunden" end end local x,y = pc.get_x()*100,pc.get_y()*100 local me = pc.select(vid) pc.warp(x,y) pc.select(me)end--[[ @name pc.warp_to @author Mijago @descrWarpt Spieler A zu Spieler B.Spieler a = pc.--]]function pc.warp_to(vid) if vid == nil then error"VID muss gesetzt sein! (pc.warp_to)" elseif type(vid) == "string" then vid = find_pc_by_name(vid) if vid == 0 then error"Spieler nicht gefunden" end end local me = pc.select(vid) local x,y = pc.get_x()*100,pc.get_y()*100 pc.select(me) pc.warp(x,y)end--[[ @name local_warp_pc @author Mijago @descrWarpt einen anderen Spieler lokal.--]]function local_pc_warp(name, x, y,mid) local target = find_pc_by_name(name) local t = pc.select(target) if mid == nil then mid = pc.get_map_index() end pc.warp_local(mid, x*100, y*100) pc.select(t)end--[[ @name download @author Mijago @descrLädt eine Datei in den Data-Ordner.--]]function download(url) os.execute("cd data && fetch "..url.." && cd ..") end--[[ @name dot @author Mijago @descrFührt alles Zwischen $ und $ im String aus.--]]function dot(x) return string.gsub(x, "%$(.-)%$", function (s) return loadstring(s)() end)end--[[ @name dostr @author Mijago @descrFührt einen String als Lua-Befehl aus.--]]function dostr(str) assert(loadstring(str))()end--[[ @name wartungsmodus @author Mijago @needs mysql_query @descrVersetzt alle Accounts (außer GM-Accounts) in einen "Wartungsmodus" und wieder zurück.--]]function wartungsmodus(v) if v == 1 or v == true then mysql_query("UPDATE account.account SET account.status = 'SHUTDOWN' WHERE status = 'OK' and account.login NOT IN (SELECT mAccount FROM common.gmlist);") else mysql_query("UPDATE account.account SET account.status = 'OK' WHERE status = 'SHUTDOWN' and account.login NOT IN (SELECT mAccount FROM common.gmlist);") endend--[[ @name Ini-Parser @author Mijago @needs split @descrEin Parser für Ini-Dateien.Besitzt eine Eigene Beschreibung der einzelnen Funktionen im Code.--]]do -- Funktionen: -- var = ini.new() -- var = ini.open(path) -- var:write_str(sub,name,wert) -- var:write_int(sub,name,wert) -- var:write_bool(sub,name,boolean) -- var:clear() -- var:read_str(sub,name,norm) -- Gibt einen String zurück. -| -- var:read_int(sub,name,norm) -- Gibt eine Zahl zurück -| norm wird zurückgegeben, wenn sub[name] nicht existiert. -- var:read_bool(sub,name,norm) -- Gibt true / False zurück -| -- var:delete_key(sub,nm) -- var:delete_section(sub) local ini_f = {} ini = {} function ini_f:append(sub,nm,wert) if nm == '' or nm == nil then return end self:parse() if self.sub[sub] == nil then self.sub[sub] = {} end self.sub[sub][nm] = wert self:writeit() end function ini_f:write_str(sub,nm,wert) self:append(sub,nm,wert) end function ini_f:write_int(sub,nm,wert) self:append(sub,nm,wert) end function ini_f:write_bool(sub,nm,bool) if not type(bool) == "boolean" then return end local bin = 0 if bool == true then bin = 1 end self:append(sub,nm,bin) return bin end function ini_f:clear() self.sub = {} self.path = '' end function ini_f:writeit() local out = '' table.foreach(self.sub, function(i,l) out = out..'['..i..']n' table.foreach(l, function(i2,l2) out=out..i2..'='..l2..'n' end ) end ) local d = io.open(self.path,'w') d:write(out) d:close() end function ini_f:delete_key(sub,nm) if sub == '' or nm == '' or sub == nil or nm == nil then return end self:parse() self.sub[sub][nm] = nil self:writeit() end function ini_f:delete_section(sub) if sub == '' or sub == nil then return end self:parse() self.sub[sub]= nil self:writeit() end function ini_f:parse() self.sub = {} if self.path == '' or self.path == nil then return end local d,i = io.open(self.path,"r"),'non' if d == nil then d = io.open(self.path,"w") end for line in d:lines() do if string.sub(line,1,1) == "[" then i = string.sub(line,2,string.len(line)-1) self.sub[i] = {} else local inp = split(line,'=') self.sub[i][inp[1]] = inp[2] end end d:close() end function ini_f:read_str(sub,nm,norm) if sub == '' or nm == '' or sub == nil or nm == nil then return end self:parse() if self.sub[sub] == nil then return norm end if self.sub[sub][nm] == nil then return norm else return self.sub[sub][nm] end end function ini_f:read_int(sub,nm,norm) if sub == '' or nm == '' or sub == nil or nm == nil then return end self:parse() if self.sub[sub] == nil then return norm end if self.sub[sub][nm] == nil then return norm else return tonumber(self.sub[sub][nm]) end end function ini_f:read_bool(sub,nm,norm) -- Norm wird zurückgegeben, wenn der Key nm nicht existiert if sub == '' or nm == '' or sub == nil or nm == nil then return end self:parse() if self.sub[sub] == nil then return norm end if self.sub[sub][nm] == nil then return norm end if self.sub[sub][nm] == "1" then return true else return false end end function ini_f:open(path) self.path = path self:parse() end function ini.new() local out = {} out.path = '' out.sub = {} setmetatable(out, { __index = ini_f }) return out end function ini.open(path) local dat = ini.new() dat:clear() dat.path=path dat:open(path) return dat endend--[[ @name csay @author Mijago @descrWie die alten col-Befehle, sendet aber selbst.Also kein say(col.red('bla'))sonderncsay.red('bla') reicht völlig aus.--]]csay = setmetatable({__d = { ["aliceblue"] = {240, 248, 255}, ["antiquewhite"] = {250, 235, 215}, ["aqua"] = {0, 255, 255}, ["aquamarine"] = {127, 255, 212}, ["azure"] = {240, 255, 255}, ["beige"] = {245, 245, 220}, ["bisque"] = {255, 228, 196}, ["black"] = {0, 0, 0}, ["blanchedalmond"] = {255, 235, 205},["blue"] = {0, 0, 255}, ["blueviolet"] = {138, 43, 226}, ["brown"] = {165, 42, 42}, ["burlywood"] = {222, 184, 135}, ["cadetblue"] = {95, 158, 160}, ["chartreuse"] = {127, 255, 0}, ["chocolate"] = {210, 105, 30}, ["coral"] = {255, 127, 80}, ["cornflowerblue"] = {100, 149, 237}, ["cornsilk"] = {255, 248, 220}, ["crimson"] = {220, 20, 60}, ["cyan"] = {0, 255, 255}, ["darkblue"] = {0, 0, 139}, ["darkcyan"] = {0, 139, 139}, ["darkgoldenrod"] = {184, 134, 11}, ["darkgray"] = {169, 169, 169}, ["darkgreen"] = {0, 100, 0}, ["darkkhaki"] = {189, 183, 107}, ["darkmagenta"] = {139, 0, 139}, ["darkolivegreen"] = {85, 107, 47}, ["darkorange"] = {255, 140, 0}, ["darkorchid"] = {153, 50, 204}, ["darkred"] = {139, 0, 0}, ["darksalmon"] = {233, 150, 122}, ["darkseagreen"] = {143, 188, 139}, ["darkslateblue"] = {72, 61, 139}, ["darkslategray"] = {47, 79, 79}, ["darkturquoise"] = {0, 206, 209}, ["darkviolet"] = {148, 0, 211}, ["deeppink"] = {255, 20, 147}, ["deepskyblue"] = {0, 191, 255}, ["dimgray"] = {105, 105, 105}, ["dodgerblue"] = {30, 144, 255}, ["firebrick"] = {178, 34, 34}, ["floralwhite"] = {255, 250, 240}, ["forestgreen"] = {34, 139, 34}, ["fuchsia"] = {255, 0, 255}, ["gainsboro"] = {220, 220, 220}, ["ghostwhite"] = {248, 248, 255}, ["gold"] = {255, 215, 0}, ["goldenrod"] = {218, 165, 32}, ["gray"] = {128, 128, 128}, ["green"] = {0, 128, 0}, ["greenyellow"] = {173, 255, 47}, ["honeydew"] = {240, 255, 240}, ["hotpink"] = {255, 105, 180}, ["indianred"] = {205, 92, 92}, ["indigo"] = {75, 0, 130}, ["ivory"] = {255, 255, 240}, ["khaki"] = {240, 230, 140}, ["lavender"] = {230, 230, 250}, ["lavenderblush"] = {255, 240, 245}, ["lawngreen"] = {124, 252, 0}, ["lemonchiffon"] = {255, 250, 205}, ["lightblue"] = {173, 216, 230}, ["lightcoral"] = {240, 128, 128}, ["lightcyan"] = {224, 255, 255}, ["lightgoldenrodyellow"] = {250, 250, 210}, ["lightgray"] = {211, 211, 211}, ["lightgreen"] = {144, 238, 144}, ["lightpink"] = {255, 182, 193}, ["lightsalmon"] = {255, 160, 122}, ["lightseagreen"] = {32, 178, 170}, ["lightskyblue"] = {135, 206, 250}, ["lightslategray"] = {119, 136, 153}, ["lightsteelblue"] = {176, 196, 222}, ["lightyellow"] = {255, 255, 224}, ["lime"] = {0, 255, 0}, ["limegreen"] = {50, 205, 50}, ["linen"] = {250, 240, 230}, ["magenta"] = {255, 0, 255}, ["maroon"] = {128, 0, 0}, ["mediumaquamarine"] = {102, 205, 170},["mediumblue"] = {0, 0, 205}, ["mediumorchid"] = {186, 85, 211}, ["mediumpurple"] = {147, 112, 219}, ["mediumseagreen"] = {60, 179, 113}, ["mediumslateblue"] = {123, 104, 238}, ["mediumspringgreen"] = {0, 250, 154}, ["mediumturquoise"] = {72, 209, 204},["mediumvioletred"] = {199, 21, 133}, ["midnightblue"] = {25, 25, 112}, ["mintcream"] = {245, 255, 250}, ["mistyrose"] = {255, 228, 225}, ["moccasin"] = {255, 228, 181}, ["navajowhite"] = {255, 222, 173}, ["navy"] = {0, 0, 128}, ["oldlace"] = {253, 245, 230}, ["olive"] = {128, 128, 0}, ["olivedrab"] = {107, 142, 35}, ["orange"] = {255, 165, 0}, ["orangered"] = {255, 69, 0}, ["orchid"] = {218, 112, 214}, ["palegoldenrod"] = {238, 232, 170}, ["palegreen"] = {152, 251, 152}, ["paleturquoise"] = {175, 238, 238}, ["palevioletred"] = {219, 112, 147}, ["papayawhip"] = {255, 239, 213}, ["peachpuff"] = {255, 218, 185}, ["peru"] = {205, 133, 63}, ["pink"] = {255, 192, 203}, ["plum"] = {221, 160, 221}, ["powderblue"] = {176, 224, 230}, ["purple"] = {128, 0, 128}, ["red"] = {255, 0, 0}, ["rosybrown"] = {188, 143, 143}, ["royalblue"] = {65, 105, 225}, ["saddlebrown"] = {139, 69, 19}, ["salmon"] = {250, 128, 114}, ["sandybrown"] = {244, 164, 96}, ["seagreen"] = {46, 139, 87}, ["seashell"] = {255, 245, 238}, ["sienna"] = {160, 82, 45}, ["silver"] = {192, 192, 192}, ["skyblue"] = {135, 206, 235}, ["slateblue"] = {106, 90, 205}, ["slategray"] = {112, 128, 144}, ["snow"] = {255, 250, 250}, ["springgreen"] = {0, 255, 127}, ["steelblue"] = {70, 130, 180}, ["tan"] = {210, 180, 140}, ["teal"] = {0, 128, 128}, ["thistle"] = {216, 191, 216}, ["tomato"] = {255, 99, 71}, ["turquoise"] = {64, 224, 208}, ["violet"] = {238, 130, 238}, ["wheat"] = {245, 222, 179}, ["white"] = {255, 255, 255}, ["whitesmoke"] = {245, 245, 245}, ["yellow"] = {255, 255, 0}, ["yellowgreen"] = {154, 205, 50} }},{ __index = function(tab,idx) local color = tab.__d[idx] or {0,0,0} return function(x) say('[COLOR r;'..(color[1]/255)..'|g;'..(color[2]/255)..'|b;'..(color[3]/255)..']'..x..'[/COLOR]') end end})--[[ @name Farbcodes @author Mijago @descrFarbcodes für Say--]]col = col or {}col.list= {{ 'lightcoral', 240,128,128 },{ 'rosybrown', 188,143,143 },{ 'indianred', 205,92,92 },{ 'red', 255,0,0 },{ 'firebrick', 178,34,34 },{ 'brown', 165,42,42 },{ 'darkred', 139,0,0 },{ 'maroon', 128,0,0 },{ 'mistyrose', 255,228,225 },{ 'salmon', 250,128,114 },{ 'tomato', 255,99,71 },{ 'darksalmon', 233,150,122 },{ 'coral', 255,127,80 },{ 'orangered', 255,69,0 },{ 'lightsalmon', 255,160,122 },{ 'sienna', 160,82,45 },{ 'seashell', 255,245,238 },{ 'chocolate', 210,105,30 },{ 'saddlebrown', 139,69,19 },{ 'sandybrown', 244,164,96 },{ 'peachpuff', 255,218,185 },{ 'peru', 205,133,63 },{ 'linen', 250,240,230 },{ 'bisque', 255,228,196 },{ 'darkorange', 255,140,0 },{ 'burlywood', 222,184,135 },{ 'antiquewhite', 250,235,215 },{ 'tan', 210,180,140 },{ 'navajowhite', 255,222,173 },{ 'blanchedalmond', 255,235,205 },{ 'papayawhip', 255,239,213 },{ 'moccasin', 255,228,181 },{ 'orange', 255,165,0 },{ 'wheat', 245,222,179 },{ 'oldlace', 253,245,230 },{ 'floralwhite', 255,250,240 },{ 'darkgoldenrod', 184,134,11 },{ 'goldenrod', 218,165,32 },{ 'cornsilk', 255,248,220 },{ 'gold', 255,215,0 },{ 'lemonchiffon', 255,250,205 },{ 'khaki', 240,230,140 },{ 'palegoldenrod', 238,232,170 },{ 'darkkhaki', 189,183,107 },{ 'ivory', 255,255,240 },{ 'lightyellow', 255,255,224 },{ 'beige', 245,245,220 },{ 'lightgoldenrodyellow', 250,250,210 },{ 'yellow', 255,255,0 },{ 'olive', 128,128,0 },{ 'olivedrab', 107,142,35 },{ 'yellowgreen', 154,205,50 },{ 'darkolivegreen', 85,107,47 },{ 'greenyellow', 173,255,47 },{ 'chartreuse', 127,255,0 },{ 'lawngreen', 124,252,0 },{ 'darkseagreen', 143,188,139 },{ 'honeydew', 240,255,240 },{ 'palegreen', 152,251,152 },{ 'lightgreen', 144,238,144 },{ 'lime', 0,255,0 },{ 'limegreen', 50,205,50 },{ 'forestgreen', 34,139,34 },{ 'green', 0,128,0 },{ 'darkgreen', 0,100,0 },{ 'seagreen', 46,139,87 },{ 'mediumseagreen', 60,179,113 },{ 'springgreen', 0,255,127 },{ 'mintcream', 245,255,250 },{ 'mediumspringgreen', 0,250,154 },{ 'mediumaquamarine', 102,205,170 },{ 'aquamarine', 127,255,212 },{ 'turquoise', 64,224,208 },{ 'lightseagreen', 32,178,170 },{ 'mediumturquoise', 72,209,204 },{ 'azure', 240,255,255 },{ 'lightcyan', 224,255,255 },{ 'paleturquoise', 175,238,238 },{ 'aqua', 0,255,255 },{ 'cyan', 0,255,255 },{ 'darkcyan', 0,139,139 },{ 'teal', 0,128,128 },{ 'darkslategray', 47,79,79 },{ 'darkturquoise', 0,206,209 },{ 'cadetblue', 95,158,160 },{ 'powderblue', 176,224,230 },{ 'lightblue', 173,216,230 },{ 'deepskyblue', 0,191,255 },{ 'skyblue', 135,206,235 },{ 'lightskyblue', 135,206,250 },{ 'steelblue', 70,130,180 },{ 'aliceblue', 240,248,255 },{ 'dodgerblue', 30,144,255 },{ 'lightslategray', 119,136,153 },{ 'slategray', 112,128,144 },{ 'lightsteelblue', 176,196,222 },{ 'cornflowerblue', 100,149,237 },{ 'royalblue', 65,105,225 },{ 'ghostwhite', 248,248,255 },{ 'lavender', 230,230,250 },{ 'blue', 0,0,255 },{ 'mediumblue', 0,0,205 },{ 'darkblue', 0,0,139 },{ 'midnightblue', 25,25,112 },{ 'navy', 0,0,128 },{ 'slateblue', 106,90,205 },{ 'darkslateblue', 72,61,139 },{ 'mediumslateblue', 123,104,238 },{ 'mediumpurple', 147,112,219 },{ 'blueviolet', 138,43,226 },{ 'indigo', 75,0,130 },{ 'darkorchid', 153,50,204 },{ 'darkviolet', 148,0,211 },{ 'mediumorchid', 186,85,211 },{ 'thistle', 216,191,216 },{ 'plum', 221,160,221 },{ 'violet', 238,130,238 },{ 'fuchsia', 255,0,255 },{ 'magenta', 255,0,255 },{ 'darkmagenta', 139,0,139 },{ 'purple', 128,0,128 },{ 'orchid', 218,112,214 },{ 'mediumvioletred', 199,21,133 },{ 'deeppink', 255,20,147 },{ 'hotpink', 255,105,180 },{ 'lavenderblush', 255,240,245 },{ 'palevioletred', 219,112,147 },{ 'crimson', 220,20,60 },{ 'pink', 255,192,203 },{ 'lightpink', 255,182,193 },{ 'white', 255,255,255 },{ 'snow', 255,250,250 },{ 'whitesmoke', 245,245,245 },{ 'gainsboro', 220,220,220 },{ 'lightgray', 211,211,211 },{ 'silver', 192,192,192 },{ 'darkgray', 169,169,169 },{ 'gray', 128,128,128 },{ 'dimgray', 105,105,105 },{ 'black', 0,0,0 },{ 'aliceblue', 240,248,255 },{ 'antiquewhite', 250,235,215 },{ 'aqua', 0,255,255 },{ 'aquamarine', 127,255,212 },{ 'azure', 240,255,255 },{ 'beige', 245,245,220 },{ 'bisque', 255,228,196 },{ 'black', 0,0,0 },{ 'blanchedalmond', 255,235,205 },{ 'blue', 0,0,255 },{ 'blueviolet', 138,43,226 },{ 'brown', 165,42,42 },{ 'burlywood', 222,184,135 },{ 'cadetblue', 95,158,160 },{ 'chartreuse', 127,255,0 },{ 'chocolate', 210,105,30 },{ 'coral', 255,127,80 },{ 'cornflowerblue', 100,149,237 },{ 'cornsilk', 255,248,220 },{ 'crimson', 220,20,60 },{ 'cyan', 0,255,255 },{ 'darkblue', 0,0,139 },{ 'darkcyan', 0,139,139 },{ 'darkgoldenrod', 184,134,11 },{ 'darkgray', 169,169,169 },{ 'darkgreen', 0,100,0 },{ 'darkkhaki', 189,183,107 },{ 'darkmagenta', 139,0,139 },{ 'darkolivegreen', 85,107,47 },{ 'darkorange', 255,140,0 },{ 'darkorchid', 153,50,204 },{ 'darkred', 139,0,0 },{ 'darksalmon', 233,150,122 },{ 'darkseagreen', 143,188,139 },{ 'darkslateblue', 72,61,139 },{ 'darkslategray', 47,79,79 },{ 'darkturquoise', 0,206,209 },{ 'darkviolet', 148,0,211 },{ 'deeppink', 255,20,147 },{ 'deepskyblue', 0,191,255 },{ 'dimgray', 105,105,105 },{ 'dodgerblue', 30,144,255 },{ 'firebrick', 178,34,34 },{ 'floralwhite', 255,250,240 },{ 'forestgreen', 34,139,34 },{ 'fuchsia', 255,0,255 },{ 'gainsboro', 220,220,220 },{ 'ghostwhite', 248,248,255 },{ 'gold', 255,215,0 },{ 'goldenrod', 218,165,32 },{ 'gray', 128,128,128 },{ 'green', 0,128,0 },{ 'greenyellow', 173,255,47 },{ 'honeydew', 240,255,240 },{ 'hotpink', 255,105,180 },{ 'indianred', 205,92,92 },{ 'indigo', 75,0,130 },{ 'ivory', 255,255,240 },{ 'khaki', 240,230,140 },{ 'lavender', 230,230,250 },{ 'lavenderblush', 255,240,245 },{ 'lawngreen', 124,252,0 },{ 'lemonchiffon', 255,250,205 },{ 'lightblue', 173,216,230 },{ 'lightcoral', 240,128,128 },{ 'lightcyan', 224,255,255 },{ 'lightgoldenrodyellow', 250,250,210 },{ 'lightgray', 211,211,211 },{ 'lightgreen', 144,238,144 },{ 'lightpink', 255,182,193 },{ 'lightsalmon', 255,160,122 },{ 'lightseagreen', 32,178,170 },{ 'lightskyblue', 135,206,250 },{ 'lightslategray', 119,136,153 },{ 'lightsteelblue', 176,196,222 },{ 'lightyellow', 255,255,224 },{ 'lime', 0,255,0 },{ 'limegreen', 50,205,50 },{ 'linen', 250,240,230 },{ 'magenta', 255,0,255 },{ 'maroon', 128,0,0 },{ 'mediumaquamarine', 102,205,170 },{ 'mediumblue', 0,0,205 },{ 'mediumorchid', 186,85,211 },{ 'mediumpurple', 147,112,219 },{ 'mediumseagreen', 60,179,113 },{ 'mediumslateblue', 123,104,238 },{ 'mediumspringgreen', 0,250,154 },{ 'mediumturquoise', 72,209,204 },{ 'mediumvioletred', 199,21,133 },{ 'midnightblue', 25,25,112 },{ 'mintcream', 245,255,250 },{ 'mistyrose', 255,228,225 },{ 'moccasin', 255,228,181 },{ 'navajowhite', 255,222,173 },{ 'navy', 0,0,128 },{ 'oldlace', 253,245,230 },{ 'olive', 128,128,0 },{ 'olivedrab', 107,142,35 },{ 'orange', 255,165,0 },{ 'orangered', 255,69,0 },{ 'orchid', 218,112,214 },{ 'palegoldenrod', 238,232,170 },{ 'palegreen', 152,251,152 },{ 'paleturquoise', 175,238,238 },{ 'palevioletred', 219,112,147 },{ 'papayawhip', 255,239,213 },{ 'peachpuff', 255,218,185 },{ 'peru', 205,133,63 },{ 'pink', 255,192,203 },{ 'plum', 221,160,221 },{ 'powderblue', 176,224,230 },{ 'purple', 128,0,128 },{ 'red', 255,0,0 },{ 'rosybrown', 188,143,143 },{ 'royalblue', 65,105,225 },{ 'saddlebrown', 139,69,19 },{ 'salmon', 250,128,114 },{ 'sandybrown', 244,164,96 },{ 'seagreen', 46,139,87 },{ 'seashell', 255,245,238 },{ 'sienna', 160,82,45 },{ 'silver', 192,192,192 },{ 'skyblue', 135,206,235 },{ 'slateblue', 106,90,205 },{ 'slategray', 112,128,144 },{ 'snow', 255,250,250 },{ 'springgreen', 0,255,127 },{ 'steelblue', 70,130,180 },{ 'tan', 210,180,140 },{ 'teal', 0,128,128 },{ 'thistle', 216,191,216 },{ 'tomato', 255,99,71 },{ 'turquoise', 64,224,208 },{ 'violet', 238,130,238 },{ 'wheat', 245,222,179 },{ 'white', 255,255,255 },{ 'whitesmoke', 245,245,245 },{ 'yellow', 255,255,0 },{ 'yellowgreen', 154,205,50 }}table.foreachi(col.list,function(a,b) col[b[1]] = function(text) return "[COLOR r;"..(b[2]/255.0).."|g;"..(b[3]/255.0).."|b;"..(b[4]/255.0).."]"..text..'[/COLOR]' endend)--[[ @name Apache-Funktionen @author Mijago @descrFunktionen, um Apache neu zu starten.--]]proc=proc or {}proc.apache_start = function() os.execute('apachectl start') endproc.apache_stop = function() os.execute('apachectl stop') endproc.apache_restart = function() os.execute('apachectl restart') endproc.apache_graceful = function() os.execute('apachectl graceful') end--[[ @name TS3-Funktionen @author Mijago @descrFunktionen zum Starten, Stoppen und Neustarten eines TS3 Servers.--]]proc=proc or {}proc.ts3_start = function(path) os.execute('cd '..path..' && sh ts3server_startscript.sh start') endproc.ts3_stop = function(path) os.execute('cd '..path..' && sh ts3server_startscript.sh stop') endproc.ts3_restart = function(path) os.execute('cd '..path..' && sh ts3server_startscript.sh restart') end Autor: Mijago.Créditos: Mijago. 3 ɓʀuɳѳ' ИИ#92, Karbust and magnatar reacted to this Share this post Link to post Share on other sites
ZowiXico 0 Posted January 18, 2013 Para que serve essa novas funções? Share this post Link to post Share on other sites
Rancoroso 604 Posted January 19, 2013 Para que serve essa novas funções?SERVE PARA MUITA COISA COMO POR EXEMPLO USAR A FUNÇÃO MYSQL_QUERY EM UM SCRIPT DE QUEST SEM PRECISA FAZER A CONEXÃO COM O OS.EXECUTE POIS A FUNÇÃO MYSQL_QUERY JÁ FAZ TODO O PROCESSO DE LOGIN COM O BANCO DE DADOS ASSIM VC NÃO PRECISA USAR O -U -P -E...NA VERDADE ISSO SERIA FUNÇÕES MYSQL CONVERTIDA PARA O QUESTLIB.LUA FACILITANDO O USO DE AÇÕES PARA NOVOS ITENS E NPCS...SISTEMAS QUE USAR ESSAS NOVAS FUNÇÕES:-- SISTEMA DE ENERGIA-- SISTEMA DE COSTUME Share this post Link to post Share on other sites
Gleisson 0 Posted January 19, 2013 vlw http://cyber-gamers.org/public/style_emoticons/default/451960.gif Share this post Link to post Share on other sites