Giovany Mito Posted July 8, 2019 Share Posted July 8, 2019 Hello, I'm having problems with the team, I create a team by the panel and if I restart the server, the team is gone, how do I always save it? Link to comment
HassoN Posted July 8, 2019 Share Posted July 8, 2019 Are you creating it with the admin panel? if so then use a separated code. createTeam Link to comment
SycroX Posted July 8, 2019 Share Posted July 8, 2019 (edited) addEventHandler ( "onResourceStop" , resourceRoot , function ( ) local Teams = "" for _ , Team in pairs ( getElementsByType ( "team" , resourceRoot ) ) do local Color = getTeamColor ( Team ) Teams = Teams == "" and getTeamName ( Team ) ..";".. toJSON ( Color ) or Teams .. "," .. getTeamName ( Team ) .. ";" .. toJSON ( Color ) end local Console = getAccount ( "Console" ) if Console then setAccountData ( Console , "AdminPanel:Teams" , Teams ) end end ) addEventHandler ( "onResourceStart" , resourceRoot , function ( ) local Console = getAccount ( "Console" ) if Console then local TeamTable = split ( getAccountData ( Console , "AdminPanel:Teams" ) , "," ) if TeamTable and #TeamTable > 0 then for _ , Value in ipairs ( TeamTable ) do local TeamName , TeamColor = gettok ( Value , 1 , string.byte ( ";" ) ) , gettok ( Value , 2 , string.byte ( ";" ) ) if TeamName and TeamColor then local Color = fromJSON ( TeamColor ) createTeam ( TeamName , Color[1] , Color[2] , Color[3] ) end end end end end ) try to put this code in admin_server.Lua NOTE * I DIDN'T TEST IT Edited July 8, 2019 by #x1AhMeD-09 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