[Patch] Kicking player doesnt show reason?

Hey

I’ve recently been looking into why the kick command doesnt show the reason my trinitycore, it will announce that the player is kicked server-wide but the reason isnt given…

Any reason why? its default TC code … updated on the 20th, wasnt working before then either.

Kick Command Code :


	// kick player

	static bool HandleKickPlayerCommand(ChatHandler* handler, char const* args)

	{

		Player* target = NULL;

		std::string playerName;

		if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName))

			return false;

		if (handler->GetSession() && target == handler->GetSession()->GetPlayer())

		{

			handler->SendSysMessage(LANG_COMMAND_KICKSELF);

			handler->SetSentErrorMessage(true);

			return false;

		}

		// check online security

		if (handler->HasLowerSecurity(target, 0))

			return false;

		if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD))

			sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE, playerName.c_str());

		else

			handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str());

		target->GetSession()->KickPlayer();

		return true;

	}

Trinity String (282) :

 %s kicked[/code]

It is coded not to show the reason …

According to DB the syntax is .kick name reason

But the core code seems to be .kick name

Indeed, any way to change it to show the reason?


    // kick player

    static bool HandleKickPlayerCommand(ChatHandler* handler, char const* args)

    {

	    Player* target = NULL;

	    std::string playerName;

	    if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName))

		    return false;

	    if (handler->GetSession() && target == handler->GetSession()->GetPlayer())

	    {

		    handler->SendSysMessage(LANG_COMMAND_KICKSELF);

		    handler->SetSentErrorMessage(true);

		    return false;

	    }

	    // check online security

	    if (handler->HasLowerSecurity(target, 0))

		    return false;


	    char const* kickReason = strtok(NULL, "\r");

	    std::string kickReasonStr = "No reason";

	    if (kickReason != NULL)

		    kickReasonStr = kickReason;

	    if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD))

		    sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE, playerName.c_str(), kickReasonStr.c_str());

	    else

		    handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str(), kickReasonStr.c_str());

	    target->GetSession()->KickPlayer();

	    return true;

    }

REPLACE INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES

(282, 'Player %s kicked. Reason: %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

Thanks about to try it out (:

Any way to make a 5 second delay before removing them?

Making a delay might be hard …

I see no benefit from the effort, unless someone comes up with an easy solution.

I would do it with an event map and a world script.

See this:

http://pastebin.com/3aNVhK4e