I am using the esx_dmvschool (https://github.com/ESX-Org/esx_dmvschool).
All my other ESX-modules seem to store the FiveM license as the identifier in my database, but this DMV thing grabs the SteamID instead. And this causes my police cad tool to not find the licenses for my players.
Looking into the code, I can see that it uses this,
RegisterNetEvent('esx_dmvschool:addLicense')
AddEventHandler('esx_dmvschool:addLicense', function(type)
local _source = source
TriggerEvent('esx_license:addLicense', _source, type, function()
TriggerEvent('esx_license:getLicenses', _source, function(licenses)
TriggerClientEvent('esx_dmvschool:loadLicenses', _source, licenses)
end)
end)
end)
How do I change this to grab the Fivem-license number instead oof the SteamID when adding a players license type to the database?
1 Like
I have the same problem have you found a fix for this?
Well, after some research and looking around in scripts, I found out that esx_license uses this snippet to add ID’s to the DB. You can alter the target as you please…there are 7, (0-6), ID’s in total.
Change this from 0 to 1 local identifier = GetPlayerIdentifier(target, 1)
You then change target from 0 to 1, steamID being target 0, FiveM license is 1…and so on down the list.
function AddLicense(target, type, cb)
local identifier = GetPlayerIdentifier(target, 1)
MySQL.Async.execute('INSERT INTO user_licenses (type, owner) VALUES (@type, @owner)', {
['@type'] = type,
['@owner'] = identifier
}, function(rowsChanged)
if cb ~= nil then
cb()
end
end)
end
NOTE: If you want to print out all collected ID’s of a player, use this.
AddEventHandler('playerConnecting', function(playerName, setKickReason)
identifiers = GetPlayerIdentifiers(source)
for i in ipairs(identifiers) do
print('Player: ' .. playerName .. ', Identifier #' .. i .. ': ' .. identifiers[i])
end
end)