Jump to content

getAccountID (stack overflow)


-Note

Recommended Posts

I tried using this exports but it won't work

 

function getPlayerAccountID (player)
    local thePlayer = player or localPlayer
	if ( isElement(thePlayer)) then
	    local ac = getPlayerAccount(thePlayer)
		local userID = getAccountID(ac)
		if (userID) then
			return tonumber(userID)
		else
			return false
		end
	else
		return false
	end
end

 

I tried executing this exports in-game by using run code "srun exports.ServerExports: getPlayerAccountID(p)"  and it doesn't work with error "stack overflow" & "tail call"

ps: firstly I executed this before executing the command above "srun p = getPlayerFromName("Note")"

pss: I tried using "srun getAccountID(getPlayerAccount(p))" and it works but the exports won't. 


psss: I also tried using this in run code

"srun local ac = getPlayerAccount(p)"

"srun getAccountID(ac)"

and it works too!! I don't know why my exports won't.

Edited by -Note
Link to comment
31 minutes ago, #\_oskar_/# said:

Did you add this in the meta file?


<export function="getPlayerAccountID" />

 

 

Just now, Soapbosnia said:

Why are you using localPlayer server-side?

I use this on meta so I can call it by server or client

<export function="getPlayerAccountID" type="client" />
<export function="getPlayerAccountID" type="server" />

 

Link to comment
5 hours ago, -Note said:

 

I use this on meta so I can call it by server or client


<export function="getPlayerAccountID" type="client" /><export function="getPlayerAccountID" type="server" />

 

client side scripts can only call client side exported functions, same goes for server side.

Solution: use events for the client side version of getAccountID

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