Max+ Posted March 1, 2013 Share Posted March 1, 2013 Hi all i keep giting this error ! bad argument #1 to 'ipairs' ( table expected , got boolean) iam Making it for teams team 1 and team 2 it source == team 1 then radio for team 1 only else if source == team 2 then radio for team 2 only function radio ( x ) local r, g, b = getTeamColor(getPlayerTeam(source)) local team = getTeamFromName ( getTeamName(getPlayerTeam(source)) ) local players = getPlayersInTeam ( team ) for k,v in ipairs(players) do if getTeamName(getPlayerTeam(source)) == "Team1" then setElementVisibleTo (Team1, v, false) setTimer (setElementVisibleTo, 500, 1, Team1, v, true) setTimer (setElementVisibleTo, 1000, 1, Team1, v, false) setTimer (setElementVisibleTo, 1500, 1, Team1, v, true) setTimer (setElementVisibleTo, 2000, 1, Team1, v, false) setTimer (setElementVisibleTo, 2500, 1, Team1, v, true) elseif getTeamName(getPlayerTeam(source)) == "Team2" then setElementVisibleTo (Team2[source], v, false) setTimer (setElementVisibleTo, 500, 1, Team2[source], v, true) setTimer (setElementVisibleTo, 1000, 1, Team2[source], v, false) setTimer (setElementVisibleTo, 1500, 1, Team2[source], v, true) setTimer (setElementVisibleTo, 2000, 1, Team2[source], v, false) setTimer (setElementVisibleTo, 2500, 1, Team2[source], v, true) end if ( x == 5) then outputChatBox (""..getPlayerName(source)..": Taking Fire! Need Assistance!", v, r, g, b) elseif ( x == 1 ) then outputChatBox (""..getPlayerName(source)..": Attack the Enemys Team !", v, r, g, b) elseif ( x == 2 ) then outputChatBox (""..getPlayerName(source)..": Defend our Team!", v, r, g, b) elseif ( x == 3 ) then outputChatBox (""..getPlayerName(source)..": Its ours", v, r, g, b) elseif ( x == 4 ) then outputChatBox (""..getPlayerName(source)..": I Cant Help !", v, r, g, b) elseif ( x == 6 ) then outputChatBox (""..getPlayerName(source)..": Requesting backup!!!", v, r, g, b) elseif ( x == 11 ) then outputChatBox (""..getPlayerName(source)..": Enemy spotted!!", v, r, g, b) elseif ( x == 12 ) then outputChatBox (""..getPlayerName(source)..": Enemy Vehicle spotted!!", v, r, g, b) elseif ( x == 13 ) then outputChatBox (""..getPlayerName(source)..": Enemy Airplane spotted!!", v, r, g, b) elseif ( x == 16 ) then outputChatBox (""..getPlayerName(source)..": Roger that!", v, r, g, b) elseif ( x == 17 ) then outputChatBox (""..getPlayerName(source)..": Negative!", v, r, g, b) elseif ( x == 18 ) then outputChatBox (""..getPlayerName(source)..": I got one!", v, r, g, b) end end end addEvent ("radio", true) addEventHandler ("radio", getRootElement(), radio) Link to comment
Castillo Posted March 1, 2013 Share Posted March 1, 2013 Show us how do you trigger "radio" event. Link to comment
Castillo Posted March 1, 2013 Share Posted March 1, 2013 function radio ( x ) local team = getPlayerTeam ( source ) if ( not team ) then return outputChatBox ( "You are not in a team.", source, 255, 0, 0 ) end local r, g, b = getTeamColor ( team ) local players = getPlayersInTeam ( team ) for k,v in ipairs(players) do if getTeamName(getPlayerTeam(source)) == "Team1" then setElementVisibleTo (Team1, v, false) setTimer (setElementVisibleTo, 500, 1, Team1, v, true) setTimer (setElementVisibleTo, 1000, 1, Team1, v, false) setTimer (setElementVisibleTo, 1500, 1, Team1, v, true) setTimer (setElementVisibleTo, 2000, 1, Team1, v, false) setTimer (setElementVisibleTo, 2500, 1, Team1, v, true) elseif getTeamName(getPlayerTeam(source)) == "Team2" then setElementVisibleTo (Team2[source], v, false) setTimer (setElementVisibleTo, 500, 1, Team2[source], v, true) setTimer (setElementVisibleTo, 1000, 1, Team2[source], v, false) setTimer (setElementVisibleTo, 1500, 1, Team2[source], v, true) setTimer (setElementVisibleTo, 2000, 1, Team2[source], v, false) setTimer (setElementVisibleTo, 2500, 1, Team2[source], v, true) end if ( x == 5) then outputChatBox (""..getPlayerName(source)..": Taking Fire! Need Assistance!", v, r, g, b) elseif ( x == 1 ) then outputChatBox (""..getPlayerName(source)..": Attack the Enemys Team !", v, r, g, b) elseif ( x == 2 ) then outputChatBox (""..getPlayerName(source)..": Defend our Team!", v, r, g, b) elseif ( x == 3 ) then outputChatBox (""..getPlayerName(source)..": Its ours", v, r, g, b) elseif ( x == 4 ) then outputChatBox (""..getPlayerName(source)..": I Cant Help !", v, r, g, b) elseif ( x == 6 ) then outputChatBox (""..getPlayerName(source)..": Requesting backup!!!", v, r, g, b) elseif ( x == 11 ) then outputChatBox (""..getPlayerName(source)..": Enemy spotted!!", v, r, g, b) elseif ( x == 12 ) then outputChatBox (""..getPlayerName(source)..": Enemy Vehicle spotted!!", v, r, g, b) elseif ( x == 13 ) then outputChatBox (""..getPlayerName(source)..": Enemy Airplane spotted!!", v, r, g, b) elseif ( x == 16 ) then outputChatBox (""..getPlayerName(source)..": Roger that!", v, r, g, b) elseif ( x == 17 ) then outputChatBox (""..getPlayerName(source)..": Negative!", v, r, g, b) elseif ( x == 18 ) then outputChatBox (""..getPlayerName(source)..": I got one!", v, r, g, b) end end end addEvent ("radio", true) addEventHandler ("radio", getRootElement(), radio) Link to comment
Max+ Posted March 1, 2013 Author Share Posted March 1, 2013 This well not make team 1 radio messaeg show to team 2 right ? Link to comment
Castillo Posted March 1, 2013 Share Posted March 1, 2013 I didn't understand what is this for: if getTeamName(getPlayerTeam(source)) == "Team1" then setElementVisibleTo (Team1, v, false) setTimer (setElementVisibleTo, 500, 1, Team1, v, true) setTimer (setElementVisibleTo, 1000, 1, Team1, v, false) setTimer (setElementVisibleTo, 1500, 1, Team1, v, true) setTimer (setElementVisibleTo, 2000, 1, Team1, v, false) setTimer (setElementVisibleTo, 2500, 1, Team1, v, true) elseif getTeamName(getPlayerTeam(source)) == "Team2" then setElementVisibleTo (Team2[source], v, false) setTimer (setElementVisibleTo, 500, 1, Team2[source], v, true) setTimer (setElementVisibleTo, 1000, 1, Team2[source], v, false) setTimer (setElementVisibleTo, 1500, 1, Team2[source], v, true) setTimer (setElementVisibleTo, 2000, 1, Team2[source], v, false) setTimer (setElementVisibleTo, 2500, 1, Team2[source], v, true) end Link to comment
Max+ Posted March 1, 2013 Author Share Posted March 1, 2013 Solid You Know BaseMode and Tatcis Right? There is 2 Teams if i was in team 1 and send radio message i need it for my team only other team can't see my message and if i was team 2 do the same to team 1 Link to comment
Castillo Posted March 1, 2013 Share Posted March 1, 2013 Then that code is not required. Link to comment
Max+ Posted March 2, 2013 Author Share Posted March 2, 2013 so it well be like this ? function radio ( x ) local team = getPlayerTeam ( source ) if ( not team ) then return outputChatBox ( "You are not in a team!", source, 255, 0, 0 ) end local r, g, b = getTeamColor ( team ) local players = getPlayersInTeam ( team ) for k,v in ipairs(players) do if getTeamName(getPlayerTeam(source)) == "Team1" then elseif getTeamName(getPlayerTeam(source)) == "Team2" then end if ( x == 5) then outputChatBox (""..getPlayerName(source)..": Taking Fire! Need Assistance!", v, r, g, b) elseif ( x == 1 ) then outputChatBox (""..getPlayerName(source)..": Attack the Enemys Team !", v, r, g, b) elseif ( x == 2 ) then outputChatBox (""..getPlayerName(source)..": Defend our Team!", v, r, g, b) elseif ( x == 3 ) then outputChatBox (""..getPlayerName(source)..": Its ours", v, r, g, b) elseif ( x == 4 ) then outputChatBox (""..getPlayerName(source)..": I Cant Help !", v, r, g, b) elseif ( x == 6 ) then outputChatBox (""..getPlayerName(source)..": Requesting backup!!!", v, r, g, b) elseif ( x == 11 ) then outputChatBox (""..getPlayerName(source)..": Enemy spotted!!", v, r, g, b) elseif ( x == 12 ) then outputChatBox (""..getPlayerName(source)..": Enemy Vehicle spotted!!", v, r, g, b) elseif ( x == 13 ) then outputChatBox (""..getPlayerName(source)..": Enemy Airplane spotted!!", v, r, g, b) elseif ( x == 16 ) then outputChatBox (""..getPlayerName(source)..": Roger that!", v, r, g, b) elseif ( x == 17 ) then outputChatBox (""..getPlayerName(source)..": Negative!", v, r, g, b) elseif ( x == 18 ) then outputChatBox (""..getPlayerName(source)..": I got one!", v, r, g, b) end end end addEvent ("radio", true) addEventHandler ("radio", getRootElement(), radio) Link to comment
Castillo Posted March 2, 2013 Share Posted March 2, 2013 function radio ( x ) local team = getPlayerTeam ( source ) if ( not team ) then return outputChatBox ( "You are not in a team!", source, 255, 0, 0 ) end local r, g, b = getTeamColor ( team ) local players = getPlayersInTeam ( team ) for _, v in ipairs ( players ) do if ( x == 5) then outputChatBox (""..getPlayerName(source)..": Taking Fire! Need Assistance!", v, r, g, b) elseif ( x == 1 ) then outputChatBox (""..getPlayerName(source)..": Attack the Enemys Team !", v, r, g, b) elseif ( x == 2 ) then outputChatBox (""..getPlayerName(source)..": Defend our Team!", v, r, g, b) elseif ( x == 3 ) then outputChatBox (""..getPlayerName(source)..": Its ours", v, r, g, b) elseif ( x == 4 ) then outputChatBox (""..getPlayerName(source)..": I Cant Help !", v, r, g, b) elseif ( x == 6 ) then outputChatBox (""..getPlayerName(source)..": Requesting backup!!!", v, r, g, b) elseif ( x == 11 ) then outputChatBox (""..getPlayerName(source)..": Enemy spotted!!", v, r, g, b) elseif ( x == 12 ) then outputChatBox (""..getPlayerName(source)..": Enemy Vehicle spotted!!", v, r, g, b) elseif ( x == 13 ) then outputChatBox (""..getPlayerName(source)..": Enemy Airplane spotted!!", v, r, g, b) elseif ( x == 16 ) then outputChatBox (""..getPlayerName(source)..": Roger that!", v, r, g, b) elseif ( x == 17 ) then outputChatBox (""..getPlayerName(source)..": Negative!", v, r, g, b) elseif ( x == 18 ) then outputChatBox (""..getPlayerName(source)..": I got one!", v, r, g, b) end end end addEvent ("radio", true) addEventHandler ("radio", getRootElement(), radio) Link to comment
X-SHADOW Posted March 3, 2013 Share Posted March 3, 2013 Thank's Solid It's Working . Topic Closed ! Link to comment
iPrestege Posted March 3, 2013 Share Posted March 3, 2013 Thank's Solid It's Working .Topic Closed ! Are you the owner of this topic? Link to comment
iPrestege Posted March 3, 2013 Share Posted March 3, 2013 Nice thing this topic going to hell Greetings ( = LoooL! Link to comment
Castillo Posted March 3, 2013 Share Posted March 3, 2013 Thank's Solid It's Working .Topic Closed ! You're welcome. 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