Jump to content

exports


Zcraks

Recommended Posts

Hi, i have ERROR. " attempt to call global 'source' (a userdata value). "

function giveXP ( player, xp)
	givePlayerXP (player, xp)
end
function jobMMM()
		
		exports [ "lvlsyt" ]:givePlayerXP (source(getRootElement()), 10)  
	
end
end
addEventHandler("onPlayerMarkerHit",root,jobMMM)

 

Link to comment
  • Moderators

@Zcraks

You can't call an element like you would do with a function.
 

function functionName () -- a function

end

functionName() -- calling the function

 

 

 

So:

 

              exports [ "lvlsyt" ]:givePlayerXP (source  (getRootElement()) , 10)

 

Link to comment
25 minutes ago, IIYAMA said:

@Zcraks

You can't call an element like you would do with a function.
 


function functionName () -- a function

end

functionName() -- calling the function

 

 

 

So:

 

              exports [ "lvlsyt" ]:givePlayerXP (source  (getRootElement()) , 10)

 

call: failed to call: givePlayerXP[string "?"]
call: failed to call: giveXP[string "?"]

Link to comment
1 hour ago, IIYAMA said:

is it set as export function?

Resource "Job" - get XP on marker hit and export to "lvlsyt"

server.lua

	exports [ "lvlsyt" ]:givePlayerXP (source, 200)

Resource "lvlsyt" - give XP to player

server.lua

function giveXP ( player, xp)
	givePlayerXP (player, xp)
end


meta.xml 

 

     <export function="giveXP" type="server"/>

 

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