I am rewriting ESX so it can work without Steam. Only with FiveM licenses. I had no problem to create new character, save it into DB, buy a car, take it out from the garage. Everything works so far as it should.
But.
My friend connected with Steam running in the background and suddenly, few errors showed up in server console. I’ve tracked down the problem to GetPlayerIdentifiers() native (and hold on, I’ve find out only singular “GetPlayerIdentifier” in natives for FiveM, so is the plural “GetPlayerIdentifiers()” some ESX thing?
Again, I am sorry for these expressions, but English is my second language and I don’t have previous programmer background.
Any thoughts? Ideas how to tell the client to pass only FiveM license?
Well, it didn’t really work, @zee. I am getting errors and not sure what am I doing wrong here. I am probably tired already… Could you help me with this, please?
AddEventHandler('chatMessage', function(s, n, m)
local license = nil
local _source = source
local message = string.lower(m)
local license = GetPlayerIdentifier(_source, 2)
if message == "/test" then
print(license)
end
end)
Why are you listening for chatMessage for commands? Use RegisterCommand(). chatMessage has been deprecated for a long time.
Another thing, the reasoning behind iterating through GetPlayerIdentifiers() was that the index is not static and can change between players. So you need to iterate to find a specific part of the string (identifier), and then use that identifier.
RegisterCommand("test", function(source, args, raw)
local license
for k, v in ipairs(GetPlayerIdentifiers(source)) do
if string.match(v, "license:") then
license = v
break
end
end
print(license)
end, false)