Skip to content

Commit

Permalink
cleaned up message removal
Browse files Browse the repository at this point in the history
  • Loading branch information
C1XTZ committed Dec 23, 2023
1 parent 40bcb60 commit f0a740d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mobilephone/mobilephone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ ac.onChatMessage(function(message, senderCarIndex, senderSessionID)
movement.up = true
end
else --remove message
chat.messages[chat.messagecount] = nil
table.remove(chat.messages)
chat.messagecount = chat.messagecount - 1
end
else
Expand All @@ -208,7 +208,7 @@ ac.onChatMessage(function(message, senderCarIndex, senderSessionID)
end
chat.messages[chat.messagecount] = { message, '', '' }
else
chat.messages[chat.messagecount] = nil
table.remove(chat.messages)
chat.messagecount = chat.messagecount - 1
end
--only keep the 25 latest messages
Expand All @@ -225,7 +225,7 @@ if settings.joinnotif then
chat.messagecount = chat.messagecount + 1
chat.messages[chat.messagecount] = { 'joined the Server', ac.getDriverName(connectedCarIndex) .. ' ', '' }
if settings.joinnotiffriends and not checkIfFriend(connectedCarIndex) then
chat.messages[chat.messagecount] = nil
table.remove(chat.messages)
chat.messagecount = chat.messagecount - 1
else
if checkIfFriend(connectedCarIndex) then
Expand All @@ -250,7 +250,7 @@ if settings.joinnotif then
chat.messagecount = chat.messagecount + 1
chat.messages[chat.messagecount] = { 'left the Server', ac.getDriverName(connectedCarIndex) .. ' ', '' }
if settings.joinnotiffriends and not checkIfFriend(connectedCarIndex) then
chat.messages[chat.messagecount] = nil
table.remove(chat.messages)
chat.messagecount = chat.messagecount - 1
else
if checkIfFriend(connectedCarIndex) then
Expand Down

0 comments on commit f0a740d

Please sign in to comment.