Skip to content

Duplicate entry '' for key 'callsign' #24

@ThatMadCap

Description

@ThatMadCap
[       script:ps_lib] SCRIPT ERROR: citizen:/scripting/lua/scheduler.lua:750: SCRIPT ERROR: @ps-mdt-v3/server/functions.lua:145: ps-mdt-v3 was unable to execute a query!
[       script:ps_lib] Query: INSERT INTO mdt_profiles (citizenid, fullname, callsign, notes, profilepicture) VALUES (?,?,?,?,?)
[       script:ps_lib] ["CKO24284","Laura Spikes","","",""]
[       script:ps_lib] Duplicate entry '' for key 'callsign'

I think this derives from:
https://github.com/Project-Sloth/ps-mdt-v3/blob/30540940ee4ea557c5a339ed28e0616102acef65/server/functions.lua#L131-L148

ps.registerCallback('ps-mdt:hasProfile', function(source)
    local src = source
    assert(src, 'Player ID cannot be nil')
    local citizenId = ps.getIdentifier(src)
    if not citizenId then
        ps.warn('No citizen ID found for source: ' .. tostring(src))
        return false
    end


    -- Check if the player has a profile in the MDT
    local hasProfile = MySQL.scalar.await('SELECT COUNT(*) FROM mdt_profiles WHERE citizenid = ?', { citizenId })
    if hasProfile and hasProfile > 0 then
        return true
    else
        MySQL.insert.await('INSERT INTO mdt_profiles (citizenid, fullname, callsign, notes, profilepicture) VALUES (?,?,?,?,?)', 
        { citizenId, ps.getPlayerName(source), "", "", "" })
    end
end)

This occurred when logging out and making a new character (already having another one). It happens every time you load that new character. The MDT profile for that new character does look like it was created though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions