Jump to content
Forgot your email address? ×
  • Create New...

Attribute Changing Log

Recommended Posts

  • Premium


I know now its easy to "fix" the switchbot in the binary, but maybe this short code snippet will be helpful for some servers. Functions:

  • You can specify the range of the checking (Just check if the user change the bonus within every 1 sec or within every 5 sec)
  • You can check if the user change the bonuses always in the same time or if you want to be more specify you can use +1/-1 range

Open game/item_attribute.cpp and search for the ChangeAttribute event. Add this code to the begin of the event:

	LPCHARACTER	ch = GetOwner();
	SwitchTimeNow = thecore_pulse();
	if (SwitchTimeNow < (LastSwitchTime + CHECK_SWITCH_TIME * 25))
		/* if (-1 <= SwitchTimeNow - LastSwitchTime - PassedSwitchTime && SwitchTimeNow - LastSwitchTime - PassedSwitchTime <= 1) - Uncomment if you want to be more specify, use -1/+1 range - */
		if (SwitchTimeNow - LastSwitchTime == PassedSwitchTime)
			sys_log(0, "%s[%d] probably using a switchbot", ch->GetName(), ch->GetAID());
			/* ch->Disconnect("ChangeAttribute"); - Uncomment if you want to kick the player - */
			PassedSwitchTime = SwitchTimeNow - LastSwitchTime;

And add this to the end of the event:

LastSwitchTime = thecore_pulse();

Open game/item.h and add these:

		int				PassedSwitchTime;
		int				LastSwitchTime;
		int				SwitchTimeNow;

Open game/length.h and add this:

	CHECK_SWITCH_TIME		= 5, // Now the function will be active if the user changing the bonuses within 5 seconds

Tip, the thecore_pulse() function is not giving back a time, if you want to check one second then you have to multiply the number with 25. So:
5 seconds: 5*25 = 125
5 minutes: 5*60*25 = 7500
If you have any question or suggestion, please just reply to this topic.
Kind Regards,

  • Love 19
Link to comment
  • 3 months later...

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


  • -15% Discount in Metin2 Dev Store (01/10/2021 => 31/12/2021) => Code => 15_PCT_OCT_TO_DEC_2021

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.