vXHazE Posted November 11, 2015 Share Posted November 11, 2015 Hey guys i im making teams on my server and ive managed to find a script where it saves the teams but how to save the players that are in the teams because when i put myself into the admin team and the reconnect to the server im no longer in that team can anyone help or maybe know a good script? Link to comment
Tekken Posted November 11, 2015 Share Posted November 11, 2015 You will need: dbConnect dbExec dbQuery dbPoll dbFree Link to comment
SpecT Posted November 11, 2015 Share Posted November 11, 2015 Yeah if you know how to work with SQL/MySQL/XML you could make one. Or use this resource: https://community.multitheftauto.com/index.php?p=resources&s=details&id=11325 The team settings are in the xml file. Also you can choose between 2 methods of detection - by ACL group or by TAG. Good luck! Link to comment
vXHazE Posted November 11, 2015 Author Share Posted November 11, 2015 Cheers for the reply guys but how do I use the script do I have to add teams on there or do i just add them through the admin panel? Link to comment
SpecT Posted November 11, 2015 Share Posted November 11, 2015 Cheers for the reply guys but how do I use the script do I have to add teams on there or do i just add them through the admin panel? Copy one of the lines with team details (xml file) and paste it on a new line and edit the team details. Link to comment
zRodrigoMM Posted June 24, 2020 Share Posted June 24, 2020 (edited) On 11/11/2015 at 7:10 PM, SpecT said: Copy one of the lines with team details (xml file) and paste it on a new line and edit the team details. how i add team on xml file sr ? Edited June 24, 2020 by zRodrigoMM Link to comment
nxFairlywell Posted June 25, 2020 Share Posted June 25, 2020 (edited) 11 hours ago, zRodrigoMM said: how i add team on xml file sr ? There are some ways, but i use this : function AddTeamToXML(...) local xmlNode = xmlLoadFile("Teams.xml"); if not xmlNode then xmlNode = xmlCreateFile("Teams.xml","Teams"); end local valuesNumber = 0; while xmlFindChild(xmlNode,"Team",valuesNumber) do valuesNumber=valuesNumber+1; end local newNode = xmlCreateChild(xmlNode,"Team"); local foundNode = xmlFindChild(xmlNode,"Team",valuesNumber); local boolean; if xmlNodeGetAttribute(foundNode,"name")~= arg[1] then xmlNodeSetAttribute(foundNode,"name",arg[1]); xmlNodeSetAttribute(foundNode,"color",arg[2]); boolean=true; else boolean=false; end xmlSaveFile(xmlNode); xmlUnloadFile(xmlNode); return boolean end AddTeamToXML("Team1","0,0,0"); AddTeamToXML("Team2","255,0,0"); AddTeamToXML("Team3","0,255,0"); AddTeamToXML("Team4","0,0,255"); function GetTeamDetails(TeamName) local xmlNode = xmlLoadFile("Teams.xml"); local TeamDetails = {}; local counter = 0; while xmlFindChild(xmlNode,"Team",counter) do local xml = xmlFindChild(xmlNode,"Team",counter); local name = xmlNodeGetAttribute(xml,"name"); if name == TeamName then local info = xmlNodeGetAttributes(xml) for key,value in pairs(info) do TeamDetails[key] = value; end return TeamDetails; end counter = counter+1; end if #TeamDetails < 1 then TeamDetails = nil; return false; end end for k, v in pairs (GetTeamDetails("Team3")) do print(v); end Edited June 25, 2020 by VenomNX 1 Link to comment
zRodrigoMM Posted June 25, 2020 Share Posted June 25, 2020 7 hours ago, VenomNX said: There are some ways, but i use this : function AddTeamToXML(...) local xmlNode = xmlLoadFile("Teams.xml"); if not xmlNode then xmlNode = xmlCreateFile("Teams.xml","Teams"); end local valuesNumber = 0; while xmlFindChild(xmlNode,"Team",valuesNumber) do valuesNumber=valuesNumber+1; end local newNode = xmlCreateChild(xmlNode,"Team"); local foundNode = xmlFindChild(xmlNode,"Team",valuesNumber); local boolean; if xmlNodeGetAttribute(foundNode,"name")~= arg[1] then xmlNodeSetAttribute(foundNode,"name",arg[1]); xmlNodeSetAttribute(foundNode,"color",arg[2]); boolean=true; else boolean=false; end xmlSaveFile(xmlNode); xmlUnloadFile(xmlNode); return boolean end AddTeamToXML("Team1","0,0,0"); AddTeamToXML("Team2","255,0,0"); AddTeamToXML("Team3","0,255,0"); AddTeamToXML("Team4","0,0,255"); function GetTeamDetails(TeamName) local xmlNode = xmlLoadFile("Teams.xml"); local TeamDetails = {}; local counter = 0; while xmlFindChild(xmlNode,"Team",counter) do local xml = xmlFindChild(xmlNode,"Team",counter); local name = xmlNodeGetAttribute(xml,"name"); if name == TeamName then local info = xmlNodeGetAttributes(xml) for key,value in pairs(info) do TeamDetails[key] = value; end return TeamDetails; end counter = counter+1; end if #TeamDetails < 1 then TeamDetails = nil; return false; end end for k, v in pairs (GetTeamDetails("Team3")) do print(v); end I'm trying with this script posted earlier, but I can't create the teams. Config.xml empty: <teams></teams> Link to comment
nxFairlywell Posted June 25, 2020 Share Posted June 25, 2020 How did you know Config.xml is empty or not? I written the code and the file will never be visible for players in 'mods' folder Link to comment
zRodrigoMM Posted June 26, 2020 Share Posted June 26, 2020 23 hours ago, VenomNX said: Como você sabia que o Config.xml está vazio ou não? Escrevi o código e o arquivo nunca estará visível para os jogadores na pasta 'mods' No your sc bro, this https://community.multitheftauto.com/index.php?p=resources&s=details&id=11325 Link to comment
SpecT Posted July 15, 2020 Share Posted July 15, 2020 (edited) @zRodrigoMM I'm sorry ~5 years ago I gave bad resource as example to use And still maybe late reply but still could be useful for someone. Here is a better autoteams resource: https://community.multitheftauto.com/index.php?p=resources&s=details&id=612 There are instructions in the config.xml file. Good luck! Edited July 15, 2020 by SpecT 1 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