mysqlconnect = {user="", connect="", password="", ip=""}
dbConnectTable = {
connect = false,
user = "xxx",
password = "xxx",
ip = "roa-multigaming.net",
table = "mybb",
}
function onResourceInfoStart()
dbConnectTable.connect = dbConnect("mysql","dbname="..dbConnectTable.table..";host="..dbConnectTable.ip, dbConnectTable.user, dbConnectTable.password)
if dbConnectTable.connect then
checkMySQLTable(dbConnectTable.connect,infoDatabase.tableName,infoDatabase.tableStructure)
commandSystemMySQLInit()
likeSystemDatabaseInit()
end
end
addEventHandler("onResourceStart",resourceRoot,onResourceInfoStart)
local DSEC=24*60*60 -- secs in a day
local YSEC=365*DSEC -- secs in a year
local LSEC=YSEC+DSEC -- secs in a leap year
local FSEC=4*YSEC+DSEC -- secs in a 4-year interval
local BASE_DOW=4 -- 1970-01-01 was a Thursday
local BASE_YEAR=1970 -- 1970 is the base year
function gmtime(t)
local y,j,m,d,w,h,n,s
local mdays=_days
s=t
-- First calculate the number of four-year-interval, so calculation
-- of leap year will be simple. Btw, because 2000 IS a leap year and
-- 2100 is out of range, this formula is so simple.
y=floor(s/FSEC)
s=s-y*FSEC
y=y*4+BASE_YEAR -- 1970, 1974, 1978, ...
if s>=YSEC then
y=y+1 -- 1971, 1975, 1979,...
s=s-YSEC
if s>=YSEC then
y=y+1 -- 1972, 1976, 1980,... (leap years!)
s=s-YSEC
if s>=LSEC then
y=y+1 -- 1971, 1975, 1979,...
s=s-LSEC
else -- leap year
mdays=_lpdays
end
end
end
j=floor(s/DSEC)
s=s-j*DSEC
local m=1
while mdays[m]<j do m=m+1 end
m=m-1
local d=j-mdays[m]
-- Calculate day of week. Sunday is 0
w=(floor(t/DSEC)+BASE_DOW)%7
-- Calculate the time of day from the remaining seconds
h=floor(s/3600)
s=s-h*3600
n=floor(s/60)
s=s-n*60
return ((y.."/"..m.."/"..d.." - "..string.format("%02d:%02d",h,s)))
end
can someone help me pls