PainedPsyche / cui_character

An advanced character and clothes editor for esx framework that aims to be comfortable to use, hide complexity and blend in with original GTA V interface elements.
73 stars 47 forks source link

Registration loop #6

Closed Pablo-Barros closed 3 years ago

Pablo-Barros commented 3 years ago

Hello! I have the esx_identity integration enabled. When I create a character all the data is saved on the DB but when I relog in the server the registration menu starts again and the only thing I can see is this: All data is autocompleted (name, height, clothes,etc) except from date of birth. image

I followed the steps written on config.lua

fx_version 'cerulean'
games { 'gta5' }

client_scripts {
    '@es_extended/locale.lua',
    'shared/config.lua',
    'locales/en.lua',
    'client/camera.lua',
    'client/main.lua'
}

server_scripts {
    '@mysql-async/lib/MySQL.lua',
    'shared/config.lua',
    '@esx_identity/server/main.lua',
    'server/main.lua'
}

ui_page('ui/index.html')

files {
    'ui/index.html',
    'ui/script.js',
    'ui/style.css',
    'ui/assets/fonts/chaletlondon1960.woff2',
    'ui/assets/icons/apparel.svg',
    'ui/assets/icons/body.svg',
    'ui/assets/icons/check.svg',
    'ui/assets/icons/features.svg',
    'ui/assets/icons/head.svg',
    'ui/assets/icons/identity.svg',
    'ui/assets/icons/legs.svg',
    'ui/assets/icons/style.svg',
    'ui/assets/icons/symbol-female.svg',
    'ui/assets/icons/symbol-male.svg',
    'ui/pages/apparel.html',
    'ui/pages/features.html',
    'ui/pages/identity.html',
    'ui/pages/style.html',
    'ui/pages/optional/blusher.html',
    'ui/pages/optional/chesthair.html',
    'ui/pages/optional/esxidentity.html',
    'ui/pages/optional/facialhair.html',
    'ui/pages/optional/hair_female.html',
    'ui/pages/optional/hair_male.html',
    'ui/pages/optional/makeup_eye.html',
    'ui/pages/optional/makeup_facepaint.html',
}

dependencies {
    'es_extended'
}

exports {
    'IsPlayerFullyLoaded'
}

this is the fxmanifest

ESX = nil
local loadingScreenFinished = false

Citizen.CreateThread(function()
    while ESX == nil do
        TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
        Citizen.Wait(0)
    end
end)

RegisterNetEvent('esx_identity:alreadyRegistered')
AddEventHandler('esx_identity:alreadyRegistered', function()
    while not loadingScreenFinished do
        Citizen.Wait(100)
    end

    TriggerEvent('cui_character:playerRegistered')
end)

AddEventHandler('esx:loadingScreenOff', function()
    loadingScreenFinished = true
end)

if not Config.UseDeferrals then
    local guiEnabled, isDead = false, false

    AddEventHandler('esx:onPlayerDeath', function(data)
        isDead = true
    end)

    AddEventHandler('esx:onPlayerSpawn', function(spawn)
        isDead = false
    end)

    function EnableGui(state)
        SetNuiFocus(state, state)
        guiEnabled = state

        SendNUIMessage({
            type = "enableui",
            enable = state
        })
    end

    RegisterNetEvent('esx_identity:showRegisterIdentity')
    AddEventHandler('esx_identity:showRegisterIdentity', function()
        TriggerEvent('cui_character:resetFirstSpawn')

        if not isDead then
            TriggerEvent('cui_character:open', { 'identity', 'features', 'style', 'apparel' }, false)
        end
    end)

    RegisterNUICallback('register', function(data, cb)
        ESX.TriggerServerCallback('cui_character:updateIdentity', function(callback)
            if callback then
                ESX.ShowNotification(_U('thank_you_for_registering'))
                TriggerEvent('cui_character:setCurrentIdentity', data)
                TriggerEvent('cui_character:close', true)
            else
                ESX.ShowNotification(_U('registration_error'))
            end
        end, data)
    end)

    Citizen.CreateThread(function()
        while true do
            Citizen.Wait(0)

            if guiEnabled then
                DisableControlAction(0, 1,   true) -- LookLeftRight
                DisableControlAction(0, 2,   true) -- LookUpDown
                DisableControlAction(0, 106, true) -- VehicleMouseControlOverride
                DisableControlAction(0, 142, true) -- MeleeAttackAlternate
                DisableControlAction(0, 30,  true) -- MoveLeftRight
                DisableControlAction(0, 31,  true) -- MoveUpDown
                DisableControlAction(0, 21,  true) -- disable sprint
                DisableControlAction(0, 24,  true) -- disable attack
                DisableControlAction(0, 25,  true) -- disable aim
                DisableControlAction(0, 47,  true) -- disable weapon
                DisableControlAction(0, 58,  true) -- disable weapon
                DisableControlAction(0, 263, true) -- disable melee
                DisableControlAction(0, 264, true) -- disable melee
                DisableControlAction(0, 257, true) -- disable melee
                DisableControlAction(0, 140, true) -- disable melee
                DisableControlAction(0, 141, true) -- disable melee
                DisableControlAction(0, 143, true) -- disable melee
                DisableControlAction(0, 75,  true) -- disable exit vehicle
                DisableControlAction(27, 75, true) -- disable exit vehicle
            else
                Citizen.Wait(500)
            end
        end
    end)
end

and this is esx_identity/client/main.lua

PainedPsyche commented 3 years ago

It looks like you edited everything correctly.

I can't reproduce this problem. For me all the fields are autocompleted including the date and the creator does not open unless I delete the character from the db.

My best guess would be that either you have some other resource that triggers:

esx_identity:showRegisterIdentity

Or your config for valid date range differs in esx_identntiy's config.lua and cui_character's config.lua and the date you entered is valid for cui_character's config and invalid for esx_identnty's config.

Pablo-Barros commented 3 years ago

I reinstalled esx_identity and it worked fine. Thanks!

always91 commented 3 years ago

i have same problem