Skip to content

Commit

Permalink
fixed mentions on join/leave messages
Browse files Browse the repository at this point in the history
  • Loading branch information
C1XTZ committed May 31, 2024
1 parent ee615d6 commit f623aee
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions mobilephone/mobilephone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,7 @@ end)
if settings.joinNotif then
local function connectionHandler(connectedCarIndex, action)
local isFriend = checkIfFriend(connectedCarIndex)
if settings.joinNotifFriends and not isFriend then
return
else
if settings.joinNotif and not settings.joinNotifFriends or isFriend then
table.insert(chat.messages, { action .. ' the Server', ac.getDriverName(connectedCarIndex) .. ' ', isFriend and '* ' or '', os.time() })

if settings.enableSound and ((not settings.joinNotifSoundFriends or isFriend) or settings.alwaysNotif) then
Expand Down Expand Up @@ -833,9 +831,15 @@ function script.windowMain(dt)
ui.popDWriteFont()

local cursorPos = vec2(ui.getCursorX(), ui.getCursorY() - dwriteSize.y) - vec2(1, 3)
local senderUserName = chat.messages[i][2]:sub(1, -3)
local senderUserName = chat.messages[i][2]

if string.endsWith(senderUserName, ": ") then
senderUserName = string.sub(senderUserName, 1, #senderUserName - 2)
elseif string.endsWith(senderUserName, " ") then
senderUserName = string.sub(senderUserName, 1, #senderUserName - 1)
end

if chat.messages[i][2] ~= '' and senderUserName ~= ac.getDriverName(0) then
if senderUserName ~= '' and senderUserName ~= ac.getDriverName(0) then
local messageHovered = {}
messageHovered[i] = ui.rectHovered(cursorPos, cursorPos + dwriteSize, true)
if messageHovered[i] and ui.mouseClicked(1) then
Expand Down

0 comments on commit f623aee

Please sign in to comment.