mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-01 23:35:41 +00:00
Lua: Remove leading space in onChatMessage (fix #35)
This commit is contained in:
parent
48b9aa72dc
commit
7079e80b71
@ -36,5 +36,4 @@ private:
|
|||||||
static bool ShouldSpawn(TClient& c, const std::string& CarJson, int ID);
|
static bool ShouldSpawn(TClient& c, const std::string& CarJson, int ID);
|
||||||
static bool IsUnicycle(TClient& c, const std::string& CarJson);
|
static bool IsUnicycle(TClient& c, const std::string& CarJson);
|
||||||
static void Apply(TClient& c, int VID, const std::string& pckt);
|
static void Apply(TClient& c, int VID, const std::string& pckt);
|
||||||
TScopedTimer mLifeTimer { "Server" };
|
|
||||||
};
|
};
|
||||||
|
@ -121,7 +121,7 @@ void TServer::GlobalParser(const std::weak_ptr<TClient>& Client, std::string Pac
|
|||||||
beammp_trace(std::string(("got 'C' packet: '")) + Packet + ("' (") + std::to_string(Packet.size()) + (")"));
|
beammp_trace(std::string(("got 'C' packet: '")) + Packet + ("' (") + std::to_string(Packet.size()) + (")"));
|
||||||
if (Packet.length() < 4 || Packet.find(':', 3) == std::string::npos)
|
if (Packet.length() < 4 || Packet.find(':', 3) == std::string::npos)
|
||||||
break;
|
break;
|
||||||
auto Futures = LuaAPI::MP::Engine->TriggerEvent("onChatMessage", "", LockedClient->GetID(), LockedClient->GetName(), Packet.substr(Packet.find(':', 3) + 1));
|
auto Futures = LuaAPI::MP::Engine->TriggerEvent("onChatMessage", "", LockedClient->GetID(), LockedClient->GetName(), Packet.substr(Packet.find(':', 3) + 2));
|
||||||
TLuaEngine::WaitForAll(Futures);
|
TLuaEngine::WaitForAll(Futures);
|
||||||
LogChatMessage(LockedClient->GetName(), LockedClient->GetID(), Packet.substr(Packet.find(':', 3) + 1)); // FIXME: this needs to be adjusted once lua is merged
|
LogChatMessage(LockedClient->GetName(), LockedClient->GetID(), Packet.substr(Packet.find(':', 3) + 1)); // FIXME: this needs to be adjusted once lua is merged
|
||||||
if (std::any_of(Futures.begin(), Futures.end(),
|
if (std::any_of(Futures.begin(), Futures.end(),
|
||||||
|
11
src/main.cpp
11
src/main.cpp
@ -21,8 +21,7 @@
|
|||||||
// global, yes, this is ugly, no, it cant be done another way
|
// global, yes, this is ugly, no, it cant be done another way
|
||||||
TSentry Sentry {};
|
TSentry Sentry {};
|
||||||
|
|
||||||
int main(int argc, char** argv) //try {
|
int main(int argc, char** argv) try {
|
||||||
{
|
|
||||||
setlocale(LC_ALL, "C");
|
setlocale(LC_ALL, "C");
|
||||||
|
|
||||||
SetupSignalHandlers();
|
SetupSignalHandlers();
|
||||||
@ -62,14 +61,12 @@ int main(int argc, char** argv) //try {
|
|||||||
Application::Console().InitializeLuaConsole(LuaEngine);
|
Application::Console().InitializeLuaConsole(LuaEngine);
|
||||||
Application::CheckForUpdates();
|
Application::CheckForUpdates();
|
||||||
|
|
||||||
// TODO: replace
|
|
||||||
while (!Shutdown) {
|
while (!Shutdown) {
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||||
}
|
}
|
||||||
beammp_info("Shutdown.");
|
beammp_info("Shutdown.");
|
||||||
return 0;
|
return 0;
|
||||||
//} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
// beammp_error(e.what());
|
beammp_error(e.what());
|
||||||
// Sentry.LogException(e, _file_basename, _line);
|
Sentry.LogException(e, _file_basename, _line);
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user