Jump to content

[HELP]Problem with quest


Go to solution Solved by Rexors,

Recommended Posts

I use its quest and its error.

 

Quest:

quest coins begin
    state start begin

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

            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.")
            item.remove()
            game.mysql_update_query("UPDATE account.account SET coins = coins + "..rr[item.get_vnum()][2].." WHERE id = "..pc.get_account_id()..";'")
        end
    end
end

 

syserr:

SYSERR: Dec 16 21:30:05 :: RunState: LUA_ERROR: [string "coins"]:9: attempt to index field `?' (a nil value)
SYSERR: Dec 16 21:30:05 :: WriteRunningStateToSyserr: LUA_ERROR: quest coins.start click

 

Thx all.

Link to comment
Share on other sites

here's a fully working one I used over a year:

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,
            })[item.get_vnum()]
            say_title('Coin Scroll')
			say('')
            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.')
			say('')
            if select('Yes','No') == 2 then return end
            if count ~= pc.count_item(item.get_vnum()) then -- BUGUSER!
				say('')
                say_reward('Bug use attempted. Coin reward has been cancelled.')
				say('')
                return
            end
            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())')
            pc.remove_item(item.get_vnum())
            syschat('Your account has successfully been rewarded with NM.')
            -- If item is not stackable use:
            -- item.remove()
        end
    end
end
  • Love 1
Link to comment
Share on other sites

I use mysql_query in game and found 100% with vrunner, but in its quest say its error in syserr:

SYSERR: Dec 16 21:30:05 :: RunState: LUA_ERROR: [string "coins"]:9: attempt to index field `?' (a nil value)

SYSERR: Dec 16 21:30:05 :: WriteRunningStateToSyserr: LUA_ERROR: quest coins.start click

my functions:

game.mysql_real_escape_string

game.mysql_query

game.mysql_update_query

and found 100%, but in its quest wrong..

Link to comment
Share on other sites

  • Solution

Try this. Array is from from Rumor quest. I tested on my server and works.

quest coins begin
    state start begin
 
        when 80017.use or 80014.use or 80015.use or 80016.use begin
 
        local value = ({
                [80017] = 50,
                [80014] = 100,
                [80015] = 200,
                [80016] = 500,
            })[item.get_vnum()]
 
           syschat(""..pc.get_name().." has usado Cupon de Coins ("..value..") con exito.")
           item.remove()
           game.mysql_update_query("UPDATE account.account SET coins=coins+"..value.." WHERE id = "..pc.get_account_id().." ;")
 
        end
    end
end
  • Love 4
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



×
×
  • 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.