Annas Posted December 31, 2015 Share Posted December 31, 2015 Hi , i have made a script , but i failed This script is about: 1- player did /superadvert TEXT and it will be shows a text to all players function advertising ( thePlayer, ... ) local message = table.concat( {...}, " " ) local r, g, b = getPlayerNametagColor(thePlayer) if message == "" then outputChatBox("You didnt enter a message!", thePlayer, 200, 0, 0) return end if isPlayerMuted(thePlayer) then outputChatBox("You are muted!", thePlayer, 255, 0, 0) return end outputChatBox("#FF6464(ADVERT) ".. getPlayerName(thePlayer).."#FFFFFF: "..message, root, r, g, b, true) end addCommandHandler ( "superadvert", advertising ) I wanna it get the player name tag color ONLY for the player name! Only this be with the currently name tag color of the player outputChatBox("#FF6464(ADVERT) ".. getPlayerName(thePlayer).." #FFFFFF: "..message, root, r, g, b, true) So when the player will did the command /superadvert Message for test & his name tag color is (R: 0 - G: 0 - B: 0) and his name TEST so the output will be like this (ADVERT) Test : Message for test Wish you understand me Link to comment
ViRuZGamiing Posted December 31, 2015 Share Posted December 31, 2015 You've used the command name and not the argument, check addCommandHandler player playerSource, string commandName, [string arg1, string arg2, ...] So, function advertising ( thePlayer, ... ) Gotta be function advertising ( thePlayer, commandName, ...) Don't know if it'll then work, didn't test, just noticed this. Happy new year, Billy Link to comment
Addlibs Posted January 1, 2016 Share Posted January 1, 2016 You've got to use hex = string.format("#%X%X%X", r, g, b) to convert RGB to Hex color (with preceding hash sign), which you then append as prefix to the player name, and change it to another hex on the suffix of the name or on the succeeding word. Example: local r, g, b = getPlayerNametagColor(thePlayer) local hex = string.format("#%X%X%X", r, g, b) local text = "#FF6464(ADVERT) "..hex .. getPlayerName(thePlayer).." #FFFFFF: "..message Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now