Jump to content

Exporting a Function


PashaBiceps

Recommended Posts

Hello, im trying to export a funcion to another resource using:

exports["portaomecanico"]:Portao1()

 
	<script src="Portao.lua" type="shared" />
	<export function="Portao1" type="shared" />
	<export function="Portao2" type="shared" />

My objective is clicking on the keys from inventory to open the gate, but is not opening. Im trying to use the first funcion that is that open the gate. I already tried to put create and moving object directly in the key but he is always open the gate and creating a new one. If someone can help me, i aprecciate.❤️ 

   Frente = createObject ( 9625, 2325.1000976563, -1912.8399658203, 15.560000419617, 0, 0, 0 )

function Portao1(thePlayer)
	    for _, group in ipairs ({"Mecanico"}) do
		if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group )) then 
			moveObject (Frente, 2000, 2325.1000976563, -1912.8399658203, 21.290000915527 )
		end
	end
end

function Portao2(thePlayer)
	    for _, group in ipairs ({"Mecanico"}) do
		if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group )) then 
			moveObject (Frente, 2000, 2325.1000976563, -1912.8399658203, 15.560000419617 )
		end
	end
end
Link to comment
  • Moderators

You have to pass the player's element when you call Portao1() function.
And you can use this only on server side, because isObjectInACLGroup is a server sided function.

-- SERVER
-- example

addCommandHandler("opengate", function(player)
    exports["portaomecanico"]:Portao1(player)
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...