From 6a8b21d8a60352e2f3f7c55434800f6bd24873f4 Mon Sep 17 00:00:00 2001 From: Yimura Date: Sun, 7 Feb 2021 01:13:23 +0100 Subject: [PATCH] fix(PlayerJoining): Fixed player joining --- BigBaseV2/src/features/functions.cpp | 10 ++++++++++ BigBaseV2/src/features/functions.hpp | 1 + .../features/looped/system/update_player_structs.cpp | 4 +++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/BigBaseV2/src/features/functions.cpp b/BigBaseV2/src/features/functions.cpp index 694e1b38..9d3a1c98 100644 --- a/BigBaseV2/src/features/functions.cpp +++ b/BigBaseV2/src/features/functions.cpp @@ -68,6 +68,16 @@ namespace big STATS::STAT_GET_INT(RAGE_JOAAT("MPPLY_LAST_MP_CHAR"), statSlot, true); } + void func::join_message(Player player) + { + if (!g_settings.options["join_message"]) return; + + char join_msg[64]; + sprintf(join_msg, "%s is joining...", g_pointers->m_get_player_name(player)); + + notify::above_map(join_msg); + } + void func::join_session_type(session_type session) { if (session.id == -1) diff --git a/BigBaseV2/src/features/functions.hpp b/BigBaseV2/src/features/functions.hpp index 0caf7d29..9b73f862 100644 --- a/BigBaseV2/src/features/functions.hpp +++ b/BigBaseV2/src/features/functions.hpp @@ -14,6 +14,7 @@ namespace big static void delete_entity(Entity ent); static double distance_between_vectors(Vector3 a, Vector3 b); static void get_active_character_slot(int* statSlot); + static void join_message(Player player); static void join_session_type(session_type session); static bool raycast_entity(Entity* ent); static void reset_vehicle_sell_stats(); diff --git a/BigBaseV2/src/features/looped/system/update_player_structs.cpp b/BigBaseV2/src/features/looped/system/update_player_structs.cpp index b42a95b2..4d452cf6 100644 --- a/BigBaseV2/src/features/looped/system/update_player_structs.cpp +++ b/BigBaseV2/src/features/looped/system/update_player_structs.cpp @@ -1,3 +1,4 @@ +#include "features/functions.hpp" #include "features/sys.hpp" #include #include "fiber_pool.hpp" @@ -13,7 +14,8 @@ namespace big { if (NETWORK::NETWORK_IS_PLAYER_CONNECTED(i)) { - // if (!g_players[i].is_online) features::join_message((Player)i); + bool exists = g_players.find(i) != g_players.end(); + if (!exists || (exists && !g_players.at(i).is_online)) func::join_message((Player)i); players[i].id = i; players[i].is_online = true;