Jump to content
  • 0


Guest Anonymous


Guest Anonymous

Hi devs!

I'm going to have a high volume of insertion into the database, so I decided to put in the source, how could I write this code?

Example: pc.add_pvm(1)

int pc_add_pvm(lua_State * L)
		if (!lua_isnumber(L, 1))
			sys_err("invalid argument");
			return 0;

		LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
		long val = (long)lua_tonumber(L, 1);
		SQLMsg *msg;

		msg = DBManager::instance().DirectQuery("UPDATE player.player SET evento = evento+1 WHERE id = '%d' LIMIT 1", val, ch->GetPlayerID());
		msg = DBManager::instance().DirectQuery("UPDATE player.player SET premio = premio+1 WHERE id = '%d' LIMIT 1", val, ch->GetPlayerID());
		if (msg->uiSQLErrno != 0)
			sys_err("pc_update_event_pvm query failed");
			return 0;
		delete msg;


Link to comment
Share on other sites

  • Answers 0
  • Created
  • Last Reply

Popular Days

Popular Days

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Before asking for a new question, do some research on the forum. The answer to your question might probably exists already. When asking for help, do not forget to say what fixed your issue when you have solved it. This may help a member who have the same issue! Also, you can set an answer as the best on the left of each post.

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

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