Pipeekz Posted November 19, 2014 Share Posted November 19, 2014 Otra vez yo >_< Bueno me descargue un autoteam pero miren esto, intente utilizar algunos tags de clanes para probarlo y miren lo que pasa Este es el código Names={} Tags={} Colors={} local names ={"[XPG] Xtreme Pro Gamers" "THE BOSS CLAN"} -- Team Name local tags ={"XPG" "BOSS"} -- Tag local colors ={"#FF0000" "#0000FF"} -- Color function loadTeams() for i,name in pairs(names) do Names[i]=name end for i,tag in pairs(tags) do Tags[i]=tag end for i,color in pairs(colors) do Colors[i] = color end end addEventHandler("onResourceStart",root,loadTeams) function moveOnStart() for i,player in pairs(getElementsByType("player")) do check(player) end end addEventHandler("onResourceStart",root,moveOnStart) function check (player) setPlayerTeam(player,nil) for i,tag in pairs(tags) do if string.find(getPlayerName(player),tag) then local name = Names[i] local color = Colors[i] if not getTeamFromName(name) then createTeam(name,getColorFromString(color)) end local team = getTeamFromName(name) setPlayerTeam(player,team) end end end function remove() for t,teams in pairs(names) do local team = getTeamFromName(teams) if team then if countPlayersInTeam ( team )==0 then destroyElement(team) end end end end function nick(old,new) setTimer(check,1000,1,source) setTimer(remove,1500,1) end addEventHandler("onPlayerChangeNick",root,nick) function join() setTimer(check,4000,1,source) end addEventHandler("onPlayerJoin",root,join) function quit(player) setTimer(remove,1000,1) end addEventHandler("onPlayerQuit",root,quit) He probado y al parecer solo pasa esto con ese tag o eso creo Link to comment
Tomas Posted November 19, 2014 Share Posted November 19, 2014 Names={} Tags={} Colors={} local names ={"[XPG] Xtreme Pro Gamers","THE BOSS CLAN"} -- Team Name local tags ={"XPG","BOSS"} -- Tag local colors ={"#FF0000","#0000FF"} -- Color function loadTeams() for i,name in pairs(names) do Names[i]=name end for i,tag in pairs(tags) do Tags[i]=tag end for i,color in pairs(colors) do Colors[i] = color end end addEventHandler("onResourceStart",root,loadTeams) function moveOnStart() for i,player in pairs(getElementsByType("player")) do check(player) end end addEventHandler("onResourceStart",root,moveOnStart) function check (player) setPlayerTeam(player,nil) for i,tag in pairs(tags) do if string.find(getPlayerName(player),tag) then local name = Names[i] local color = Colors[i] if not getTeamFromName(name) then createTeam(name,getColorFromString(color)) end local team = getTeamFromName(name) setPlayerTeam(player,team) end end end function remove() for t,teams in pairs(names) do local team = getTeamFromName(teams) if team then if countPlayersInTeam ( team )==0 then destroyElement(team) end end end end function nick(old,new) setTimer(check,1000,1,source) setTimer(remove,1500,1) end addEventHandler("onPlayerChangeNick",root,nick) function join() setTimer(check,4000,1,source) end addEventHandler("onPlayerJoin",root,join) function quit(player) setTimer(remove,1000,1) end addEventHandler("onPlayerQuit",root,quit) Link to comment
Pipeekz Posted November 19, 2014 Author Share Posted November 19, 2014 (edited) Muchas gracias Tomas pero, ¿me podrías explicar que fue lo que hiciste? quizás así algún día aprenda Edit: Sigue bug Edited November 19, 2014 by Guest Link to comment
Tomas Posted November 19, 2014 Share Posted November 19, 2014 El problema es que te habías olvidado de la coma (,) cuando separaste las tablas. Link to comment
Pipeekz Posted November 19, 2014 Author Share Posted November 19, 2014 Ahh eso, cuando lo postee si estaba así pero luego me di cuenta, las puse y siguió igual Link to comment
Recommended Posts