mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-02-16 10:41:01 +00:00
Fix CMake, Add more Lua API
This commit is contained in:
@@ -68,5 +68,5 @@ elseif (WIN32)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(RapidJSON CONFIG REQUIRED)
|
||||
target_include_directories(BeamMP-Server PRIVATE ${RAPIDJSON_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
|
||||
target_link_libraries(BeamMP-Server PRIVATE ws2_32 ZLIB::ZLIB ${OPENSSL_LIBRARIES} commandline sioclient_tls)
|
||||
target_link_libraries(BeamMP-Server ws2_32 ZLIB::ZLIB ${OPENSSL_LIBRARIES} commandline sioclient_tls)
|
||||
endif ()
|
||||
|
||||
@@ -117,7 +117,18 @@ void LuaAPI::MP::SendChatMessage(int ID, const std::string& Message) {
|
||||
}
|
||||
}
|
||||
|
||||
void LuaAPI::MP::RemoveVehicle(int PlayerID, int VehicleID) {
|
||||
void LuaAPI::MP::RemoveVehicle(int PID, int VID) {
|
||||
auto MaybeClient = GetClient(Engine->Server(), PID);
|
||||
if (!MaybeClient || MaybeClient.value().expired()) {
|
||||
beammp_lua_error("RemoveVehicle invalid Player ID");
|
||||
return;
|
||||
}
|
||||
auto c = MaybeClient.value().lock();
|
||||
if (!c->GetCarData(VID).empty()) {
|
||||
std::string Destroy = "Od:" + std::to_string(PID) + "-" + std::to_string(VID);
|
||||
Engine->Network().SendToAll(nullptr, Destroy, true, true);
|
||||
c->DeleteCar(VID);
|
||||
}
|
||||
}
|
||||
|
||||
void LuaAPI::MP::Set(int ConfigID, sol::object NewValue) {
|
||||
@@ -128,7 +139,13 @@ void LuaAPI::MP::Sleep(size_t Ms) {
|
||||
}
|
||||
|
||||
bool LuaAPI::MP::IsPlayerConnected(int ID) {
|
||||
auto MaybeClient = GetClient(Engine->Server(), ID);
|
||||
if (MaybeClient && !MaybeClient.value().expired()) {
|
||||
return MaybeClient.value().lock()->IsConnected();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool LuaAPI::MP::GetPlayerGuest(int ID) {
|
||||
bool LuaAPI::MP::IsPlayerGuest(int ID) {
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ TLuaEngine::StateThreadData::StateThreadData(const std::string& Name, std::atomi
|
||||
Table.set_function("GetPlayers", [&]() -> sol::table {
|
||||
return Lua_GetPlayers();
|
||||
});
|
||||
Table.set_function("GetPlayerGuest", &LuaAPI::MP::GetPlayerGuest);
|
||||
Table.set_function("IsPlayerGuest", &LuaAPI::MP::IsPlayerGuest);
|
||||
Table.set_function("DropPlayer", &LuaAPI::MP::DropPlayer);
|
||||
Table.set_function("GetPlayerIdentifiers", [&](int ID) -> sol::table {
|
||||
return Lua_GetPlayerIdentifiers(ID);
|
||||
|
||||
Reference in New Issue
Block a user