[RELEASE] [ESX] Multicharacter And Spawnselector

I’m running on esx legacy with linden inventory etc etc.

I’m receiving ZERO errors… but this happens…



Said loading story mode and never gets passed that screen.

Followed your instructions to the letter, I hear the airport and such when I make my character, but I do NOT see anything more than the “Story mode loading” message and background.

Haven’t been able to get passed this yet. I do hear the airport sounds and such, and even hear my character popup on the game, but nothing more.

Removed esx_identity, installed your esx_skin and skinmanager along with mx-multicharacter, changed the primary key to citizenid… added mx-spawn as well as required per your instructions.

2 Likes

Anybody else had this issue yet? I haven’t heard from MX yet so no way to fix this currently.

1 Like

it probably doesnt save the citizenid of the player that might be why. I would recommend starting from scratch sql and server files.

Mine is collecting citizenid’s, I checked in my database, I’ve even tried on a vanilla server with nothing special on it using legacy (I run build 2189 btw)

1 Like

i have this error when player is registered:

SCRIPT ERROR: @es_extended/server/main.lua:107: attempt to index a nil value (field '?')
> ref (@es_extended/server/main.lua:107)
>  (@mysql-async/mysql-async.js:14959)

Did you find any fix for this?

I have downloaded everything @MOXHA have told us to. Im using Es_extended v1.2

My esx_skin doesnt get triggered at all after registrating a new character.

Here is a GIF showing

Im Also Using legacy and I get the same… you get that waiting Error coz its not creating the character… not passing the data to DB

Yeah I’m gonna ask a mod to close this since @MOXHA has read this all multiple times, even yesterday, but he’s ignoring 100% of the responses and ZERO support. it’s broken and can’t be used properly, He’s not responding here or on his GitHub…

1 Like

Yes I see your comments but I don’t have to answer you, I don’t sell, I shared open source and I reply to people on this subject when I am available. I am not your personal developer. watch your words.

About your errors, the loading screen won’t close is related to the loading screen you are using. The person who got this error like you solved it by changing their loading screen. And not linden supported. I did it by testing all the esx versions I added. And the infrastructure I used was new, in short, I don’t think there is a problem in my work.

I’m not even running a loading screen lmao… how os it not linden supported? Lindens eax is literally esx legacy which you state in the first post IS supported…

And watch my words? Multiple people have been asking for help with this for several days and you’ve been on every single day without a single response I understand being busy I have twin 10month olds. But I still also respond to my post when I am around.

But back on track with the topic at hand, I’m doing this on a development server that has nothing on it except for ESX Legacy which is Linden’s just FYI because Linden’s esx is the most up to date esx legacy.

This is literally a base development server with no custom or add-on scripts on it at all. And with no loading screen other than the default GTA 1 this should not be the issue

1 Like

I haven’t used this (why would I?), and I couldn’t say how it wouldn’t support my ESX so long as the appropriate edits for multicharacter compatibility are made. Anyway, I’m here to tell you to fix your resource.

DeleteCharacter

Client

Feel free to send any citizenid to the server

$.post('https://mx-multicharacter/DeleteCharacter', JSON.stringify({

    citizenid: MX.CurrentCharacter

}));


RegisterNUICallback('DeleteCharacter', function (data) MX:TSE('mx-multicharacter:DeleteCharacter', data.citizenid) end)

Server

No check for ownership of that citizenid, and not using a prepared statement for the citizenid

AddEventHandler('mx-multicharacter:DeleteCharacter', function(cid) MX:DeleteCharacter(source, cid) end)

function MX:DeleteCharacter(source, cid)

    if cid and source then

         for _, v in pairs(self.DeleteTables) do

              MySQL.Sync.execute("DELETE FROM `"..v.table.."` WHERE `"..v.owner.."` = '"..cid.."'")

         end

         Wait(200)

         DropPlayer(source, 'Your character has been deleted, please login again.') 

    else

         DropPlayer(source, '.d?.') 

    end

end

Congratulations on deleting your character, and database

image

PlayCharacter

Client


$.post('https://mx-multicharacter/PlayCharacter', JSON.stringify({

     data: MX.CurrentCharacter

}));


RegisterNUICallback('PlayCharacter', function (data)

    MX:Cam(false)

    SetNuiFocus(false, false)

    TriggerServerEvent('mx-multicharacter:CreateCharacter', data.data)

    TriggerEvent('mx-spawn:Open', data.data)

    MX:DelEntity()

    DisplayRadar(1)

end)

Server

tt is the client-submitted cid for existing characters

AddEventHandler('mx-multicharacter:CreateCharacter', function (tt)

    local src = source

    if not tt then

         local cid = MX:CreateCitizenId()

         MX:TCE('mx-multicharacter:SetCitizenId', src, cid)

         MX.players[src] = cid

    else

         MX.players[src] = tt

         MX:TCE('mx-multicharacter:SetCitizenId', src, tt)

    end

end)

SetCitizenId

Client


    AddEventHandler('mx-multicharacter:SetCitizenId', function (cid) MX.CitizenId = cid end)

    ...

    TriggerServerEvent('esx:onPlayerJoined', MX.CitizenId, MX.NewCharacterData)

Server

Receive whatever citizenid from the client and now select the appropriate character; owner be damned

RegisterNetEvent('esx:onPlayerJoined')

AddEventHandler('esx:onPlayerJoined', function(cid, data)

    if not ESX.Players[source] then

        onPlayerJoined(source, cid, data)

    end

end)

function onPlayerJoined(playerId, citizenid, data)

    local identifier = ESX.GetIdentifier(playerId)

    if identifier and citizenid then

        if ESX.GetPlayerFromIdentifier(identifier) then

            DropPlayer(playerId, ('there was an error loading your character!\nError code: identifier-active-ingame\n\nThis error is caused by a player on this server who has the same identifier as you have. Make sure you are not playing on the same Rockstar account.\n\nYour Rockstar identifier: %s'):format(identifier))

        else

            MySQL.Async.fetchScalar('SELECT 1 FROM users WHERE citizenid = @citizenid', {

                ['@citizenid'] = citizenid

            }, function(result)

                if result then

                    loadESXPlayer(identifier, citizenid, playerId, false)

                else createESXPlayer(identifier, citizenid, playerId, data) end

            end)

        end

    else

        DropPlayer(playerId, 'there was an error loading your character!\nError code: identifier-missing-ingame\n\nThe cause of this error is not known, your identifier could not be found. Please come back later or report this problem to the server administration team.')

    end

end

5 Likes

DeleteCharacter

While creating the character, all the information is already created. Why should I check? And there is no code that completely deletes the database. I’ve already written what to delete.

              MySQL.Sync.execute("DELETE FROM `"..v.table.."` WHERE `"..v.owner.."` = '"..cid.."'")

“WHERE” U KNOW RIGHT ?

PlayCharacter

I am sending citizenid to the server because the first idea in my mind was to use it with the help of export, but I changed that idea. I don’t see any bad code here. Maybe you can be more descriptive.

Like this:

function onPlayerJoined(playerId, data)

    local identifier = ESX.GetIdentifier(playerId)

    if identifier and exports[''mx-multicharacter"]:GetCitizenId(playerId) then

        if ESX.GetPlayerFromIdentifier(identifier) then

            DropPlayer(playerId, ('there was an error loading your character!\nError code: identifier-active-ingame\n\nThis error is caused by a player on this server who has the same identifier as you have. Make sure you are not playing on the same Rockstar account.\n\nYour Rockstar identifier: %s'):format(identifier))

        else

            MySQL.Async.fetchScalar('SELECT 1 FROM users WHERE citizenid = @citizenid', {

                ['@citizenid'] = exports[''mx-multicharacter"]:GetCitizenId(playerId)

            }, function(result)

                if result then

                    loadESXPlayer(identifier, exports[''mx-multicharacter"]:GetCitizenId(playerId), playerId, false)

                else createESXPlayer(identifier, exports[''mx-multicharacter"]:GetCitizenId(playerId), playerId, data) end

            end)

        end

    else

        DropPlayer(playerId, 'there was an error loading your character!\nError code: identifier-missing-ingame\n\nThe cause of this error is not known, your identifier could not be found. Please come back later or report this problem to the server administration team.')

    end

end

If you want to help me or people. Instead of replying with empty talk and jokes, you could have created a repo and helped people here and maybe you know much more than me. But that doesn’t mean I’m at fault. I’m trying to learn everything myself. You have to learn to respect the other person.

1 Like

This isn’t about shitting on you, joking, or disrespecting you. It’s about the fact that you’ve made something unsafe, and I’m pointing out the code.

Never trust the client.

MySQL.Sync.execute("DELETE FROM `"..v.table.."` WHERE `"..v.owner.."` = '"..cid.."'")

As already established, cid is a variable equal to the value sent by the client. In normal circumstances it will follow whatever format you’ve set for it and is a alphanumeric string.

Now what happens if somebody sends their own data through your events and decides that cid is equal to, as the comic above shows,

Robert'); DROP TABLE users;

Or, even if batch statements aren’t accepted, they send through the citizen id of some other character?

The same logic applies for the PlayCharacter event - there are prepared statements in place which protects the queries, but there is no check for ownership.

3 Likes

Oh really you are right. If a cheat menu triggers with someone’s name, the entire database can be deleted.Thank you for the information.

$.post('https://mx-multicharacter/DeleteCharacter', JSON.stringify({
  citizenid: "Robert'); DROP TABLE users;"
}));

NUI dev tools would be enough to wipe database

1 Like

Thank you for the information. I probably fixed the problem.

1 Like


Screenshot_68

I get this fould but cant solve it some one knows? i have done al the steps in the read me i can make mij char but he doesn’t save it in the slot

I really think its a nice script. greetz!

I didn’t test the character rendering in the last update probably my fault i will fix it as soon as possible.

Can you announce it here when its done mate?

Of course