Jump to content

Fix Shutdown Server Command


Recommended Posts

I think someone still haven't seen this error in game source file or someone fix it but not share on metin2dev.org. What's ever

 

Open your cmd_general.cpp and search this

ACMD(do_shutdown)

change with this ;

ACMD(do_shutdown)
{
	if (!ch->IsGM())
		return;

	if (NULL == ch)
	{
		sys_err("Accept shutdown command from %s.", ch->GetName());
	}
	TPacketGGShutdown p;
	p.bHeader = HEADER_GG_SHUTDOWN;
	P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGShutdown));

	Shutdown(10);
}

Best Regards

Ellie

Edited by Ken
  • Love 7

Do not be sorry, be better.

Link to comment

Or change

 

{ "shutdown", do_shutdown,  0,   POS_DEAD, GM_HIGH_WIZARD },

to

{ "shutdown",	do_shutdown,		0,			POS_DEAD,	GM_IMPLEMENTOR	},
  • Love 1

$ uptime
1:26AM  up 732 days,  8:29, 1 user, load averages: 0.38, 0.31, 0.22

$ uname -srp
FreeBSD 9.1-RELEASE amd64

Link to comment
  • 6 months later...

 

change this

if (ch->GetGMLevel() <= GM_IMPLEMENTOR)
return;

to this

if (ch->GetGMLevel() < GM_IMPLEMENTOR)
return;

 

Thanks for answer. But i think is enough

if (!ch->IsGM())
   return;

Kind Regards

Ken ~ TA

  • Love 1

Do not be sorry, be better.

Link to comment
  • Former Staff

 

 

change this

if (ch->GetGMLevel() <= GM_IMPLEMENTOR)
return;

to this

if (ch->GetGMLevel() < GM_IMPLEMENTOR)
return;

 

Thanks for answer. But i think is enough

if (!ch->IsGM())
   return;

Kind Regards

Ken ~ TA

 

yup :) it is enough

  • Love 1
Link to comment
  • VIP

Maybe I'm too tired, but this will throw an exception if the character does not exist.

 

1. You're using the IsGM() function on the CHARACTER class, before the NULL check.

2. If the character does not exist you're trying to use the GetName() function on the NULL class, which will also throw an exception.

  • Love 1
Link to comment
  • Former Staff

Maybe I'm too tired, but this will throw an exception if the character does not exist.

 

1. You're using the IsGM() function on the CHARACTER class, before the NULL check.

2. If the character does not exist you're trying to use the GetName() function on the NULL class, which will also throw an exception.

how can a player be not existed ? O.o

Link to comment

Maybe I'm too tired, but this will throw an exception if the character does not exist.

 

1. You're using the IsGM() function on the CHARACTER class, before the NULL check.

2. If the character does not exist you're trying to use the GetName() function on the NULL class, which will also throw an exception.

void interpret_command(LPCHARACTER ch, const char * argument, size_t len)

System already sent this. cmd.cpp -> cmd_gm.cpp or cmd_general.cpp or cmd_emotion.cpp

 

Kind Regards

Ken ~ TA

  • Love 1

Do not be sorry, be better.

Link to comment
  • 1 year later...
  • 2 years later...

my server say that command no exist....how fix...????

i add 

ACMD(do_shutdown)
{
	if (!ch->IsGM())
		return;

	if (NULL == ch)
	{
		sys_err("Accept shutdown command from %s.", ch->GetName());
	}
	TPacketGGShutdown p;
	p.bHeader = HEADER_GG_SHUTDOWN;
	P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGShutdown));

	Shutdown(10);
}

and nothing say that command no exist... and in cmd in CMD is shutdowm implementor...

Link to comment
  • VIP

Thread 2014... Refresh:

 

ACMD(do_shutdown)

change with this ;

ACMD(do_shutdown)
{
 	if (!ch)
	    return;
	if (!ch->IsGM())
	    return;

	TPacketGGShutdown p;
	p.bHeader = HEADER_GG_SHUTDOWN;
	P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGShutdown));
	sys_err("Accept shutdown command from %s.", ch->GetName());
	Shutdown(10);
}

 

  • Love 1
  • Confused 1
Link to comment

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.