MrXz Posted May 29, 2012 Share Posted May 29, 2012 Hola ! Bueno, quería saber, usando este script, como añadir un team mas pero usando un TAG, este script lo uso para mi clan osea todos los de mi clan tienen Admin y Smod, pero ahora quiero añadir otro clan pero usando el tag del clan, la verdad es que tuve una idea, pero no corrió el script. Alguna idea?, Por favor :c teamAdmin = createTeam ( "Clan", 0,124,255 ) teamDonador = createTeam ( "Donators", 107,255,0 ) function addtoteam(player) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "Admin" ) ) then setPlayerTeam ( player,teamAdmin ) elseif isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "SuperModerator" ) ) then setPlayerTeam ( player,teamAdmin ) elseif isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "moderator" ) ) then setPlayerTeam ( player,teamAdmin ) elseif isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "mod" ) ) then setPlayerTeam ( player,teamAdmin ) elseif isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "Donadores" ) ) then setPlayerTeam ( player,teamDonador ) end end function addtoteamtimer() setTimer(addtoteam,3000,1,source) end addEventHandler("onPlayerLogin",getRootElement(),addtoteamtimer) Link to comment
Edikosh998 Posted May 29, 2012 Share Posted May 29, 2012 El tag te referis al color del team? Si es asi, tenes que cambiar esto teamAdmin = createTeam ( "Clan", 0,124,255 ) -- 0,124,255 ...Esos son los del tag Igual no entendi bien la pregunta, asi que capaz no es lo que buscas. Link to comment
Castillo Posted May 29, 2012 Share Posted May 29, 2012 Que yo sepa se refiere al tag en el nombre del jugador, si es asi, entonces podes usar la funcion: string.find que se usa para buscar un string en otro string. Link to comment
MrXz Posted May 29, 2012 Author Share Posted May 29, 2012 Pues bien, mejor para no estar modificando el script, busque otro en la comunidad, encontre esto. ---------------do not change or touch this---------- Names={} Tags={} Colors={} ACL={} -------------------------------------------------------------- ---------------------------here put your clans read readme for instructions--------------------------------------- local names ={} local tags ={} local colors ={} local acls={} -------- load------------ 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 for i,acl in pairs(acls) do ACL[i] = acl end end addEventHandler("onResourceStart",getRootElement(),loadTeams) --------------------------------------------------- ----- move on start------------------ function moveOnStart() for i,player in pairs(getElementsByType("player")) do check(player) end end addEventHandler("onResourceStart",getRootElement(),moveOnStart) ------------------------------------------------------------------------- -----------check---------------------------- function check (player) setPlayerTeam(player,nil) for i,tag in pairs(tags) do if string.find(getPlayerName(player),tag) then local account=getPlayerAccount(player) if ACL[i]~="none" and not isObjectInACLGroup ( "user." ..getAccountName(account) , aclGetGroup ( ACL[i] ) ) then return end 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 -------------------------------- ----------remove Empty Team ---------- 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 ----------------------------------------------------- -------NickChange------------- function nick(old,new) setTimer(check,1000,1,source) setTimer(remove,1500,1) end addEventHandler("onPlayerChangeNick",getRootElement(),nick) --------------------------------------------- -------Join-------------------------------- function join() setTimer(check,4000,1,source) end addEventHandler("onPlayerJoin",getRootElement(),join) ------------------------------- ---------Quit--------------------- function quit(player) setTimer(remove,1000,1) end addEventHandler("onPlayerQuit",getRootElement(),quit) ------------------------------------ ---------Login--------------------- function login() setTimer(check,1000,1,source) setTimer(remove,1500,1) end addEventHandler("onPlayerLogin",getRootElement(),login) ------------------------------------ ---------Logout--------------------- function logout() setTimer(check,1000,1,source) setTimer(remove,1500,1) end addEventHandler("onPlayerLogout",getRootElement(),logout) ------------------------------------ ----------blip-------------- function blip(player) local team = getPlayerTeam(player) if team then for v,blip in pairs(getAttachedElements(player)) do if getElementType(blip)=="blip" then local r,g,b =getTeamColor(team) setBlipColor(blip,r,g,b,255) end end end end function timer() setTimer(blip,3000,1,source) end addEventHandler("onPlayerSpawn",getRootElement(),timer) Pero en esta parte quiero crear mi clan y otros clanes. local names ={"MI CLAN","-For Example2-} local tags ={"MC","TZ"} local colors ={"#00ffff","#FF0000} local acls={"Admin","SuperModerators","Everyone"} --- Pero si solo quiero que entre mi clan y mi clan tiene Smod y Admin, lo pruebo y sale error. Tiene algun problema?, no sale nada en debugscript3, solo sale mensajes del admin en problemas de ACL Link to comment
Castillo Posted May 30, 2012 Share Posted May 30, 2012 local names = { "MI CLAN", "-For Example2-" } local tags = { "MC", "TZ" } local colors = { "#00ffff", "#FF0000" } local acls = { "Admin", "SuperModerators", "Everyone" } --- Pero si solo quiero que entre mi clan y mi clan tiene Smod y Admin, lo pruebo y sale error. Link to comment
MrXz Posted May 30, 2012 Author Share Posted May 30, 2012 Muchas Gracias @Solidsnake14 Link to comment
Recommended Posts