Jump to content

help save time


Recommended Posts

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 by #x1AhMeD-09
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...