Jump to content

Chuck compile script


WASSIm.

Recommended Posts

hi guys i need help, i make script compile scripts on resources but how i an check if script compiled ?

addEventHandler("onResourcePreStart", root, 
function (resource) 
    if (resource == getThisResource()) then return end 
    local resourceName = getResourceName(resource) 
    if (compileres[resource]) then 
        --setResourceInfo(resource, "laststart", date) 
        for i, script in ipairs (getResourceScripts(resource)) do 
            local theScript = fileOpen(":"..resourceName.."/"..script.."", true) 
            if (theScript) then 
                -- HERE 
            end 
        end 
    end 
end) 
  
function getResourceScripts(resource) 
    local scripts = {} 
    local resourceName = getResourceName(resource) 
    local theMeta = xmlLoadFile(":"..resourceName.."/meta.xml") 
    for i, node in ipairs (xmlNodeGetChildren(theMeta)) do 
        if (xmlNodeGetName(node) == "script") then 
            local script = xmlNodeGetAttribute(node, "src") 
            if (script) then 
                table.insert(scripts, script) 
            end 
        end 
    end 
    xmlUnloadFile(theMeta) 
    return scripts 
end 

Edited by Guest
Link to comment
4 bytes Header signature: ESC, “Lua” or 0x1B4C7561

• Binary chunk is recognized by checking for this signature

In other words, you check if the first character of the code has value 0x1B (use string.byte to convert from string to byte value), and then if the three next values are "Lua".

However if the code has also been encrypted, then you need to check for the encrypted byte values instead.

The best way is to just check what 4 byte values are placed at the start of code compiled with luac.mtasa.com, and then also check the values when using encryption option. You can see the byte values if you open the script file with sublime text or just string.byte the value in mta to output it and use those values.

Link to comment
4 bytes Header signature: ESC, “Lua” or 0x1B4C7561

• Binary chunk is recognized by checking for this signature

In other words, you check if the first character of the code has value 0x1B (use string.byte to convert from string to byte value), and then if the three next values are "Lua".

However if the code has also been encrypted, then you need to check for the encrypted byte values instead.

The best way is to just check what 4 byte values are placed at the start of code compiled with luac.mtasa.com, and then also check the values when using encryption option. You can see the byte values if you open the script file with sublime text or just string.byte the value in mta to output it and use those values.

finally that i was answer waiting for, thanks i will try

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