I have an issue where after I make a character, it is saved, but does not display at the character select screen. The saved character is still assigned to the slot and I can choose it and login, its just not displayed as there? It still reads as create a new character. What am I missing?
how do i get back to the selection screen without having to relog
Place this at the bottom of Client/main.lua
RegisterCommand(‘switch’, function()
TriggerEvent(‘kashactersC:ReloadCharacters’)
end)
I’ve followed the instructions for the ‘fixed’ version, all i get is the sky image, even with a clean database. any one able to help?
Edit: Got it working on a clean server with basic stuff on.
Hi! If i remove or change my character i keep my inventory and owned vehicles on all characters!
I would like to disable this and made people buy vehicles per-character
When setting up the table in the lua, do the identifiers have to be the “key” columns in each database that it refers to?
Been looking for a fix, and cant seem to find it, I’ve found similar threads about it but no real solution, how do you fix it so when you die/respawn you spawn back into the character you made?
Duplicate Your esx_datastore or add This line on your esx_datastore server\main.lua
```-- Fix was taken from this link --
-- https://forum.cfx.re/t/release-esx-kashacters-multi-character/251613/448?u=xxfri3ndlyxx --
AddEventHandler('esx:playerLoaded', function(source)
local result = MySQL.Sync.fetchAll('SELECT * FROM datastore')
for i=1, #result, 1 do
local name = result[i].name
local label = result[i].label
local shared = result[i].shared
local result2 = MySQL.Sync.fetchAll('SELECT * FROM datastore_data WHERE name = @name', {
['@name'] = name
})
if shared == 0 then
table.insert(DataStoresIndex, name)
DataStores[name] = {}
for j=1, #result2, 1 do
local storeName = result2[j].name
local storeOwner = result2[j].owner
local storeData = (result2[j].data == nil and {} or json.decode(result2[j].data))
local dataStore = CreateDataStore(storeName, storeOwner, storeData)
table.insert(DataStores[name], dataStore)
end
end
end
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local dataStores = {}
for i=1, #DataStoresIndex, 1 do
local name = DataStoresIndex[i]
local dataStore = GetDataStore(name, xPlayer.identifier)
if dataStore == nil then
MySQL.Async.execute('INSERT INTO datastore_data (name, owner, data) VALUES (@name, @owner, @data)',
{
['@name'] = name,
['@owner'] = xPlayer.identifier,
['@data'] = '{}'
})
dataStore = CreateDataStore(name, xPlayer.identifier, {})
table.insert(DataStores[name], dataStore)
end
table.insert(dataStores, dataStore)
end
xPlayer.set('dataStores', dataStores)
end)
when loading characters it doesnt load unique skins, if i use another character it uses the same skin for all
i tried to load in Users - skin, but that didnt work
At first it was working fine, now when people load in they can no longer can make more then 1 person it just loads the first person they made… How can I fix this? Also new people are spawning random when it was in legion the first day I tested this.
Multi Char is working fine, great job, btw. BUT i’m encountering a bug? When i store something in my apartment, then log out and back in to a DIFFERENT character, he shares the same apartment inventory. Got any idea why?
wondering if there is a way to lock slots. So having two slots open for regular people and 3-4 for admins
Cool idea i guess… butttt WHY? why limit people to only 2 characters?
Okay so ive done every step etc when someone connects to try to make someone this is what console pushes
SCRIPT ERROR: @esx_identity/server.lua:23: attempt to index a nil value (field ‘?’)
ref (@esx_identity/server.lua:23)
setImmediate (@mysql-async/mysql-async.js:5039)
SCRIPT ERROR: @es_extended/server/main.lua:162: attempt to index a nil value (field ‘?’)
ref (@es_extended/server/main.lua:162)
setImmediate (@mysql-async/mysql-async.js:5039)
Sending heartbeat to live-internal.fivem.net:30110
Connecting: Snolizz
Sending heartbeat to live-internal.fivem.net:30110
Uncaught TypeError: Cannot convert undefined or null to object
@mysql-async/mysql-async.js(5083,49): pool.query
@mysql-async/mysql-async.js(1094,10):
@mysql-async/mysql-async.js(1060,16):
@mysql-async/mysql-async.js(275,24): Sequence.end
@mysql-async/mysql-async.js(2216,8): Query._handleFinalResultPacket
@mysql-async/mysql-async.js(2200,8): Query.EofPacket
@mysql-async/mysql-async.js(6197,23): Protocol._parsePacket
@mysql-async/mysql-async.js(6458,12): write
@mysql-async/mysql-async.js(5957,16): Protocol.write
@mysql-async/mysql-async.js(683,28):
TypeError: Cannot convert undefined or null to object
when i load in if I do /register though it works however it doesnt save anything when you leave and come back.
Duplicate Your esx_datastore or add This line on your esx_datastore server\main.lua
-- https://forum.cfx.re/t/release-esx-kashacters-multi-character/251613/448?u=xxfri3ndlyxx --
AddEventHandler('esx:playerLoaded', function(source)
local result = MySQL.Sync.fetchAll('SELECT * FROM datastore')
for i=1, #result, 1 do
local name = result[i].name
local label = result[i].label
local shared = result[i].shared
local result2 = MySQL.Sync.fetchAll('SELECT * FROM datastore_data WHERE name = @name', {
['@name'] = name
})
if shared == 0 then
table.insert(DataStoresIndex, name)
DataStores[name] = {}
for j=1, #result2, 1 do
local storeName = result2[j].name
local storeOwner = result2[j].owner
local storeData = (result2[j].data == nil and {} or json.decode(result2[j].data))
local dataStore = CreateDataStore(storeName, storeOwner, storeData)
table.insert(DataStores[name], dataStore)
end
end
end
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local dataStores = {}
for i=1, #DataStoresIndex, 1 do
local name = DataStoresIndex[i]
local dataStore = GetDataStore(name, xPlayer.identifier)
if dataStore == nil then
MySQL.Async.execute('INSERT INTO datastore_data (name, owner, data) VALUES (@name, @owner, @data)',
{
['@name'] = name,
['@owner'] = xPlayer.identifier,
['@data'] = '{}'
})
dataStore = CreateDataStore(name, xPlayer.identifier, {})
table.insert(DataStores[name], dataStore)
end
table.insert(dataStores, dataStore)
end
xPlayer.set('dataStores', dataStores)
end)
hi,
HAve you any issue ?
Best regards
Currently having an issue where I am the only one able to view the character slot screen. All other users get a blank screen. Suggestions?
Having a slight issue.
When I add more table identifiers, the character selection just doesn’t appear.
local IdentifierTables = {
{table = "users", column = "identifier"},
{table = "user_accounts", column = "identifier"},
{table = "rented_vehicles", column = "owner"},
}
But because of the lack of table identifiers, all characters made by the same steam have the same licenses/vehicles/inventories.
Only recently realised this was happening so it’s been abused on the server for a while.
Any help would be appreciated.
– fixed it, but it’s managed to mess up esx_properties… onto the next project.
Does anyone know why when i spawn in i will spawn in at the coords 0 0 0?
anyone have a fix with the new update ? where this script wont work