Jump to content

Recommended Posts

  • Honorable Member

M2 Download Center

This is the hidden content, please
( Internal )

This is the hidden content, please
( GitHub )


Somebody asked me about auto night and day change(server time). I coded simple func and added few features.

Auto night and day change:

Spoiler


makerange(6, 21)

Changeable {6,7,8,...,21}

Auto snow mode at winter:

Spoiler


for (auto i : { 1,2,12 })

January, February, December

Reminder for special days:

Spoiler


	std::map<std::string, dateinfo> specialdays	{
		// syntax: {"name", {day, month}}
		{"Pi Day", {14,3}},
	};

 

Announcement every hour

You can add new features like this.

  • Metin2 Dev 66
  • Dislove 1
  • Good 15
  • Love 4
  • Love 40

 

Link to comment
https://metin2.dev/topic/21575-check-time-event/
Share on other sites

  • Honorable Member
4 hours ago, ReFresh said:

@Mali61 I feel so sad, it's only for C++11 or above right?

actually I used structed bindings too. c++17 and greater required. But I created a tutorial for c++2a:

 

  • Metin2 Dev 1
  • Good 1
  • Love 2

 

Link to comment
https://metin2.dev/topic/21575-check-time-event/#findComment-117130
Share on other sites

  • Premium
3 godziny temu, ReFresh napisał:

@Mali61 I feel so sad, it's only for C++11 or above right?

Take it easy, c++11 gives you a lot of new features, the best thing for me is auto pointer, so I recommend you upgrading it 

  • Love 2
Link to comment
https://metin2.dev/topic/21575-check-time-event/#findComment-117136
Share on other sites

  • 5 years later...

I'm getting this error.
Could someone help please.
 

desc_manager.cpp: In lambda function:
desc_manager.cpp:610:31: error: passing 'const std::vector<int>' as 'this' argument discards qualifiers [-fpermissive]
  610 |     night_hours.emplace_back(i);
      |                               ^
In file included from /usr/local/lib/gcc10/include/c++/vector:72,
                 from ../../../Extern/include/msl/utils.h:21,
                 from ../../common/utils.h:4,
                 from stdafx.h:15,
                 from desc_manager.cpp:1:
/usr/local/lib/gcc10/include/c++/bits/vector.tcc:109:7: note:   in call to 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {const int&}; _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::reference = int&]'
  109 |       vector<_Tp, _Alloc>::
      |       ^~~~~~~~~~~~~~~~~~~
desc_manager.cpp: In lambda function:
desc_manager.cpp:634:2: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  634 |  [=] {
      |  ^
desc_manager.cpp:634:2: note: add explicit 'this' or '*this' capture
desc_manager.cpp: In lambda function:
desc_manager.cpp:642:2: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  642 |  [=] {
      |  ^
desc_manager.cpp:642:2: note: add explicit 'this' or '*this' capture

 

Link to comment
https://metin2.dev/topic/21575-check-time-event/#findComment-168900
Share on other sites

  • 2 weeks later...

can anyone explain me how to add the code in "desc_manager.cpp". Should i copy the whole code at all or split into parts? The ifdef let me think i must complete copy it. 

I have this error now: 

spacer.png

Edited by Metin2 Dev International
Core X - External 2 Internal
Link to comment
https://metin2.dev/topic/21575-check-time-event/#findComment-169037
Share on other sites

  • 8 months later...
  • Premium
On 1/14/2025 at 2:54 PM, thelittlemarkus said:

can anyone explain me how to add the code in "desc_manager.cpp". Should i copy the whole code at all or split into parts? The ifdef let me think i must complete copy it. 

I have this error now: 

spacer.png

This one can be solved by replacing :

const auto& night_hours = makerange();

//with 

auto night_hours = makerange();

 

Thanks a lot for this, i love the snow part, day/Night special day ... this is cool !

Link to comment
https://metin2.dev/topic/21575-check-time-event/#findComment-172529
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.