Jump to content

Fix Shutdown Server Command


Ken

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
Share on other sites

  • 6 months later...
  • Premium

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
Share on other sites

  • 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
Share on other sites

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
Share on other sites

  • 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
Share on other sites

  • Premium

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);
}

 

  • Confused 1
  • Love 1
Link to comment
Share on other sites

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.