Skip to content

Commit

Permalink
joinquit: Fix some abuse cases (nick change)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dutchman101 authored Jan 26, 2024
1 parent d8c35b0 commit de6614a
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions [gameplay]/joinquit/joinquit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,21 @@ end
addEventHandler("onPlayerJoin", root, joinMessage)

function nickChangeMessage(oldNick, newNick)
if (showColorCodes) then
outputChatBox(getDefaultColor().."* "..getHexFriendlyNick(source, oldNick)..getDefaultColor().." is now known as "..getHexFriendlyNick(source, newNick), root, 255, 100, 100, true)
else
outputChatBox("* "..oldNick.." is now known as "..newNick, root, 255, 100, 100)
end
    if wasEventCancelled() then
        return
    end

    if isPlayerMuted(source) then
        cancelEvent()
        outputChatBox("You cannot change your nickname whilst muted!", source, 255, 0, 0)
        return
    end

    if (showColorCodes) then
        outputChatBox(getDefaultColor().."* "..getHexFriendlyNick(source, oldNick)..getDefaultColor().." is now known as "..getHexFriendlyNick(source, newNick), root, 255, 100, 100, true)
    else
        outputChatBox("* "..oldNick.." is now known as "..newNick, root, 255, 100, 100)
    end
end
addEventHandler("onPlayerChangeNick", root, nickChangeMessage)

Expand Down

0 comments on commit de6614a

Please sign in to comment.