[Solved] Is there a better way to get lic, steam and IP than GetPlayerIdentifiers

I’m currently using this to retrieve name, license, steam and ip when the player connects and discos.

	local identifiers 	= GetPlayerIdentifiers(source)
	local playername 	= GetPlayerName(source)
	local license 		= identifiers[2]
	local steamid 		= identifiers[1]
	local ipaddr  		= identifiers[4]

The issue that I’m having is that it doesn’t always supply the expected info even when it’s the same player(me) connecting. there’s times when not all the variables are populated.

I did a lot of searching and there’s just tons of threads stating that at best, this native doesn’t work well and at worst, is horribly broken. I’ve dug through ban systems but they seem to be using the same thing I am. Is there a better way to get this user info without framework-specific functions or do I just need to get better at using it?

Thanks for your time!

1 Like

Yes. I believe the method I created a method that reads the first part of the identifier and matches it to a type you pass as an argument could be a better solution?

function GetPlayerIdentifierFromType(type, source)
	local identifiers = {}
	local identifierCount = GetNumPlayerIdentifiers(source)

	for a = 0, identifierCount do
		table.insert(identifiers, GetPlayerIdentifier(source, a))
	end

	for b = 1, #identifiers do
		if string.find(identifiers[b], type, 1) then
			return identifiers[b]
		end
	end
	return nil
end

--GetPlayerIdentifierFromType("license", playersource)
3 Likes

That’s a fantastic function, xander. Thanks very much for sharing it!

No problem. Share it all over if you know anyone else having issues. I use it in all my resources that deal with identifiers.

1 Like

Could you please help me?
Where do I put that code?

Its a function. All it does is give you the identifier you request. You should know what to do with it.

… and if you don’t, what were you planning on doing with it? You’d need to have some knowledge of scripting to use the code, to those with no knowledge, it just looks like a bunch of characters.

1 Like

Youre in the wrong forum then.
It’s a scripting forum.