Jump to content

[HELP] meta.xml


Recommended Posts

Hello everybody!

A friend of mine told me of existing another kind of protection related to meta.xml file.

Basic job of this protection is based on author="turbodymacz" attribute.. using a lua code that detects if author is turbodymacz, if author field contains my name then script is starting normally, but if somebody tries to steal my script and trying to change the author to his name then script doesn't start.

Can somebody at least explain me what functions/events should I use to form such script, or at least write the code if that's possible & faster.

Link to comment
  • Scripting Moderators
20 minutes ago, turbodymacz1337 said:

Hello everybody!

A friend of mine told me of existing another kind of protection related to meta.xml file.

Basic job of this protection is based on author="turbodymacz" attribute.. using a lua code that detects if author is turbodymacz, if author field contains my name then script is starting normally, but if somebody tries to steal my script and trying to change the author to his name then script doesn't start.

Can somebody at least explain me what functions/events should I use to form such script, or at least write the code if that's possible & faster.

-- meta.xml

<meta>
	<info author="srslyyyyy" version="1.0" name="Test" type="script"/>
	<script src="test.lua" type="server"/>
</meta>

 

local allowedAuthor = {["srslyyyy"] = true}

function testFunction()
	local author = getResourceInfo(getThisResource(), "author")
	local allowed_author = allowedAuthor[author]
	if allowed_author then
		outputDebugString("Everything okey.")
	else
		outputDebugString("Failed to load script.")
		cancelEvent()
	end
end
addEventHandler("onResourceStart", resourceRoot, testFunction)

 

Check, should work, this is for server side, but i think you could do the same on client-side, with OnClientResourceStart.

ps: fajny nick :D

  • Like 1
  • Thanks 1
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...