[REQ] How to make a login screen for selecting characters

Hey everyone, thanks for everything you do on here. I’ve made a lot of progress lurking the forums and google… I’m having some issues now.

I’m running ESX and i’ve gotten the spawn manager callback working. So I think I can definitely make this work pretty soon. I’m stumped on the direction I should take for making a login screen when you first login to the server. I want to create the option to make multiple characters.

I know how to setup the database and change all my scripts, but I’m not sure how to start this process. Any help would be much appreciated.

2 Likes

You would need to use FiveM’s in-built NUI system.

You could use some Natives to do so. Also check some decompiled original scripts to see how Rockstar made it.

Yeah. My main issue now is with es_extended and essentialmode it’s looking like… I’m almost there but it won’t let me change characters because of how their internal variables are… Pretty frustrating…

Well… I finally figured it out but I had to recode my own base and get off the essentialmode/es_extended teet…

If anyone needs help here’s a start:

EDIT: Both of these run client side


-- Spawn override + Shut down Loading Screen
AddEventHandler('onClientMapStart', function()
    exports.spawnmanager:setAutoSpawn(true)
    exports.spawnmanager:forceRespawn()

    exports.spawnmanager:setAutoSpawnCallback(function()
        if spawnLock then
            return
        end

        Citizen.CreateThread(ShutdownLoadingScreen)
        TriggerServerEvent("netr:playerSpawn")
    end)
end)


-- Call this after playerSpawn, instantly goes into a NUI welcome page
-- From here you can setup your interface to select chars, create chars, etc.
RegisterNetEvent('netr:spawnPlayer')
AddEventHandler('netr:spawnPlayer', function(x, y, z, model)
    exports.spawnmanager:spawnPlayer({x = x, y = y, z = z, model = GetHashKey(model)})

    if firstTimeSpawned then
      TriggerEvent("netr:openLoadingScreen")
      firstTimeSpawned = false
    end

end)

As for databases… i ended up making a users table as well as a characters table… I use the users table to setup identifiers and licenses… Here you can ban/priority/queue, etc…

After the initial checks and balances, everything else runs off character_id (auto increment for ease) AND identifier instead of only identifier. My setup will be different than most i’m guessing but this is how i’m approaching it…

Good luck

1 Like

What was the issue you were having in spawning your secondary character when using ESX and ES?

1 Like

There were a lot of issues… The way ESX is built, it has a lot of information stored in tables… PlayerData, Spawning Information, Loadouts (were a big problem for me lol), etc…

I’m sure you can figure it out if you spend enough time on it, but it was giving me too much of a headache.

Actually, after building my own base (which i basically combined ESX/ES into one and left out shit I didn’t need), I have more of an understanding of how ESX is built and might be able to do it if I tried again. But eh

1 Like

[quote=“netr, post:5, topic:48625”]
spawnmanager:setAutoSpawn(true) exports.spawnmanager:forceRespawn()
[/quote]=“spawn event-11s”
spawn.evenst: setPistoltoPlayer (function()
if player click e then
giveitem
end