Mobius1 / esx_xp

XP Ranking System for FiveM
45 stars 23 forks source link

XP Bar / Leaderboard not opening pressing (Z) #12

Open kamuzaki opened 3 years ago

kamuzaki commented 3 years ago

Hi there, Really good job you've done and thanks.. I just download your resource, install it and when i press Z to open the XP bar doesn't open and printing this error in server console, any ideas/help? https://prntscr.com/v7gngm

Mobius1 commented 3 years ago

Check to see if the users table has the license column.

kamuzaki commented 3 years ago

Hi, thanks for your response No it doesn't.. FiveM License is under Identifier column.. I'm using es_extended V1 final.. Do I have to create a column named license? Does you script auto generate licences and store them in DB under license column?

Mobius1 commented 3 years ago

Download the latest version from here. I've added a check to see if the license column exists, if it doesn't, it uses the identifier instead.

kamuzaki commented 3 years ago

You're a legend! Thank you.. I'll give it a go when I go home at work atm.. I'll let you know if its all OK around 7:00 UK time..

kamuzaki commented 3 years ago

hi, it did fix the problem (i van open the bar with Z) but not showing online players https://prnt.sc/v86iqh

kamuzaki commented 3 years ago

Hi mate can you plz tell why doesn't showing online players in leaderboard?

SwAtRaNgEr commented 3 years ago

still doesnt worek

kamuzaki commented 3 years ago

still doesnt worek

Hi is this a question? For me? If so, yes still doesn't work. Still showing 0 online players..

ScaredDonut commented 3 years ago

Download the latest version from here. I've added a check to see if the license column exists, if it doesn't, it uses the identifier instead.

Doesn't appear to work for servers with multi-char systems that do not modify the identifier. For example Kashchars modifies the identifier each time a player joins and selects their char.

There are some scripts that keep them static but have an additional integer example: 1:steam:XXX, 2:steam:XXX and it stays like that even if a person selects their character.

ScaredDonut commented 3 years ago

Managed to "half" fix it so far. No errors and the ID's match according to my little debug, but "Z" is not triggering (doesn't show leaderboard or your level) and the /EXSP command does not return correct values.

`ESX = nil

TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

-- Get Identifier function GetPlayerLicense(id) xPlayer = ESX.GetPlayerFromId(id)

if xPlayer and xPlayer ~= nil then
    return xPlayer.identifier
end

return false

end

function GetOnlinePlayers(_source, players) local Active = {}

for _, playerId in ipairs(GetPlayers()) do
    local name = GetPlayerName(playerId)
    local license = GetPlayerLicense(playerId)

    for k, v in pairs(players) do
        print(v.identifier .. "/" .. license)
        print()
        if license == v.license or license == v.identifier then

            local Player = {
                name = name,
                id = playerId,
                xp = v.rp_xp,
                rank = v.rp_rank
            }

            -- Current player
            if GetPlayerLicense(_source) == license then
                Player.current = true
            end

            if Config.Leaderboard.ShowPing then
                Player.ping = GetPlayerPing(playerId)
            end

            table.insert(Active, Player)
            break
        end
    end
end
return Active 

end`

This is what the debug returns: [ script:esx_xp] 1:steam:11000010495713d/1:steam:11000010495713d

Anyone got any other ideas? I am out of them right now.

Edit: That fixed it, just restart your server