How to get player id with fivem license

Hello, how could I get player ID with fivem license?

GetIdentifier(playerId)
	for k, v in ipairs(GetPlayerIdentifiers(playerId)) do
		if string.match(v, "license:") then
			local identifier = string.gsub(v, "license:", "")
			return identifier;
		end
	end
end

function GetServerIdFromIdentifier(identifier)
      local wanted_id = nil

      for k, v in pairs(GetPlayers()) do
              local id = tonumber(v)
              if GetIdentifier(id) == identifier then
                     wanted_id = id
              end
       end

       return wanted_id;
end

With this two functions you can get his server id. Just use GetServerIdFromIdentifier(his identifier)

This doesn’t work. Do I need to change something?
image
image

Oh nvm it works just fine thank you so much.

1 Like

Thanks, can you mark my post as the solution? :grinning:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.