[RELEASE][ESX] KASHacters Multi Character

Hey, my character select/create menu dosen’t start! My screen is just all blury. Please help. Thanks

Hi, I’m struggling with the multi-character system, when I try and make a grade everything is fine, until I get a job, then all grades have the same job, which is a big problem

Don’t worry about it. It’s been leaked ages ago. He won’t be making any money on it.

So the blurry screen i thought was for everyone when you go into the server but for some reason its only for me and nobody else im not sure if my co owner has the same problem since he hasnt tested yet but does anyone know why i am only getting the blurry screen when joining? And yes it is because of kashacters because others get to see the menu when they get in the server.

ok attacking it from a different angle. does anyone know what parts of this script interact with the property storage. everything is working great except the storage for players properties it is all over the place. 1st, 2nd,3rd,4th characters can’t store any items or weapons because after a server restart the items disappear even if its is that current characters inventory. there was a trick above to fix dirty money and it seems to be working. any ideas my lovely people :slight_smile:

Hey, on readme it says upload sql file to your database! How to i update so “esx_kashacters” is in my database?

I would appreciate some answers.

I have the same problem! Have you found the problem?

Tout of you can help me . Y have trew huí in my server and he huí that have this scripts put in the place of de trew huí . Hoy to disable game hud

Can you show how you got the /switch command working so that the skin changes and all the character info?

Hey, Has anyone managed to get a /switch working with ESX? I’ve read through the whole topic here and I’ve seen a few people kinda get it working. Has anyone figured this out completely yet? Meaning where you can logout and go to the main character selection screen and select your new character without having to leave and rejoin. Also, with the bug with esx_skin where your main characters skin ports over to the new one, has anyone fixed that issue? I also saw a bug with creating a new character from that main screen any fix on this yet? Please let me know! Great script love using it!

pls help

make sure you edit the server/main.lua with all the tables you need. This is most likely the cause of this issue!

Everything is correct with me

Hello , i have this problem when i connect to my server. I am stuck in air and there is this problem in the console

SCRIPT ERROR: citizen:/scripting/lua/json.lua:397: bad argument #1 to ‘strfind’ (string expected, got nil)

handler (@esx_kashacters/server/main.lua:27)

Can you help me please? Here is the server/main.lua

---------------------------------------------------------------------------------------
-- Edit this table to all the database tables and columns
-- where identifiers are used (such as users, owned_vehicles, owned_properties etc.)
---------------------------------------------------------------------------------------
local IdentifierTables = {
    {table = "users", column = "identifier"},
    {table = "owned_vehicles", column = "owner"},
    {table = "user_accounts", column = "identifier"},
}

RegisterServerEvent("kashactersS:SetupCharacters")
AddEventHandler('kashactersS:SetupCharacters', function()
    local src = source
    local LastCharId = GetLastCharacter(src)
    SetIdentifierToChar(GetPlayerIdentifiers(src)[1], LastCharId)
    local Characters = GetPlayerCharacters(src)
    TriggerClientEvent('kashactersC:SetupUI', src, Characters)
end)

RegisterServerEvent("kashactersS:CharacterChosen")
AddEventHandler('kashactersS:CharacterChosen', function(charid, ischar)
    local src = source
    local spawn = {}
    SetLastCharacter(src, tonumber(charid))
    SetCharToIdentifier(GetPlayerIdentifiers(src)[1], tonumber(charid))
    if ischar == "true" then
        spawn = GetSpawnPos(src)
    else
		TriggerClientEvent('skinchanger:loadDefaultModel', src, true, cb)
        spawn = { x = 195.55, y = -933.36, z = 29.90 } -- DEFAULT SPAWN POSITION
    end
    TriggerClientEvent("kashactersC:SpawnCharacter", src, spawn)
end)

RegisterServerEvent("kashactersS:DeleteCharacter")
AddEventHandler('kashactersS:DeleteCharacter', function(charid)
    local src = source
    DeleteCharacter(GetPlayerIdentifiers(src)[1], charid)
    TriggerClientEvent("kashactersC:ReloadCharacters", src)
end)

function GetPlayerCharacters(source)
    local identifier = GetIdentifierWithoutSteam(GetPlayerIdentifiers(source)[1])
    local Chars = MySQLAsyncExecute("SELECT * FROM `users` WHERE identifier LIKE '%"..identifier.."%'")
    return Chars
end

function GetLastCharacter(source)
    local LastChar = MySQLAsyncExecute("SELECT `charid` FROM `user_lastcharacter` WHERE `steamid` = '"..GetPlayerIdentifiers(source)[1].."'")
    if LastChar[1] ~= nil and LastChar[1].charid ~= nil then
        return tonumber(LastChar[1].charid)
    else
        MySQLAsyncExecute("INSERT INTO `user_lastcharacter` (`steamid`, `charid`) VALUES('"..GetPlayerIdentifiers(source)[1].."', 1)")
        return 1
    end
end

function SetLastCharacter(source, charid)
    MySQLAsyncExecute("UPDATE `user_lastcharacter` SET `charid` = '"..charid.."' WHERE `steamid` = '"..GetPlayerIdentifiers(source)[1].."'")
end

function SetIdentifierToChar(identifier, charid)
    for _, itable in pairs(IdentifierTables) do
        MySQLAsyncExecute("UPDATE `"..itable.table.."` SET `"..itable.column.."` = 'Char"..charid..GetIdentifierWithoutSteam(identifier).."' WHERE `"..itable.column.."` = '"..identifier.."'")
    end
end

function SetCharToIdentifier(identifier, charid)
    for _, itable in pairs(IdentifierTables) do
        MySQLAsyncExecute("UPDATE `"..itable.table.."` SET `"..itable.column.."` = '"..identifier.."' WHERE `"..itable.column.."` = 'Char"..charid..GetIdentifierWithoutSteam(identifier).."'")
    end
end

function DeleteCharacter(identifier, charid)
    for _, itable in pairs(IdentifierTables) do
        MySQLAsyncExecute("DELETE FROM `"..itable.table.."` WHERE `"..itable.column.."` = 'Char"..charid..GetIdentifierWithoutSteam(identifier).."'")
    end
end

function GetSpawnPos(source)
    local SpawnPos = MySQLAsyncExecute("SELECT `position` FROM `users` WHERE `identifier` = '"..GetPlayerIdentifiers(source)[1].."'")
    return json.decode(SpawnPos[1].position)
end

function GetIdentifierWithoutSteam(Identifier)
    return string.gsub(Identifier, "steam", "")
end

function MySQLAsyncExecute(query)
    local IsBusy = true
    local result = nil
    MySQL.Async.fetchAll(query, {}, function(data)
        result = data
        IsBusy = false
    end)
    while IsBusy do
        Citizen.Wait(0)
    end
    return result
end

Restart your game

how do i stop it from loading me in as a random ped everytime

have you found the fix?

This is what keeps happening to me? Any Idea’s please help.

I cant select the character, I cant create a new character, after I connect to the city this is immediately what happens. @KASH

1 Like

I followed this and I cant get it to work

hi i installed Multichar and when somebody logs in he spawns everytime at the sam position and how to turn that off/change it that you spawn there you logged out?