Jump to content

pc.add


Recommended Posts

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

  • Replies 0
  • Created
  • Last Reply

Popular Days

Popular Days

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.