Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Remark: Since, my themes on the official site of the MTA have been deleted, I am writing here.
- -- Theme: Removing protection from any compiled Lua script
- -- Introduction: Method concluding is to re-create the MTA-API functions, but with your answer, which is necessary for you. After testing such interceptions, I wondered if it was possible to defend against this. As it turned out, this is simply not possible.
- -- Example code and protect by server name:
- -- This Code on your server file and write in meta.xml above protected script
- -- Example:
- -- <meta>
- -- <script src="hook.lua" type="server"/>
- -- <script src="server.lua" type="server"/>
- -- </meta>
- -- in hook.lua:
- function getServerName()
- return "server name on protected script" -- Example: "Big World RPG"
- end
- -- Remark: You can save the original function in this way:
- local _getServerName = getServerName; -- saved original function
- outputDebugString("server name: "..tostring(_getServerName)) -- get original server name, easy :)
- -- Example code and protect by ip/port, strong hook:
- local _getServerConfigSetting = getServerConfigSetting; -- save original function
- function getServerConfigSetting(name) -- Completely working function and does not break the receipt of other data
- if name == "serverip" then
- return "ip on protected script"
- elseif name == "serverport" then
- return "port on protected script"
- end
- return _getServerConfigSetting(name)
- end
- function getServerPort()
- return 22003
- end
- -- Remark: Important save returning type values! (if function return STRING then "value" or function return INT then 123456)
- -- Author: XaskeL (Vladimir K.) vk.com/ixaskel
- -- Thank you for attention!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement