fix(JoinMessage): Fixed join player message to be more efficient

This commit is contained in:
Yimura 2020-12-29 00:13:13 +01:00
parent 4f0cfcba75
commit 6b06ed9133
No known key found for this signature in database
GPG Key ID: 54EFAD29393A6E78
2 changed files with 8 additions and 10 deletions

View File

@ -3,22 +3,18 @@
namespace big namespace big
{ {
void features::join_message() void features::join_message(Player player)
{ {
bool bJoinMessage = g_settings.options["join_message"].get<bool>(); bool bJoinMessage = g_settings.options["join_message"].get<bool>();
if (bJoinMessage) if (bJoinMessage)
{ {
for (int i = 0; i < 32; i++) { char joinMsg[64];
if (!NETWORK::NETWORK_IS_PLAYER_CONNECTED(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(i)) && ENTITY::DOES_ENTITY_EXIST(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(i))) { strcpy(joinMsg, "<C>");
char joinMsg[64]; strcat(joinMsg, g_pointers->m_get_player_name(player));
strcpy(joinMsg, "<C>"); strcat(joinMsg, "</C> is joining.");
strcat(joinMsg, g_pointers->m_get_player_name(i));
strcat(joinMsg, "</C> is joining.");
features::notify::above_map(joinMsg); features::notify::above_map(joinMsg);
}
}
} }
} }
} }

View File

@ -10,6 +10,8 @@ namespace big
{ {
if (NETWORK::NETWORK_IS_PLAYER_CONNECTED(i)) if (NETWORK::NETWORK_IS_PLAYER_CONNECTED(i))
{ {
if (!g_players[i].is_online) features::join_message((Player)i);
g_players[i].is_online = true; g_players[i].is_online = true;
int iNetworkHandle[26]; int iNetworkHandle[26];