12p Posted November 12, 2011 Posted November 12, 2011 What does not work. Use /debugscript 3 If no errors were shown, debug by yourself (hope you know how to do it).
^Dev-PoinT^ Posted November 12, 2011 Author Posted November 12, 2011 the teams are show but setTeam is the problem
12p Posted November 12, 2011 Posted November 12, 2011 Tell me the specific debug message ("ERROR: ...", "Warning: ...", etc)
^Dev-PoinT^ Posted November 12, 2011 Author Posted November 12, 2011 no erros but its dont set me in any Team and i see the team function but its dont work to
12p Posted November 12, 2011 Posted November 12, 2011 Give this line to your code. ouputChatBox ( "teamBlue: ".. tostring ( teamBlue ).. "; teamRed: ".. tostring ( teamRed) ) What does it output?
^Dev-PoinT^ Posted November 12, 2011 Author Posted November 12, 2011 no thing and debguscript nothing To how about use getElementByType (team)? teamRed = createTeam ( "Red", 255, 0, 0 ) teamBlue = createTeam ( "Blue", 0, 0, 255 ) function balanceTeams ( ) local RedCount = countPlayersInTeam ( teamBlue ) local BlueCount = countPlayersInTeam ( teamRed ) if RedCount ~= BlueCount then if RedCount > BlueCount then setPlayerTeam ( source , teamBlue ) elseif RedCount < BlueCount then setPlayerTeam ( source , teamRed ) end outputChatBox ( "You've been moved to the "..getTeamName ( getPlayerTeam ( source ) ):lower ( ).." team!", source ) ouputChatBox ( "teamBlue: ".. tostring ( teamBlue ).. "; teamRed: ".. tostring ( teamRed) ) end end addEventHandler ( "onPlayerJoin", getRootElement ( ), balanceTeams )
Castillo Posted November 12, 2011 Posted November 12, 2011 teamRed = createTeam ( "Red", 255, 0, 0 ) teamBlue = createTeam ( "Blue", 0, 0, 255 ) function balanceTeams ( ) local RedCount = countPlayersInTeam ( teamBlue ) local BlueCount = countPlayersInTeam ( teamRed ) if RedCount ~= BlueCount then if RedCount > BlueCount then setPlayerTeam ( source , teamBlue ) elseif RedCount < BlueCount then setPlayerTeam ( source , teamRed ) end outputChatBox ( "You've been moved to the "..getTeamName ( getPlayerTeam ( source ) ):lower ( ).." team!", source ) outputChatBox ( "teamBlue: ".. tostring ( teamBlue ).. "; teamRed: ".. tostring ( teamRed) ) -- You had ouputChatBox end end addEventHandler ( "onPlayerJoin", getRootElement ( ), balanceTeams )
TAPL Posted November 12, 2011 Posted November 12, 2011 teamRed = createTeam ( "Red", 255, 0, 0 ) teamBlue = createTeam ( "Blue", 0, 0, 255 ) function balanceTeams () local RedCount = countPlayersInTeam ( teamBlue ) local BlueCount = countPlayersInTeam ( teamRed ) if RedCount ~= BlueCount then if RedCount > BlueCount then setPlayerTeam ( source , teamBlue ) elseif RedCount < BlueCount then setPlayerTeam ( source , teamRed ) end else setPlayerTeam ( source , teamRed ) end outputChatBox ( "You've been moved to the "..getTeamName (getPlayerTeam(source)):lower ().." team!", source ) end addEventHandler ("onPlayerJoin", root, balanceTeams)
^Dev-PoinT^ Posted November 12, 2011 Author Posted November 12, 2011 Tapl see what he say ======= teams.lua:3: Bad argument @' countPlayersInTeam teams.lua:3: Bad argument @' getTeamName attempt to index a boolean value ========= soldSnake14 dos not setThe Team see the Pic
Castillo Posted November 12, 2011 Posted November 12, 2011 I just tested the script and works perfectly, I got moved to the red team. "You've been moved to the red team!"
TAPL Posted November 12, 2011 Posted November 12, 2011 teamRed = createTeam ( "Red", 255, 0, 0 ) teamBlue = createTeam ( "Blue", 0, 0, 255 ) function balanceTeams () local RedCount = countPlayersInTeam(teamRed) local BlueCount = countPlayersInTeam(teamBlue) if RedCount ~= BlueCount then if RedCount > BlueCount then setPlayerTeam ( source , teamBlue ) elseif RedCount < BlueCount then setPlayerTeam ( source , teamRed ) end else setPlayerTeam ( source , teamRed ) end outputChatBox ( "You've been moved to the "..getTeamName (getPlayerTeam(source)):lower ().." team!", source ) end addEventHandler ("onPlayerJoin", root, balanceTeams)
^Dev-PoinT^ Posted November 12, 2011 Author Posted November 12, 2011 Back! i start it dont outputChatBox .. and i use admin Panel to setTeam and it set me P.S iam runing it with utf-witout Bom
BinSlayer1 Posted November 12, 2011 Posted November 12, 2011 what do you mean you start it and you use the admin panel? All you have to do is start the script and reconnect.. see if when you join you get sent to the red team
^Dev-PoinT^ Posted November 12, 2011 Author Posted November 12, 2011 Thxxxxxxxx For all and Big Thx For BinSlayer1 thx i start the script and i didnt reconnect lol thx sloved
12p Posted November 12, 2011 Posted November 12, 2011 Your script may have some bugs if you restart it with players playing at the time. To prevent it, use this code, please. teamRed = createTeam ( "Red", 255, 0, 0 ) teamBlue = createTeam ( "Blue", 0, 0, 255 ) function balanceTeams ( player ) if source then player = source end local RedCount = countPlayersInTeam(teamRed) local BlueCount = countPlayersInTeam(teamBlue) if RedCount ~= BlueCount then if RedCount > BlueCount then setPlayerTeam ( player, teamBlue ) elseif RedCount < BlueCount then setPlayerTeam ( player, teamRed ) end else setPlayerTeam ( player, teamRed ) end outputChatBox ( "You've been moved to the "..getTeamName (getPlayerTeam(player)):lower ().." team!", player ) end addEventHandler ("onPlayerJoin", root, balanceTeams) for i, v in ipairs ( getElementsByType ( "player" ) ) do balanceTeams ( v ) end
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