Jump to content

Recommended Posts

hello

The time is reset when I change the map. I just want to reset when quit or character change. thx

 

DWORD CHARACTER::GetLogonTime(){
	return (get_dword_time() - m_dwLogonTime) / 1000 + 0.5; //now - logon_time -> convert ms to sec > convert float to int
}

void CHARACTER::CheckLogonTime(int time){
	if (time / 60 > 180 && !m_iLogonIsRewarded){
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("rewardplaytime.")); //You are won 10M for that 3 hours in the game
		PointChange(POINT_GOLD, 10000000, false); //10.000.000
		DBManager::instance().SendMoneyLog(MONEY_LOG_QUEST, 1, 10000000);

		m_iLogonIsRewarded = 1;
	}

	ChatPacket(CHAT_TYPE_COMMAND, "ClientLogonUpdate %d", time / 60);
}

EVENTFUNC(logontime_check_event)
{
	char_event_info* info = dynamic_cast<char_event_info*>(event->info);
	if (info == NULL)
	{
		sys_err("logontime_check_event> <Factor> Null pointer");
		return 0;
	}

	LPCHARACTER	ch = info->ch;
	if (ch == NULL) { // <Factor>
		return 0;
	}

	ch->CheckLogonTime(ch->GetLogonTime());

	return PASSES_PER_SEC(60); //1min
}

void CHARACTER::InitCharLogonEvent(){
	if (m_pkLogonEvent)
		return;

	if (m_iLogonIsStarted != 1) {
		ChatPacket(CHAT_TYPE_COMMAND, "ClientLogonStart 0");
		m_iLogonIsStarted = 1;
	}

	char_event_info* info = AllocEventInfo<char_event_info>();

	info->ch = this;

	m_pkLogonEvent = event_create(logontime_check_event, info, PASSES_PER_SEC(60));
}

 

Link to comment
https://metin2.dev/topic/21305-playtime-system-change/
Share on other sites

  • Forum Moderator
4 hours ago, mehmetdogan said:

up

Rules

§2 Topics
(2.2) Bumping

Allowed bumping times:

  • Services area - 24 hours
  • Q&A - 48 hours

Any other bumping will result in an infraction!

 

Best regards
Raylee

  • Love 1
Link to comment
https://metin2.dev/topic/21305-playtime-system-change/#findComment-115614
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.