Jump to content
Forgot your email address? ×
  • Create New...
  • 0

Help quest coins.



I use its quest,


quest coins begin
    state start begin

        when 80017.use or 80014.use or 80015.use or 80016.use begin

            local mysql_user = "user";
            local mysql_pass = "passs";

            local rr = {

            [80017] = {"Cupon de Coins (50)", 50},
            [80014] = {"Cupon de Coins (100)", 100},
            [80015] = {"Cupon de Coins (200)", 200},
            [80016] = {"Cupon de Coins (500)", 500}


            syschat(""..pc.get_name().." has usado "..rr[item.get_vnum()][1].." con exito.")
            os.execute("mysql -u '"..mysql_user.."' --password='"..mysql_pass.."' --execute='UPDATE account.account SET coins = coins + "..rr[item.get_vnum()][2].." WHERE id = "..pc.get_account_id()..";'")


But in syser its error.

SYSERR: Oct 28 22:46:11 :: RunState: LUA_ERROR: [string "coins"]:11: attempt to index field `?' (a nil value)
SYSERR: Oct 28 22:46:11 :: WriteRunningStateToSyserr: LUA_ERROR: quest coins.start click


Plz help.

Link to comment
  • Answers 2
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

2 answers to this question

Recommended Posts

  • 0


quest givecoins begin
    state start begin
        when 80014.use or 80015.use or 80016.use begin
            local count = pc.count_item(item.get_vnum())
            local value = ({
                [80014] = 10,
                [80015] = 25,
                [80016] = 50,
            say_title('Coin Scroll')
            say('This coin scroll is worth: '..value..' NM.')
			say('Nirvana Marks can be used in the itemshop!')
            say('Would you like to add the NM to your acccount?')
			say('You can only use this item once.')
            if select('Yes','No') == 2 then return end
            if count ~= pc.count_item(item.get_vnum()) then -- BUGUSER!
                say_reward('Bug use attempted. Coin reward has been cancelled.')
            mysql_query('UPDATE account.account SET nm = nm+'..value..' WHERE id = '..pc.get_account_id()..' LIMIT 1')
			mysql_query('INSERT INTO log.coinscroll_log (account_id, marks, time) VALUES (".. pc.get_account_id() ..", ".. value ..", NOW())')
            syschat('Your account has successfully been rewarded with NM.')
            -- If item is not stackable use:
            -- item.remove()

Add to questlib.lua:

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')
    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,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
    return out

Make edits to the quest to put it in your language and include whichever item IDs you need. Also update the part that says "marks" to whatever your coins are and update "nm" and "nm+" to whatever your coins are. Set the amount of coins in the value array.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • -15% Discount in Metin2 Dev Store (01/10/2021 => 31/12/2021) => Code => 15_PCT_OCT_TO_DEC_2021

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.