Pikachu
September 23, 2012, 2:59pm
1
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]
Rochet2
September 23, 2012, 3:21pm
2
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
Pikachu
September 23, 2012, 3:30pm
3
Indeed, any way to change it to show the reason?
Rochet2
September 23, 2012, 3:42pm
4
// 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);
Pikachu
September 23, 2012, 3:59pm
5
Thanks about to try it out (:
Any way to make a 5 second delay before removing them?
Rochet2
September 23, 2012, 4:29pm
6
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