Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fresholia/mtasa-resource-compiler
https://github.com/fresholia/mtasa-resource-compiler
Last synced: 19 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/fresholia/mtasa-resource-compiler
- Owner: fresholia
- License: mit
- Created: 2021-01-16T21:04:14.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-05-13T10:19:19.000Z (over 3 years ago)
- Last Synced: 2024-11-05T16:03:01.468Z (about 1 month ago)
- Language: Lua
- Size: 9.77 KB
- Stars: 4
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-mta-sa - mtasa-resource-compiler - Encrypt all files on your resource. (Libs and utils)
README
# MTA:SA File(s) Compiler
You can encrypt all files on your resource with this module. You can read the documents below and use the module.
### Introduction
The system does not work with export for security reasons. You need to add certain files to your system.
So add the following files to your system.
```js
compiler.lua
classes.lua
```
Don't forget to add the following code above where you will run the module:
```lua
local compiler = load(compiler)
```### Function definitions
*compiler:* set
**USE:**
```lua
compiler:set({
compileExtensions = "png,txd", --valid extensions: png, txd, jpg, jpeg, gif, dff, txd, ipb
key = "", -- your crypt key, If you want it to be different for each resource you can use ( md5(getResourceName(getThisResource)) )
duplicate = true, -- Leave true if you want it to encrypt pictures every resource starts.
saveMetaXML = true, -- Enter whether it saves to meta.xml when encrypted or decrypted (true/false)
restartOnDone = false --Restarting the system when done, absolutely necessary (require acl)
})
```
*compiler:* compile
**USE:**
***Sync use:***
```lua
compiler:compile()
```***Async use:***
```lua
compiler:compile()
.on("complete",
function(self, total)end
)
.on("error",
function(err)
end
)
```
*compiler:* decrypt
**USE:**
***Sync use:***
```lua
compiler:decrypt()
```***Async use:***
```lua
compiler:decrypt()
.on("complete",
function(self, total)end
)
.on("error",
function(err)
end
)
```
## Full Example:
```lua
local compiler = load(compiler)compiler:set({
compileExtensions = "png,txd",
key = "aa-q3",
duplicate = true,
saveMetaXML = true,
restartOnDone = false
})addCommandHandler("compile",
function()
compiler:compile()
.on("complete",
function(self, total)
end
)
.on("error",
function(err)
print("ERR: "..err)
end
)
end
)
addCommandHandler("decrypt",
function()
compiler:decrypt()
.on("complete",
function(self, total)
end
)
.on("error",
function(err)
print("ERR: "..err)
end
)
end
)
```
### Add this to the top of the client file you encrypted
```lua
local compiler = load(compiler)
loadstring(compiler:loadFunctions())()
```