Jump to content

joinquit how to edit outputChatBox messages


Adr1ft

Recommended Posts

I'm using the default joinquit resource and i want to edit the message colors for when a player quits the server and when he's changing he's nick. I've done it with "has joined the game" but i tried to do the same with other two messages and it doesn't work. I want the player names in these messages to be white color.  I want to be like this:

"#006400∙ #FF0000[Player name] #006400has left the game [#FF0000Quit#006400]

"#006400∙ #FF0000[Player current name] #006400is now known as #FF0000[New player name]

How can i edit it? 

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

function leftMessage(reason)
    if (showColorCodes) then
        outputChatBox(getDefaultColor().."#006400∙ "..getHexFriendlyNick(source, getPlayerName(source))..getDefaultColor().." #006400has left the game ["..reason.."]", root, 255, 100, 100, true)
    else
        outputChatBox("#006400∙ "..getPlayerName(source).." #006400has left the game ["..reason.."]", root, 255, 100, 100)
    end
end
addEventHandler("onPlayerQuit", root, leftMessage)
 

 

  • Like 1
Link to comment
addEventHandler("onPlayerLogin", root,
    function(_, account)
       local playerName = getPlayerName(source)
       local noColorName = string.gsub(playerName, "#%x%x%x%x%x%x", "")--this code prevents players from casting colors
          if setPlayerName(source, "#ffffff"..noColorName)--this code gives players white color
        end
    end
)

I recommend using commands like this

Edited by eoL|Shady
  • Like 2
Link to comment

Thank you, but i want to edit the joinquit resource in order for when the player is changing the name and quitting to have the colors in the screenshot.

And i am not sure where to put every color code. Tried already some variants and it doesn't work.

Here's how it looks right now  - check the screenshot

I want like this: 

#006400∙ #FF0000Cosmin #006400has left the game [#FF0000Quit#006400]

#006400∙ #FF0000Adr1ft #006400is now known as #FF0000Ady

 

#FF0000 - White
#006400 - Green

 

 

 

 

 

  • Like 2
Link to comment

ok i fix it .

I will edit and send the script you want specially for you.

you just need to embed these commands in your own JoinQuit script.  


     local noColorName = string.gsub(playerName, "#%x%x%x%x%x%x", "")--this code prevents players from casting colors
          if setPlayerName(source, "#ffffff"..noColorName)--this code gives players white color
 

these commands will make the names white, but "has left the game" and "is now known as" will make them green.
If you share the joinquit script with me privately, I can show you where to place the codes I sent.

Edited by eoL|Shady
  • Like 2
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...