Cadu12 Posted August 29, 2011 Posted August 29, 2011 (edited) I did created myself it toady and works https://community.multitheftauto.com/index.php?p= ... ls&id=2855 Server-side: Tags = { {"YCN%|", "Your clan name", "#00bb9b", nil} } ATCarcolor = true ATNormalColor = {255, 255, 255} ATFixspam = {} function onResourceStartAutoteams() for name, data in ipairs(Tags) do for id, player in ipairs(getElementsByType("player")) do table.insert(ATFixspam, {source, false}) if string.find(getPlayerName(player), data[1]) then if not isElement(data[2]) or getElementType(data[2]) ~= "team" then creatingTeam = createTeam(data[2], getColorFromString (data[3])) if creatingTeam then outputDebugString("Autoteams: Added team '" .. data[2] .. "'.") data[4] = creatingTeam end end setTimer(function() local int = {} for name, data in ipairs(Tags) do for id, player in ipairs(getElementsByType("player")) do if string.find(getPlayerName(player), data[1]) then movedteam = setPlayerTeam(player, data[4]) if not movedteam then MoveToTeam = getTeamFromName(data[2]) if getPlayerTeam(player) and getFixspam(player) == false then outputDebugString("Autoteams: Set '" .. getPlayerName(player) .. "' to team as '" .. data[2] .. "'.") setFixspam(player, true) end setPlayerTeam(player, MoveToTeam) elseif getPlayerTeam(player) and getFixspam(player) == false then outputDebugString("Autoteams: Set '" .. getPlayerName(player) .. "' to team as '" .. data[2] .. "'.") setFixspam(player, true) end end end end end, 2000, 1) end end end end addEventHandler( "onResourceStart", getResourceRootElement(getThisResource()), onResourceStartAutoteams ) function onPlayerChangeNickAutoteams() setTimer(checkPlayerTeam, 1000, 1, source) end addEventHandler("onPlayerChangeNick", getRootElement(), onPlayerChangeNickAutoteams) function onPlayerJoinAutoteams() setTimer(checkPlayerTeam, 1000, 1, source) table.insert(ATFixspam, {source, false}) end addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoinAutoteams) function onPlayerQuitAutoteams() -- Remove teams if players are not team for i, v in ipairs(ATFixspam) do if v[1] == source then table.remove(ATFixspam, i) end end returnPlayerTeam = getPlayerTeam(source) if returnPlayerTeam then outputDebugString("Autoteams: Removed '" .. getPlayerName(source) .. "' from team as '" .. getTeamName(returnPlayerTeam) .. "'.") if countPlayersInTeam(returnPlayerTeam) == 0 then outputDebugString("Autoteams: Removed team '" .. returnPlayerTeam .. "'.") destroyElement(returnPlayerTeam) end end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuitAutoteams) function checkPlayerTeam(player) local publicplayer = player for name, data in ipairs(Tags) do if string.find(getPlayerName(player), data[1]) then if not isElement(data[4]) or getElementType(data[4]) ~= "team" then creatingTeam = createTeam(data[2], getColorFromString(data[3])) if creatingTeam then outputDebugString("Autoteams: Added team '" .. data[2] .. "'.") data[4] = creatingTeam end end setTimer(function() for name, data in ipairs(Tags) do if string.find(getPlayerName(publicplayer), data[1]) then movedteam = setPlayerTeam(publicplayer, data[4]) if not movedteam then MoveToTeam = getTeamFromName(data[2]) setPlayerTeam(player, MoveToTeam) if getPlayerTeam(player) and getFixspam(player) == false then outputDebugString("Autoteams: Set '" .. getPlayerName(player) .. "' to team as '" .. data[2] .. "'.") setFixspam(player, true) end elseif getPlayerTeam(player) and getFixspam(player) == false then outputDebugString("Autoteams: Set '" .. getPlayerName(player) .. "' to team as '" .. data[2] .. "'.") setFixspam(player, true) end end end end, 2000, 1) else -- Remove teams if players are not team returnPlayerTeam = getPlayerTeam(player) if returnPlayerTeam then outputDebugString("Autoteams: Removed '" .. getPlayerName(player) .. "' from team as '" .. getTeamName(returnPlayerTeam) .. "'.") setPlayerTeam(player, nil) setFixspam(player, false) if countPlayersInTeam(returnPlayerTeam) == 0 then outputDebugString("Autoteams: Removed team '" .. getTeamName(returnPlayerTeam) .. "'.") destroyElement(returnPlayerTeam) end end end end end function setFixspam(player, boolean) for i, v in ipairs(ATFixspam) do if v[1] == player then v[2] = boolean end end end function getFixspam(player) if not ATFixspam then return end for i, v in ipairs(ATFixspam) do if v[1] == player then return v[2] end end end For whos wants blips for race, add line: function onRaceEveryTime() for _,player in ipairs(getElementsByType("player")) do if not getPlayerTeam(player) then checkPlayerTeam(player) end if ATCarcolor == true then local r,g,b = ATNormalColor[1], ATNormalColor[2], ATNormalColor[3] local team = getPlayerTeam(player) if team then r,g,b = getTeamColor(team) end local PedIsInVehicle = getPedOccupiedVehicle(player) if PedIsInVehicle then setVehicleHeadLightColor(PedIsInVehicle, tonumber(r), tonumber(g), tonumber(b)) setVehicleColor(PedIsInVehicle, tonumber(r), tonumber(g), tonumber(b)) end local attachElement = getAttachedElements(player) if attachElement and #attachElement > 0 then for k, v in ipairs(attachElement) do if getElementType(v) and getElementType(v) == "blip" then setBlipColor(v, tonumber(r), tonumber(g), tonumber(b), 255) end end end end end end setTimer(onRaceEveryTime, 250, 0) Changelogs: 1.0: First public release 1.1: Fixed bugged 1.2: Fixed bugged. Added team color for blips 1.3: Fixed bugged for blips 1.4: Added event for race 1.5: • Fixed bugs 1.6 • Fixed bugs 2.0 • Fixed bugs • Fixed spammer on debugscript Add credis if you used Edited April 19, 2012 by Guest Ingame nick: Cadu12
SnoopCat Posted August 29, 2011 Posted August 29, 2011 not working VISIT TSW RACING SERVER http://tswracing.net/
Cadu12 Posted August 29, 2011 Author Posted August 29, 2011 1. Stop running old autoteams 2. Put your Tag variables 3. Add admin in ACL Ingame nick: Cadu12
SnoopCat Posted August 29, 2011 Posted August 29, 2011 i just did it but now working anyways VISIT TSW RACING SERVER http://tswracing.net/
Cadu12 Posted August 29, 2011 Author Posted August 29, 2011 You're welcome. Good race gamemode Ingame nick: Cadu12
SnoopCat Posted August 30, 2011 Posted August 30, 2011 i need it for race -.- VISIT TSW RACING SERVER http://tswracing.net/
Cadu12 Posted August 31, 2011 Author Posted August 31, 2011 No, next version, i will add. I dont have time becuase of school Ingame nick: Cadu12
Cadu12 Posted August 31, 2011 Author Posted August 31, 2011 Updated, copy my code again. Added team color for blips. Ingame nick: Cadu12
bandi94 Posted September 2, 2011 Posted September 2, 2011 added to admin group and only info on debugscrit added team and moved to team but not creating team no team on scoreboard or admin panel or tag color or blips nothing (i think i am going make my own ) and why need an autoteam admin rights? Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
HunT Posted September 10, 2011 Posted September 10, 2011 Oh yep work but for Default color players? example : {"%%", "Drivers", "#770000", nil}, ??? <---This no work old AutoTeam : @Huntone_
Cadu12 Posted September 10, 2011 Author Posted September 10, 2011 {"", "Drivers", "#770000", nil} Ingame nick: Cadu12
HunT Posted September 10, 2011 Posted September 10, 2011 {"", "Drivers", "#770000", nil} Ok Work but this script work only for 3 clan i have 9 clans and one default "drivers" solution? Anyway nice script @Huntone_
Cadu12 Posted September 10, 2011 Author Posted September 10, 2011 You're welcome here Ingame nick: Cadu12
bandi94 Posted September 10, 2011 Posted September 10, 2011 the solution is my autoteam downlaod it from here : https://community.multitheftauto.com/ind ... ls&id=2833 Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
Cadu12 Posted September 10, 2011 Author Posted September 10, 2011 Are you ading my topic? Ingame nick: Cadu12
bandi94 Posted September 12, 2011 Posted September 12, 2011 nope only your script is full buged ( i tested my self only debugscript created team player added to team and done no team on scoreboard and so on .. and an autoeam don't need admin right's) and you don't change anything and i am just helping @Hunterix for the fastest solution for his problem Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
Cadu12 Posted September 12, 2011 Author Posted September 12, 2011 Proof me with bugged, for race we dont need admin Ingame nick: Cadu12
HunT Posted September 13, 2011 Posted September 13, 2011 the solution is my autoteam downlaod it from here : https://community.multitheftauto.com/ind ... ls&id=2833 Tnx . . . Default and clans work. Cadu12 the function for blips color is very good. . .but work only for one map on next map all blips white. @Huntone_
Cadu12 Posted September 13, 2011 Author Posted September 13, 2011 Hunterix: Copy my code again, fixed bugged it Ingame nick: Cadu12
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