vXHazE Posted April 12, 2014 Share Posted April 12, 2014 Hi my question is how can you save your teams because when when I make a team and restart the server and join the teams disappear I looked at some scripts but I don't know how they work can anyone help me? :D :D Link to comment
Castillo Posted April 12, 2014 Share Posted April 12, 2014 You could make a script to create the teams, instead of using the admin panel. Link to comment
vXHazE Posted April 12, 2014 Author Share Posted April 12, 2014 Could you recommend a good script maybe? Link to comment
Castillo Posted April 12, 2014 Share Posted April 12, 2014 Creating teams is a easy thing: createTeam ( "My Team", 255, 0, 0 ) That creates a team with the name "My Team" and red color. Link to comment
vXHazE Posted April 12, 2014 Author Share Posted April 12, 2014 Cheers where do you have to write this and how do you write in red sos im a noob Link to comment
Castillo Posted April 12, 2014 Share Posted April 12, 2014 Read this: https://wiki.multitheftauto.com/wiki/Resources Link to comment
vXHazE Posted April 13, 2014 Author Share Posted April 13, 2014 I dont get any of this Link to comment
Noki Posted April 14, 2014 Share Posted April 14, 2014 Alright. Go to server > mods > deathmatch > resources. In there, create a new folder called 'teams'. Go into that folder and create a file called script.lua. Paste this code into it, then save it: createTeam("Team name", 200, 50, 0) --Those are the RGB colours. Create another file called meta.xml. Paste this into it, then save it (in the same folder): <meta> <script src="script.lua" type="server"/> </meta> Now, when you start your server, you should have a resource called 'teams'. Write /start teams into the chatbox, and watch your resource start. Link to comment
Toffbrown Posted April 14, 2014 Share Posted April 14, 2014 function team () createTeam ( "nameofteamyouwanthere", 255, 0, 0 ) end addEventHandler("onResourceStart", resourceRoot, team) its a pretty easy script banged it together in a minute Just add it to the default startup Link to comment
vXHazE Posted April 14, 2014 Author Share Posted April 14, 2014 nokizorque cheers for replying but ive tried everything and for some reasons this doesn't work Link to comment
Toffbrown Posted April 14, 2014 Share Posted April 14, 2014 what exactly did you try?, did you try mine and also post your code Link to comment
Noki Posted April 14, 2014 Share Posted April 14, 2014 Make sure the resource is on your start list, as ToffBrown said. Link to comment
vXHazE Posted April 14, 2014 Author Share Posted April 14, 2014 i made a folder called teams then I made the the notepad called script.lua and put in what you told me to i changed the color and the name of the team then i made a notepad called meta.xml and copied and pasted the stuff you told me to than I went to mtaserver and at the bottom I added it to the start up thing and it doesn't work for some reason also toffbrown i'am not sure how to make the script you sent me sorry for my noobizm Link to comment
Toffbrown Posted April 14, 2014 Share Posted April 14, 2014 https://community.multitheftauto.com/index.php?p=resources&s=details&id=9064 Here i uploaded it and don't fret we are always learning, now function team () ----- this is the start of your function createTeam ( "vXHazE", 255, 0, 0 )--- this is the function that happends the " " is the team name in tab and 255, 0, 0 is the RGB color coding so RGB = Red,Green,Blue and you said red so the colour will be 255 end------ this ends the function addEventHandler("onResourceStart", resourceRoot, team)---- this is what causes the function do execute the functions basically so onResourceStart runs the function when this resource starts EDIT idk why but my Lua isnt working on here Link to comment
GamingTim Posted April 14, 2014 Share Posted April 14, 2014 i made a folder called teams then I made the the notepad called script.lua and put in what you told me to i changed the color and the name of the team then i made a notepad called meta.xml and copied and pasted the stuff you told me to than I went to mtaserver and at the bottom I added it to the start up thing and it doesn't work for some reason also toffbrown i'am not sure how to make the script you sent me sorry for my noobizm First, make a folder and name it whatever you want then do the following 1.)create a text file in the folder, open it, save as a .lua file in the folder you created.Name your lua file when saving, exmaple team.lua but i'd suggest server.lua 2.)create a text file, save it as meta.xml. Make sure it's meta.xml. 3.)Then open your .lua file and enter the following - function aTeam () Admin = createTeam ( "Admins", 255,255,255 ) end addEventHandler("onResourceStart", resourceRoot, aTeam) Change the "Admins" to any Team name that you want and change the 255,255,255 to change the team color. 4.)enter your .xml and type in the following <meta> <info author="YourName" type="script" description="Your description" /> <script src="server.lua" /> </meta> 5.)Make sure you saved' both files 6.)Copy the folder you created for the script and paste it here -->mods/deathmatch/resources/gameplay and paste it there. 7.)Turn on your server and enable the script. I'm a new scripter as well, just trying to help, it's how i do scripts, steps might be long but it should work hopefully, good luck!. Link to comment
Toffbrown Posted April 14, 2014 Share Posted April 14, 2014 With your script you don't need Admin = createTeam and also 255, 255, 255 is white he wanted red Please follow or use what i posted because what i wrote was correct, also add open up your mtaserver.conf and go all the way down to the bottom and paste or change it to what folder you used for the script Link to comment
vXHazE Posted April 14, 2014 Author Share Posted April 14, 2014 Cheers a lot the teams save but the people that are on the team don't save? Cheers a lot ToffBrown and nokizorque btw :D :D :D :D :D Link to comment
vXHazE Posted April 14, 2014 Author Share Posted April 14, 2014 cheers for a lot of help guys the teams save but the people on the team don't save? BTW cheers once again Link to comment
Toffbrown Posted April 15, 2014 Share Posted April 15, 2014 what do you mean don't save? like when the server restarts or when the play exits the server and reconnect they aren't in it anymore? Link to comment
Vinctus Posted April 15, 2014 Share Posted April 15, 2014 If you are going to have multiple teams, easiest way would probably be: local teams = { -- "team", r, g, b {"Red Team",255,0,0}, {"Blue Team",0,0,255}, } function team () for i,v in ipairs(teams) do createTeam (v[1], v[2], v[3], v[4] ) end end addEventHandler("onResourceStart", resourceRoot, team) Link to comment
Toffbrown Posted April 15, 2014 Share Posted April 15, 2014 Ahh nice way of doing Vinctus but that does confuse alot of new beginners Link to comment
vXHazE Posted April 15, 2014 Author Share Posted April 15, 2014 toffBrown I can add people to the teams and the teams save but when someone leaves and joins they aren't in the team anymore? Link to comment
Toffbrown Posted April 15, 2014 Share Posted April 15, 2014 Add this to the original Script function savTeam() local account = getPlayerAccount(source) local team = getAccountData (account, "team") if (team) and getTeamFromName(team) then setPlayerTeam(source, getTeamFromName( team )) end end addEventHandler("onPlayerLogin",root,savTeam) function update() local team = getPlayerTeam(source) local account = getPlayerAccount(source) if (team) and not isGuestAccount(account) then setAccountData(account, "team", getTeamName( team )) end end addEventHandler("onPlayerQuit", getRootElement(), update) Link to comment
vXHazE Posted April 15, 2014 Author Share Posted April 15, 2014 cheers do i have to edit this and do i add it to autoteam or meta 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