[RELEASE][ESX] KASHacters Multi Character

Error: (node:1164) UnhandledPromiseRejectionWarning: TypeError: Cannot convert undefined or null to object
at Function.values ()
at execute.then (mysql-async.js:5002:48)
Error: (node:1164) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)

Help!!!

I’m trying to make the event save the position then trigger the reload character but seems like it only trigger the save updatePositions but not the ReloadCharacters. Anyone have any clue on how to fix this ?

RegisterCommand('switch', function()
    TriggerServerEvent('es:updatePositions', pos.x, pos.y, pos.z)
    TriggerEvent('kashactersC:ReloadCharacters')
end)

Try this I haven’t tested it yet let me know


RegisterCommand('switchCharacter', function(source, args, rawCommand)
	local playerPed = GetPlayerPed()
	local myCoords = GetEntityCoords(playerPed)
    TriggerServerEvent('es:updatePositions', myCoords.x, myCoords.y, myCoords.z)
    TriggerEvent('kashactersC:ReloadCharacters')
end)

the TriggerEvent('kashactersC:ReloadCharacters') is working but the TriggerServerEvent('es:updatePositions', myCoords.x, myCoords.y, myCoords.z) isn’t saving my character coords

anyone could help me on adding this? it all works perfect but loads of errors seem to come up in CMD

I’m working on a better solution will post once finished

(Disclaimer: I know that I’ve done something wrong while installing this resource. This is on me, 100%.)

I have tried adding this resource multiple times now and I always end up with the same two problems. The first one is that the first character created works fine, but once I create a second character the first one doesn’t show up anymore, but it is still in the database. Once I remove the resource though, everything breaks more or less, in that nothing gets saved or loaded anymore (position, inventory, name, outfit, even commands like /register and /charlist stopped working). Thinking about it, that might be because I had to comment out essentialmode\client\main.lua, line 6-16, like it states in the readme… Should have tried that. Anyways, I followed the readme very thoroughly and the top of my esx_kashacters\server\main.lua file ended up looking like this:

local IdentifierTables = {
    {table = "billing", column = "identifier"},
    {table = "characters", column = "identifier"},
    {table = "society_moneywash", column = "identifier"},
    {table = "users", column = "identifier"},
    {table = "user_accounts", column = "identifier"},
    {table = "user_inventory", column = "identifier"},
    {table = "user_licenses", column = "owner"},
}

I feel like I should also mention that it did successfully rename the steam-id in the database from “steam:” to “Char:” so that did work. I’ve never really gotten any errors, since I try to get everything just right. I’m just on my standard home PC, using xampp for the database.

To have this work properly, at least for me

  1. wipe Database and do fresh install of all tables, reason is this Resource changes the way ESX saves info in which would be just steamid but, now it does it by Charid and steamid

  2. Once you wipe the database is shinny new, add this resource and setup the server local Identifiertables MAKE SURE to add every “identifier” and “owner”

  3. load in , create character and run around , logout and make a new one

  4. profit

Note when adding new resources that had SQL tables if those tables have a “identifier” or “owner” in it make sure to add to the local IndentifierTables first before restarting the server with it, reason is that resource will be called first and lets say players use that new resource and it wasn’t added, it will break everything.

I hope this helps

Thank you very much for your quick response!

Technically the database was just set up, I was the only person to ever connect to the server. I can remove all of my steam-id and character data, I think that would be faster since most SQL-files need to be loaded in a specific order and it would be a pain in the backside to do, but if it’s really necessary I will do that.

That is exactly what I have done before, I went through every part of my database and searched for every owner and identifier tag. If I would not add one of them (e.g. one that specifies which items a character has) then the worst thing that could theoretically happen would be that the inventory would be shared, at least as far as I know.

Just as a quick question, do you know of a way to do backups of the database? I did google it but the only thing I found was to use the export function on the control-panel dashboard of xampp (127.0.0.1/phpmyadmin) and when importhing the .sql file after a full reset it only works partially (eg. “Error 1046 - No database selected” even though it clearly states which database to use in the .sql file.)

Alright, I’ve got a problem on my server and I’ve had it for a while. I’m not sure if it is the IsDead function that stops working or what, but whenever someone dies, the menues with IsDead in it stops working, like if the IsDead is set to true even though you are alive again and have gotten revived.

Does anyone know about a solution for this problem? I’ve tried the most.

I see your missing Addon_acoount_data and Datastore_data, do you have that running on the server too?

RegisterServerEvent('esx_ambulancejob:setDeathStatus')
AddEventHandler('esx_ambulancejob:setDeathStatus', function(isDead)
	local identifier = GetPlayerIdentifiers(source)[1]

	MySQL.Sync.execute('UPDATE users SET is_dead = @isDead WHERE identifier = @identifier', {
		['@identifier'] = identifier,
		['@isDead']     = isDead
	})
end)

I believe this needs to be called when player is revive so it toggles back the 1 to 0 then everything that checks isDead should work as normal let me know if this helps, if not i’ll dive into it, for a fix

Well I’ve already tried that unfortunately.

Hi there, I have been looking for, and some people have had the same problem as me but nobody has given solution.

I have installed the mod, and it works perfectly except that it does not save the last location.

In the database, the “Position” section whenever any user disconnects is updated to {“x”: 0.0, “z”: 0.0, “y”: 0.0}.

The format of Position is varchar (255) so there are no problems with the size of the String.

I have tried to install several versions of es_extended to see if there was a version conflict but it remains the same, so I assume that the problem comes from the mod.

Works for me.

exactly same problem here, any solution?

For some reason every time I load into the server I play on im either stuck in the clouds and when I register a new player it will bring me out of the clouds but then my screen is really blurry and i cant take out any weapons or see the map. Has anyone experienced this issue? Is so, whats the fix?

i faced this issue before for some reason it was fixed after i replace the kashacter with the latest one(current default). Try it out

I do have them in my database, must have missed them. I will try installing the resource once again, hoping that it will not damage my server. I have made backups just in case, I hope that they’re going to work. I’ll list every step I take and my exact server configuration while doing so.

  • Stopped server completely
  • Went through database to delete every entry that was made because I joined
  • Moved/renamed Kashacters: resources\[esx]\esx_kashacters\__resource.lua
  • Commented out the following text in essentialmode\client\main.lua:
--[[Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)

		if NetworkIsSessionStarted() then
			TriggerServerEvent('es:firstJoinProper')
			TriggerEvent('es:allowedToSpawn')
			return
		end
	end
end)]]--

Question: Should I only comment out line 5-8 in there or leave it like this?

  • Imported esx_kashacters.sql into essentialmode database, no errors, “user_lastcharacter” created.
  • Edited the esx_kashacters\server\main.lua:
local IdentifierTables = {
    {table = "addon_account_data", column = "owner"},
    {table = "addon_inventory_items", column = "owner"},
    {table = "billing", column = "identifier"},
    {table = "characters", column = "identifier"},
    {table = "datastore_data", column = "owner"},
    {table = "society_moneywash", column = "identifier"},
    {table = "users", column = "identifier"},
    {table = "user_accounts", column = "identifier"},
    {table = "user_inventory", column = "identifier"},
    {table = "user_lastcharacter", column = "steamid"}, -- Is this needed?
    {table = "user_licenses", column = "owner"},
}

My essentialmode database only consists of these tables so I think I’ve gotten all of them in there.

  • Added ensure esx_kashacters to the server.cfg.

These are my current resources:

# These resources will start by default.
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure fivem
ensure hardcap
ensure ■■■■■■■
ensure scoreboard
# CUSTOM
ensure essentialmode
ensure mysql-async
ensure esplugin_mysql
ensure es_extended
ensure async
ensure esx_menu_default
ensure esx_menu_dialog
ensure esx_menu_list
ensure new_banking
ensure bob74_ipl
ensure legacyfuel
ensure qalle_coords
ensure esx_addonaccount
ensure cron
ensure esx_license
ensure esx_datastore
ensure esx_billing
ensure esx_society
ensure skinchanger
ensure esx_skin
ensure esx_identity
ensure esx_policejob
ensure esx_kashacters

I will wait with starting the server in case I’ve done something wrong, I don’t want to risk having to redo the entire thing yet again.

Run this in the database

SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = 'owner'

and just change ‘owner’ to ‘identifier’ it will help locate all table with those tags, other than you look to start let me know if it works. Also yes keep that line commented out