iPrestege Posted April 14, 2013 Share Posted April 14, 2013 Hello Guys Why This Code Is not right what's the problem? addEventHandler("onPlayerChat",root, function(msg) local team = getPlayerTeam(source) if not team then return end local r,g,b = getTeamColor(team) cancelEvent() local myName = getPlayerName(source) if team and getTeamName(team) == "Drift" then for _,v in ipairs(getPlayersInTeam(getTeamFromName("Drift"))) do outputChatBox("* [ Drift ] : " .. myName .. "#FFFFFF : #ffffff" .. msg,v,r,g,b,true) end elseif team and getTeamName(team) == "Hajwalah" then for _,h in ipairs(getPlayersInTeam(getTeamFromName("Hajwalah"))) do outputChatBox("* [ Hajwalah ] : " .. myName .. "#FFFFFF : #ffffff" .. msg,h,r,g,b,true) end elseif team and getTeamName(team) == "Ksa~1" or getTeamName(team) == "Ksa~2" then local war = {getPlayersInTeam(getTeamFromName("Ksa~1")),getPlayersInTeam(getTeamFromName("Ksa~2"))} local newPlayer = {} for _,i in ipairs(war) do table.insert(newPlayer,i[1]) table.insert(newPlayer,i[2]) end for k,v in ipairs(newPlayer) do outputChatBox("* [ War ] : " .. myName .. "#FFFFFF : #ffffff" .. msg,v,r,g,b,true) end end end ) What u think is the problem? I think that there is an error in the entry table Link to comment
Castillo Posted April 14, 2013 Share Posted April 14, 2013 Mind explaining what is the problem? Link to comment
iPrestege Posted April 14, 2013 Author Share Posted April 14, 2013 The Script Enter The Table Two Times Why? That is the problem ! Link to comment
Castillo Posted April 14, 2013 Share Posted April 14, 2013 addEventHandler ( "onPlayerChat", root, function ( msg ) local team = getPlayerTeam ( source ) if ( not team ) then return end local r, g, b = getTeamColor ( team ) local teamName = getTeamName ( team ) cancelEvent ( ) local myName = getPlayerName ( source ) if ( team and teamName == "Drift" or teamName == "Hajwalah" ) then for _, v in ipairs ( getPlayersInTeam ( team ) ) do outputChatBox ( "* [ ".. teamName .." ] : ".. myName .."#FFFFFF : #ffffff".. msg, v, r, g, b, true ) end elseif ( team and teamName == "Ksa~1" or teamName == "Ksa~2" ) then for _, player in ipairs ( getElementsByType ( "player" ) ) do local team = getPlayerTeam ( player ) if ( team ) then local teamName = getTeamName ( team ) if ( teamName == "Ksa~1" or teamName == "Ksa~2" ) then outputChatBox ( "* [ War ] : ".. myName .."#FFFFFF : #ffffff".. msg, player, r, g, b, true ) end end end end end ) 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