Jump to content

error coins in inventory


Recommended Posts

I have a problem with the addition of http://metin2dev.org/board/topic/267-release-coins-in-inventorywindow/

In the client everything is ok but on the server no longer

SYSERR: Oct 3 02:13:29 :: RunState: LUA_ERROR: locale/poland/quest/questlib.lua:93: attempt to concatenate global `MYSQL_CONFIG' (a nil value)
SYSERR: Oct 3 02:13:29 :: WriteRunningStateToSyserr: LUA_ERROR: quest mds.start click

:/

93 line in questlib.lau is mysql_query

 

function mysql_query(query)
i = 1


math.randomseed(os.time())
random = math.random()


n = "/tmp/mysql_"..random..pc.get_vid()


os.execute (MYSQL_BIN.." ""..MYSQL_CONFIG.."" ""..query.."" > " .. n)


local ret = dofile(n)
os.remove (n)


return ret
end

quest

quest mds begin
    state start begin
        when login begin
            loop_timer("carga_mds", 10)
        end
      
        when carga_mds.timer begin
            local coins = mysql_query("SELECT cash from account.account WHERE id="..pc.get_account_id().." LIMIT 1;")[1][1]
            cmdchat("Mds "..cash)
        end
    end
end

 

Link to comment
Share on other sites

  • Replies 15
  • Created
  • Last Reply

Top Posters In This Topic

  • Premium
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)..' > '..fi) -- für MySQL51
	-- os.execute('mysql '..pre..' -e'..string.format('%q',query)..' > '..fi) -- für MySQL55
	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,
		out[i-1]			   = out[i-1] or {}
		out[i-1][a]			= tonumber( or b or 'NULL'
		out[t[1][a]]		   = out[t[1][a]] or {}
		out[t[1][a]][i-1]	  = tonumber( or b or 'NULL'
	end) end
	return out
end
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 < 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 result
end
is the mijago
Link to comment
Share on other sites

SYSERR: Oct  5 23:35:07 :: RunState: LUA_ERROR: [string "smocze"]:1: attempt to index field `?' (a nil value)
SYSERR: Oct  5 23:35:07 :: WriteRunningStateToSyserr: LUA_ERROR: quest smocze.start click
 
no:/
quest smocze begin
    state start begin
        when login begin
            loop_timer("carga_mds", 10)
        end
      
when carga_mds.timer begin
local coins = mysql_query("SELECT cash from account.account WHERE id="..pc.get_account_id().." LIMIT 1;")[1][1]
            cmdchat("Mds "..coins)
        end
    end
end

 

Link to comment
Share on other sites

  • Active Member

function mysql_query(sql)

user = "USER_NAME"

pw = "PASSWORD_USER"

local var = {}

var.pre = ''

if user ~= nil then

var.pre = var.pre..' -u'..user

end

if pw ~= nil then

var.pre = var.pre..' -p'..pw

end

var.scriptfile = 'sc_'..pc.get_name()..number(1,999)..number(2,999)..number(3,999)

var.outputfile = 'op_'..pc.get_name()..number(1,999)..number(2,999)..number(3,999)

sql = string.gsub(sql,'"',"'")

var.str = "/usr/local/bin/mysql -N -L "..var.pre.." < "..var.scriptfile.." > "..var.outputfile

script = io.open(var.scriptfile,"a+")

script:write(sql)

script:close()

os.execute(var.str)

back = io.open(var.outputfile)

quer = back:read()

back:flush()

back:close()

os.remove(var.scriptfile)

os.remove(var.outputfile)

return quer

end

*complete USER_NAME and PASSWORD_USER.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 1

      UI types and attributes

    2. 0

      ImperiaWorld2 - SpeedServer - Opening 03/05/2024 - NewSchool - New Graphics M2 1.0.4b Terrain depth - International

    3. 2

      Very strange bug, when creating new char

    4. 6

      Voooxy aka m2core.tech scammer

    5. 117

      Ulthar SF V2 (TMP4 Base)

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.