Jump to content

Please re-compile at luac.mtasa.com HELP.


flowz

Recommended Posts

  
-- Server side 
  
Resources = { 
"script3", -- resource name 
"script2", -- resource name 
"script1", -- resource name 
  
} 
Working = false 
Current = 1 
loading = false 
function forceLoad() 
    if Resources[Current]  then 
    outputDebugString("[Compiler] "..Resources[Current], 0,55,167,220) 
            local xmlPatch = ":"..Resources[Current].."/meta.xml" 
            local xmlFile = xmlLoadFile(xmlPatch) 
            if xmlFile then                          
                            --Map Scripts 
                            local index = 0 
                            local scriptNode = xmlFindChild(xmlFile,'script',index) 
                            if scriptNode then 
                                repeat 
                                    local scriptPath = xmlNodeGetAttribute(scriptNode,'src') or false 
                                    local scriptType = xmlNodeGetAttribute(scriptNode,'type') or "server" 
                                    if scriptPath and scriptType:lower() == "client" then 
                                        if string.find(scriptPath:lower(), "luac") then 
                                            outputDebugString("COMPILER SYSTEM: File "..scriptPath.." is already compiled",3,220,20,20) 
                                        else 
                                            local FROM=":"..Resources[Current].."/"..scriptPath 
                                            local TO= ":"..Resources[Current].."/"..scriptPath.."c" 
                                              fetchRemote( "https://luac.multitheftauto.com/?compile=1&debug=0&blockdecompile=0&encrypt=0", function(data) fileSave(TO,data) end, fileLoad(FROM), true ) 
                                              xmlNodeSetAttribute(scriptNode,'src',scriptPath..'c') 
                                              outputDebugString("COMPILER SYSTEM: ".. TO.." Compiled and Saved successfully",3,0,255,0) 
                                        end 
                                    end 
                                    index = index + 1 
                                    scriptNode = xmlFindChild(xmlFile,'script',index) 
                                until not scriptNode 
                            end 
                            xmlSaveFile(xmlFile) 
                            xmlUnloadFile(xmlFile) 
            else 
                outputDebugString("COMPILER SYSTEM: Cant read xmlFile: meta.xml",3,220,20,20) 
                return false 
            end 
    --startResource(getResourceFromName(Resources[Current])) 
    end 
     
    Current = Current + 1 
    setTimer(forceLoad, 1000,1) 
end 
addCommandHandler ( "compileall", forceLoad ) 
  
function fileLoad(path) 
    local File = fileOpen(path, true) 
    if File then 
        local data = fileRead(File, 500000000) 
        fileClose(File) 
        return data 
    end 
end 
  
function fileSave(path, data) 
    local File = fileCreate(path) 
    if File then 
        fileWrite(File, data) 
        fileClose(File) 
    end 
end 
  

Link to comment
  • 6 months later...

seems that not working

  
-- Server side 
  
Resources = { 
"script3", -- resource name 
"script2", -- resource name 
"script1", -- resource name 
  
} 
Working = false 
Current = 1 
loading = false 
function forceLoad() 
    if Resources[Current]  then 
    outputDebugString("[Compiler] "..Resources[Current], 0,55,167,220) 
            local xmlPatch = ":"..Resources[Current].."/meta.xml" 
            local xmlFile = xmlLoadFile(xmlPatch) 
            if xmlFile then                         
                            --Map Scripts 
                            local index = 0 
                            local scriptNode = xmlFindChild(xmlFile,'script',index) 
                            if scriptNode then 
                                repeat 
                                    local scriptPath = xmlNodeGetAttribute(scriptNode,'src') or false 
                                    local scriptType = xmlNodeGetAttribute(scriptNode,'type') or "server" 
                                    if scriptPath and scriptType:lower() == "client" then 
                                        if string.find(scriptPath:lower(), "luac") then 
                                            outputDebugString("COMPILER SYSTEM: File "..scriptPath.." is already compiled",3,220,20,20) 
                                        else 
                                            local FROM=":"..Resources[Current].."/"..scriptPath 
                                            local TO= ":"..Resources[Current].."/"..scriptPath.."c" 
                                              fetchRemote( "https://luac.multitheftauto.com/?compile=1&debug=0&blockdecompile=0&encrypt=0", function(data) fileSave(TO,data) end, fileLoad(FROM), true ) 
                                              xmlNodeSetAttribute(scriptNode,'src',scriptPath..'c') 
                                              outputDebugString("COMPILER SYSTEM: ".. TO.." Compiled and Saved successfully",3,0,255,0) 
                                        end 
                                    end 
                                    index = index + 1 
                                    scriptNode = xmlFindChild(xmlFile,'script',index) 
                                until not scriptNode 
                            end 
                            xmlSaveFile(xmlFile) 
                            xmlUnloadFile(xmlFile) 
            else 
                outputDebugString("COMPILER SYSTEM: Cant read xmlFile: meta.xml",3,220,20,20) 
                return false 
            end 
    --startResource(getResourceFromName(Resources[Current])) 
    end 
    
    Current = Current + 1 
    setTimer(forceLoad, 1000,1) 
end 
addCommandHandler ( "compileall", forceLoad ) 
  
function fileLoad(path) 
    local File = fileOpen(path, true) 
    if File then 
        local data = fileRead(File, 500000000) 
        fileClose(File) 
        return data 
    end 
end 
  
function fileSave(path, data) 
    local File = fileCreate(path) 
    if File then 
        fileWrite(File, data) 
        fileClose(File) 
    end 
end 
  

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...