2Roses
1
Hello, I have a problem with fetching the information instead of registering a Steam ID. The license is registered. I want anyone who enters the server to bring me a Steam ID in the Identifier.
Hi @2Roses,
Add the following into your server-sided function that deals with a player when they first connect:
local player = source
local steamIdentifier
local identifiers = GetPlayerIdentifiers(player)
for _, v in pairs(identifiers) do
if string.find(v, "steam") then
steamIdentifier = v
break
end
end
if not steamIdentifier then
-- Do something if player connects without Steam identifier present
end
MySQL.Async.fetchAll("SELECT * FROM CHANGEME WHERE identifier = @id", -- Replace CHANGEME with your database table
{
['@id'] = steamIdentifier
}, function(result)
if result[1] then
-- Do something with the player's data as it has been found in the database
-- For example, to access job information, its: result[1].job
else
-- Do something if player's data is not found in your database
end
end)
1 Like