codeluaeveryday Posted January 4, 2012 Share Posted January 4, 2012 Hey, i just need help with one line LOL! Please ignore everything else! All i need you to pay attention to is the element. I believe it will show to the team. When i do so it shows no color, and # colors are shown. Any ideas? outputChatBox(RGBToHex(getTeamColor(getPlayerTeam(source))).."(TEAM) "..tagcolor.."["..tag.."] #FFFFFF"..name..": "..textcolor..text, getTeamName(getPlayerTeam(source)), 255,255,255, true) Thanks in advance, Chris *EDIT* It was working with old one... Instead it was showing to all, so i added the team as an element. RBGToHex is all good. Just the element. Link to comment
arezu Posted January 4, 2012 Share Posted January 4, 2012 second argument is an element, and you are using a string. Try removing getTeamName and only use getPlayerTeam(source) (dont know if it will work because i have never tried to outputChatBox to other than 1 player and all players) Link to comment
codeluaeveryday Posted January 4, 2012 Author Share Posted January 4, 2012 Didnt work :SSS Link to comment
codeluaeveryday Posted January 4, 2012 Author Share Posted January 4, 2012 function idtag(text, msgtype) local tag = getElementData(source, "ID") local tagcolor = get('tagidcolor') local textcolor = get('textcolor') local name = getPlayerName(source) if (msgtype == 0) then cancelEvent() if tag then cancelEvent() outputChatBox(tagcolor.."["..tag.."] #FFFFFF"..name..": "..textcolor..text, getRootElement(), 255, 255, 255, true) outputServerLog(name .. ": " .. text) end elseif (msgtype == 2) then cancelEvent() outputChatBox(RGBToHex(getTeamColor(getPlayerTeam(source))).."(TEAM) "..tagcolor.."["..tag.."] #FFFFFF"..name..": "..textcolor..text, getTeamName(getPlayerTeam(source)), 255,255,255, true) outputServerLog("TEAM: "..name .. ": " .. text) end end addEventHandler("onPlayerChat", root, idtag) function RGBToHex(red, green, blue, alpha) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end if(alpha) then return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) else return string.format("#%.2X%.2X%.2X", red,green,blue) end end Omg kenix, ALL I NEED is outputChatBox(RGBToHex(getTeamColor(getPlayerTeam(source))).."(TEAM) "..tagcolor.."["..tag.."] #FFFFFF"..name..": "..textcolor..text, getTeamName(getPlayerTeam(source)), 255,255,255, true) to be visible by the current player TEAM!!!!!!! Im just recreating teamchat, by u making me show my progress i risk someone stealing it before i release the update. They will claim it as theirs... Link to comment
arezu Posted January 4, 2012 Share Posted January 4, 2012 what do you mean by it didn't work? do you see the text but not in color, or do you not see it at all? also use /debugscript 3 Link to comment
codeluaeveryday Posted January 4, 2012 Author Share Posted January 4, 2012 Lol ok... Its basic, I can see it, but the ELEMENT is not working... No debug errors! Its all perfect i originally had outputChatBox(RGBToHex(getTeamColor(getPlayerTeam(source))).."(TEAM) "..tagcolor.."["..tag.."] #FFFFFF"..name..": "..textcolor..text, source, 255,255,255, true) That was for testing purposes! It all worked, but it was showing to all/theplayer... All else works but teamchat, it shows and no color ! So I tried to make it visible to the TEAM! SO LISTEN, EVERYTHING ELSE DOESNT MATTER FFS! ITS JUST THAT LINE! Link to comment
arezu Posted January 4, 2012 Share Posted January 4, 2012 try this: local team = getPlayerTeam(source) local teamName = tostring(getTeamName(team)) local player = getElementsByType("player") for i = 1, #player do local playerTeamName = tostring(getTeamName(getPlayerTeam(player[i]))) if(playerTeamName == teamName)then outputChatBox(RGBToHex(getTeamColor(team)).."(TEAM) "..tagcolor.."["..tag.."] #FFFFFF"..name..": "..textcolor..text, player[i], 255,255,255, true) end end Link to comment
codeluaeveryday Posted January 4, 2012 Author Share Posted January 4, 2012 Thanks, I could have never thought of this. Link to comment
Cadu12 Posted January 4, 2012 Share Posted January 4, 2012 https://wiki.multitheftauto.com/wiki/GetPlayersInTeam 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