mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-03 16:25:35 +00:00
Add kick response
This commit is contained in:
parent
c3151093e2
commit
1bc9a5293e
@ -181,6 +181,11 @@ void TConsole::Command_Kick(const std::string& cmd) {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
if (!Kicked) {
|
||||||
|
Application::Console().WriteRaw("Error: No player with name matching '" + Name + "' was found.");
|
||||||
|
} else {
|
||||||
|
Application::Console().WriteRaw("Kicked player '" + Name + "' for reason: '" + Reason + "'.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,15 +196,24 @@ void TConsole::Command_Say(const std::string& cmd) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TConsole::Command_List(const std::string& cmd) {
|
void TConsole::Command_List(const std::string&) {
|
||||||
std::stringstream ss;
|
if (mLuaEngine->Server().ClientCount() == 0) {
|
||||||
mLuaEngine->Server().ForEachClient([&](std::weak_ptr<TClient> Client) -> bool {
|
Application::Console().WriteRaw("No players online.");
|
||||||
if (!Client.expired()) {
|
} else {
|
||||||
auto locked = Client.lock();
|
std::stringstream ss;
|
||||||
ss <<
|
ss << std::left << std::setw(25) << "Name" << std::setw(6) << "ID" << std::setw(6) << "Cars" << std::endl;
|
||||||
}
|
mLuaEngine->Server().ForEachClient([&](std::weak_ptr<TClient> Client) -> bool {
|
||||||
return true;
|
if (!Client.expired()) {
|
||||||
});
|
auto locked = Client.lock();
|
||||||
|
ss << std::left << std::setw(25) << locked->GetName()
|
||||||
|
<< std::setw(6) << locked->GetID()
|
||||||
|
<< std::setw(6) << locked->GetCarCount() << "\n";
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
auto Str = ss.str();
|
||||||
|
Application::Console().WriteRaw(Str.substr(0, Str.size() - 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TConsole::RunAsCommand(const std::string& cmd, bool IgnoreNotACommand) {
|
void TConsole::RunAsCommand(const std::string& cmd, bool IgnoreNotACommand) {
|
||||||
@ -292,6 +306,9 @@ TConsole::TConsole() {
|
|||||||
} else if (StringStartsWith(cmd, "say")) {
|
} else if (StringStartsWith(cmd, "say")) {
|
||||||
RunAsCommand(cmd, true);
|
RunAsCommand(cmd, true);
|
||||||
Command_Say(cmd);
|
Command_Say(cmd);
|
||||||
|
} else if (StringStartsWith(cmd, "list")) {
|
||||||
|
RunAsCommand(cmd, true);
|
||||||
|
Command_List(cmd);
|
||||||
} else if (!cmd.empty()) {
|
} else if (!cmd.empty()) {
|
||||||
RunAsCommand(cmd);
|
RunAsCommand(cmd);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user