xeon17 Posted May 11, 2014 Share Posted May 11, 2014 The script : addCommandHandler("gang", function(player, command, subcommand, ...) local args = {...} local team = getPlayerTeam(player) local teamMates = getPlayersInTeam ( team ) for _, team in ipairs(teamMates) do setPlayerNametagText ( team, tag ) if(subcommand == "tag") then if(not isElement(team)) then return outputChatBox("#F4A460[GANG]#F08080 You has not a gang...", player, 0, 0, 0, true) end local tag = args[1] if(tag) then setElementData(team, "tag", tag) return outputChatBox("#F4A460[GANG]#F08080 Your gang tag is = " .. tag , player, 0, 0, 0, true) else setElementData(team, "tag", nil) return outputChatBox("#F4A460[GANG]#F08080 Tag removed.", player, 0, 0, 0, true) end end end end) addEventHandler("onPlayerChat", root, function(message, messageType) local team = getPlayerTeam(source) if team then local tag = getElementData(team, "tag") if tag then if messageType == 0 then cancelEvent() local r, g, b = getPlayerNametagColor(source) outputChatBox(string.format("[%s]%s: #FFFFFF %s", tag, getPlayerName(source), message), root, r, g, b, true) elseif messageType == 2 then cancelEvent() local r, g, b = getPlayerNametagColor(source) for _, member in ipairs( getPlayersInTeam(team) ) do outputChatBox(string.format("[%s]%s: #FFFFFF %s", tag, getPlayerName(source), message), member, r, g, b, true) end end end end end) I edited a little my old script and got a bug tried to fix , but still have this bug... EDIT : after fix of frist bug script again have a bug. [2014-05-11 15:22:50] SCRIPT ERROR: Tag\server.lua:20: unexpected symbol near ')' (SOLVED) NEW BUG: [2014-05-11 15:27:53] ERROR: Tag\server.lua:5: bad argument #1 to 'ipairs' (table expected, got boolean) ( SOLVED) LATEST BUG : [2014-05-11 15:40:16] WARNING: Tag\server.lua:4: Bad argument @ 'getPlayersInTeam' [2014-05-11 15:40:16] ERROR: Tag\server.lua:5: bad argument #1 to 'ipairs' (table expected, got boolean) Link to comment
Castillo Posted May 11, 2014 Share Posted May 11, 2014 That means the player has no team, therefore, getPlayersInTeam won't work. Link to comment
xeon17 Posted May 11, 2014 Author Share Posted May 11, 2014 That means the player has no team, therefore, getPlayersInTeam won't work. I tested it only on me , will the setPlayerNatetagText work ? i created it only for chat, today tried for nametagtext. Link to comment
Castillo Posted May 11, 2014 Share Posted May 11, 2014 I don't know what you are trying to do, so I don't know if it would work. Link to comment
xeon17 Posted May 11, 2014 Author Share Posted May 11, 2014 I don't know what you are trying to do, so I don't know if it would work. I'm try to change player name tag text to the text witch he choose , i edited the script today.. Before it only changed the text in player name on ouPutChatBox. extample : /gang tag FsN my name : [FsN]XeoN in chat: [FsN]XeoN Link to comment
Castillo Posted May 11, 2014 Share Posted May 11, 2014 You don't want to change his real name? only his nametag text and use that for when the player chats? Link to comment
xeon17 Posted May 11, 2014 Author Share Posted May 11, 2014 You don't want to change his real name? only his nametag text and use that for when the player chats? I allerdy did it for chat , i'm enter gang SAUR and type /gang tag FsN and everyone from my gang have the tag [FsN] when he write something in chat , i'm try to change his nametagtext when i see some player ingame i want he have same text / tag as in chatbox what i allerdy created. sorry for my bad english Link to comment
Castillo Posted May 11, 2014 Share Posted May 11, 2014 So, what is the problem? why it doesn't work? 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