Jump to content
×
×
  • Create New...

Give players itemshop coins from an in-game item


Rumor

Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

For this one you will need Mijago's quest functions, get them here: http://metin2dev.org/board/topic/30-mijagos-quest-functions/

 

You have to edit the vnum of the item you want to use to give players coins on line 6 inside the "[" and "]" brackets. The number after the equals sign is the amount of coins you want the item to give the player. You can add more lines underneath this in the same format in-case you want different items to give different amounts of coins.

 

You may need to modify the MYSQL query on line 29 to match the columns of your database table. It's pretty self-explanatory, but if you need assistance feel free to reply.

quest givegiftcoins begin
    state start begin
        when 80017.use begin
            local count = pc.count_item(item.get_vnum())
            local value = ({
                [80017] = 100,
            })[item.get_vnum()]
            say_title('Gift Coin Scroll')
			say('')
            say('This coin scroll is worth: '..value..' NC.')
			say('Nirvana Coins can be used in the itemshop!')
			say('Remember, for each NC you spend you receive 1 NM.')
			say('This scroll was meant to be used to gift coins.')
			say('You ARE allowed to sell it, if you wish.')
			say('')
			wait()
			say_title('Gift Coin Scroll')
			say('')
            say('Would you like to add the NC 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 nc = nc+'..value..' WHERE id = '..pc.get_account_id()..' LIMIT 1')
			mysql_query('INSERT INTO log.coinscrollgift_log (account_id, coins, time) VALUES (".. pc.get_account_id() ..", ".. value ..", NOW())')
            pc.remove_item(item.get_vnum())
            syschat('Your account has successfully been rewarded with NC.')
            -- If item is not stackable use:
            -- item.remove()
        end
    end
end
  • Metin2 Dev 4
  • Love 1
  • Angry 1
Link to comment
Share on other sites

Nowadays we have quest functions (made in the game file) that gives X coins to a player account.

And also, instead of another query to log the character's action, I would use char_log(pc.get_account_id(), 'COINS', value..' coins')

when you return 0 and server doesn't boot:

unknown.png

Link to comment
Share on other sites

Nowadays we have quest functions (made in the game file) that gives X coins to a player account.

And also, instead of another query to log the character's action, I would use char_log(pc.get_account_id(), 'COINS', value..' coins')

But why have it in multiple quests when you can have it all in one central place?

That's a good idea with the char_log function.

Link to comment
Share on other sites

But why have it in multiple quests when you can have it all in one central place?

Hm? What I was saying is there's already a function to charge coins on an account.

 

when 123.use or 1234.use or 12345.use begin
	local cash = {[123] = 10, [1234] = 20, [12345] = 30}
	pc.charge_cash(cash[item.vnum], 'cash')
	char_log(pc.get_account_id(), 'GIVE_IS_COINS', cash[item.vnum]..' Coins')
end
I don't know if this function exists on other game revisions. But at least in 34083, it exists.

So that makes your quest useful for those who are more 'oldschool'.

  • Love 2

when you return 0 and server doesn't boot:

unknown.png

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.


  • Metin2 Dev Github
  • Activity

    1. 6

      Owsap Productions

    2. 11

      BUG SAFEBOX disappear stacks ..

    3. 2

      Error no member named SetcCreateTime in Citem

    4. 2

      Need some help with effect slot on pickup system

    5. 1

      GF Pet system "x" level / percent

    6. 1

      disable quest esc

    7. 2

      Navicat Premium 16.1.3 x64

    8. 2

      Join the Metin2 Dev team

    9. 2

      Error no member named SetcCreateTime in Citem

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.