-
Notifications
You must be signed in to change notification settings - Fork 964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add discord to players DB table #1135
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how necessary this is, but if you really want it merged you have to provide a schema update with the PR.
@@ -437,10 +438,11 @@ function QBCore.Player.Save(source) | |||
local pcoords = GetEntityCoords(ped) | |||
local PlayerData = QBCore.Players[source].PlayerData | |||
if PlayerData then | |||
MySQL.insert('INSERT INTO players (citizenid, cid, license, name, money, charinfo, job, gang, position, metadata) VALUES (:citizenid, :cid, :license, :name, :money, :charinfo, :job, :gang, :position, :metadata) ON DUPLICATE KEY UPDATE cid = :cid, name = :name, money = :money, charinfo = :charinfo, job = :job, gang = :gang, position = :position, metadata = :metadata', { | |||
MySQL.insert('INSERT INTO players (citizenid, cid, license, discord, name, money, charinfo, job, gang, position, metadata) VALUES (:citizenid, :cid, :license, :discord, :name, :money, :charinfo, :job, :gang, :position, :metadata) ON DUPLICATE KEY UPDATE cid = :cid, name = :name, money = :money, charinfo = :charinfo, job = :job, gang = :gang, position = :position, metadata = :metadata', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the corresponding Schema update?
server/player.lua
Outdated
@@ -97,6 +97,7 @@ function QBCore.Player.CheckPlayerData(source, PlayerData) | |||
if source then | |||
PlayerData.source = source | |||
PlayerData.license = PlayerData.license or QBCore.Functions.GetIdentifier(source, 'license') | |||
PlayerData.discord = PlayerData.discord or QBCore.Functions.GetIdentifier(source, 'discord'):sub(9) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to add. What if this is nil? calling :sub on a null may cause an issue. Requires testing.
qbcore.sql
Outdated
@@ -3,6 +3,7 @@ CREATE TABLE IF NOT EXISTS `players` ( | |||
`citizenid` varchar(50) NOT NULL, | |||
`cid` int(11) DEFAULT NULL, | |||
`license` varchar(255) NOT NULL, | |||
`discord` varchar(255) NOT NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be null.
Just updated, I dont really know if |
You will be correct if you are talking about old qbcore, now it uses the native: Lines 24 to 27 in e488cbe
|
Maybe add something to the config.lua to turn this on and off |
Update QB-Core
Well, because the SQL file was change, I feel that it shouldn't be optional |
Description
Nowadays most servers using QBCore uses discord whitelist, so the player will have their discord linked to FiveM. To ease integration with webapges I think discord information in main qbcore database table (players) should be kept to easy locate characters linked to a player.
Checklist