Jump to content

Recommended Posts

  • Active Member

Use mysql_query function, i recommend to get it from wom2 src(c++) or search one on the forum

  • Love 1
Link to comment
https://metin2.dev/topic/14297-question-about-code-quest/#findComment-80994
Share on other sites

You need to add this to your source.

and then start using it :)

 

mysql_direct_query("UPDATE account.account SET gold_expire=_DATE_, silver_expire=_DATE_ WHERE id=_ID_")

 

LINK !!!

http://www.elitepvpers.com/forum/metin2-pserver-guides-strategies/3327940-release-mysql_direct_query-get_table_postfix-mysql_escape_string-written-c-lua.html

  • Love 1
Link to comment
https://metin2.dev/topic/14297-question-about-code-quest/#findComment-80996
Share on other sites

  • Active Member

Here has the following functions in C ++

 

mysql.query
mysql.direct_query
mysql.update
mysql.real_escape_string
mysql.get_table_postfix

 

go to game / src

 

open queslua.cpp

 

under

RegisterDragonSoulFunctionTable();

add

RegisterMysqlFunctionTable();

open queslua.h

 

under

extern void RegisterDragonSoulFunctionTable();

add

extern void RegisterMysqlFunctionTable();

add in the makefile 

questlua_mysql.cpp

Download the file

 

This is the hidden content, please

Taken from here:

  • Metin2 Dev 2
  • Good 3
  • Love 2
Link to comment
https://metin2.dev/topic/14297-question-about-code-quest/#findComment-80997
Share on other sites

guys i'm sorry but i mean how i use date in this function 

 

mysql_direct_query("UPDATE account.account SET gold_expire=_DATE_, silver_expire=_DATE_ WHERE id=_ID_")

 

I need to add 7 days to one of the accounts

 

If he are using this tool 40004

 

I'm sorry, I'm not good in English

 

Thank you everyone

Link to comment
https://metin2.dev/topic/14297-question-about-code-quest/#findComment-80998
Share on other sites

  • Active Member

guys i do this but not work

 

quest point_add begin
	state start begin
	    function exp_point_add(x)
	        mysql_direct_query("UPDATE account.account SET gold_expire=DATE() + "..(get_time() + x*60*60*24).." WHERE id='"..pc.get_account_id().."")
        end
		when 40004.use begin
		    point_add.exp_point_add(7)
			say(" add 7 days gold  ")
		end
	end
end

can anyone help me?

Link to comment
https://metin2.dev/topic/14297-question-about-code-quest/#findComment-81007
Share on other sites

quest gold_expire_update begin
	state start begin
		when 40004.use begin	--- vnum item used for update gold_expire
			local c,query = mysql_direct_query("SELECT * FROM account.account WHERE id = '"..pc.get_account_id().."' LIMIT 1;")
			if query[1].gold_expire  == '0000-00-00 00:00:00' then
				mysql_direct_query("UPDATE account.account SET gold_expire = ADDDATE(NOW(), 7) WHERE id = '"..pc.get_account_id().."';")
			else
				mysql_direct_query("UPDATE account.account SET gold_expire = ADDDATE(gold_expire, 7) WHERE id = '"..pc.get_account_id().."';")
			end
			pc.remove_item(40004, 1)
		end
	end
end
  • Love 2
Link to comment
https://metin2.dev/topic/14297-question-about-code-quest/#findComment-81028
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.