[RELEASE][ESX] KASHacters Multi Character

Also, is there no hot key or command to input to switch characters without having to log out and back in?

That is a current limitation. Someone attempted to make a switch command, but the player model did not update. I’m hoping to investigate this in future.

1 Like

This error keeps showing up only when creating the character. Everything seems to work out for player, but it looks scary in server’s console :sweat_smile:

System.Reflection.TargetInvocationException: Exception has been thrown by the ta
rget of an invocation. ---> System.ArgumentOutOfRangeException: Index was out of
 range. Must be non-negative and less than the size of the collection.
Parameter name: index
  at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009
] in <fbc4ec45371543bfba3678ebb82caf6d>:0
  at (wrapper dynamic-method) System.Object.CallSite.Target(System.Runtime.Compi
lerServices.Closure,System.Runtime.CompilerServices.CallSite,object,int)
  at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet] (System.Runtim
e.CompilerServices.CallSite site, T0 arg0, T1 arg1) [0x0011d] in <cf8f429092f345
a6bd742c3476e00e06>:0
  at CitizenFX.Core.MsgPackDeserializer+<>c__DisplayClass36_1.<CreateRemoteFunct
ionReference>b__1 (System.Object res, System.Object err) [0x00246] in C:\gl\buil
ds\4ff63adb\0\cfx\fivem\code\client\clrcore\MsgPackDeserializer.cs:290
  at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInv
oke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Refle
ction.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[]
parameters, System.Globalization.CultureInfo culture) [0x0006a] in <fbc4ec453715
43bfba3678ebb82caf6d>:0
   Exception_EndOfInnerExceptionStack


Server stack trace:
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Refle
ction.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[]
parameters, System.Globalization.CultureInfo culture) [0x00083] in <fbc4ec453715
43bfba3678ebb82caf6d>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] par
ameters) [0x00000] in <fbc4ec45371543bfba3678ebb82caf6d>:0
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000e7] in <fbc4
ec45371543bfba3678ebb82caf6d>:0
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00008]
 in <fbc4ec45371543bfba3678ebb82caf6d>:0
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <fbc4ec45
371543bfba3678ebb82caf6d>:0
  at CitizenFX.Core.FunctionReference.Invoke (System.Int32 reference, System.Byt
e[] arguments) [0x00062] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcor
e\FunctionReference.cs:65
  at CitizenFX.Core.InternalManager.CallRef (System.Int32 refIndex, System.Byte[
] argsSerialized, System.IntPtr& retvalSerialized, System.Int32& retvalSize) [0x
00000] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\InternalManager.
cs:438
  at (wrapper remoting-invoke-with-check) CitizenFX.Core.InternalManager.CallRef
(int,byte[],intptr&,int&)
  at (wrapper xdomain-dispatch) CitizenFX.Core.InternalManager.CallRef(object,by
te[]&,byte[]&,int,byte[],int&)

Exception rethrown at [0]:
  at (wrapper xdomain-invoke) CitizenFX.Core.InternalManager.CallRef(int,byte[],
intptr&,int&)
  at (wrapper remoting-invoke-with-check) CitizenFX.Core.InternalManager.CallRef
(int,byte[],intptr&,int&)
  at CitizenFX.Core.MonoScriptRuntime.CallRef (System.Int32 refIndex, System.Byt
e[] argsSerialized, System.Int32 argsSize, System.IntPtr& retvalSerialized, Syst
em.Int32& retvalSize) [0x00013] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client
\clrcore\MonoScriptRuntime.cs:195
Error resuming coroutine: citizen:/scripting/lua/MessagePack.lua:830: missing by
tes
stack traceback:
        [C]: in function 'error'
        citizen:/scripting/lua/MessagePack.lua:830: in method 'underflow'
        citizen:/scripting/lua/MessagePack.lua:465: in field 'any'
        citizen:/scripting/lua/MessagePack.lua:860: in field 'unpack'
        citizen:/scripting/lua/scheduler.lua:628: in field 'cb'
        citizen:/scripting/lua/scheduler.lua:399: in function <citizen:/scriptin
g/lua/scheduler.lua:389>
server thread hitch warning: timer interval of 261 milliseconds

local IdentifierTables = {
    {table = "users", column = "identifier"},
    {table = "owned_vehicles", column = "owner"},
    {table = "user_accounts", column = "identifier"},
	{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 = "owned_properties", column = "owner"},
	{table = "rented_vehicles", column = "owner"},
	{table = "society_moneywash", column = "identifier"},
	{table = "user_inventory", column = "identifier"},
	{table = "user_licenses", column = "owner"},
	{table = "jail", column = "identifier"},
	{table = "owned_bags", column = "identifier"},
	{table = "user_contacts", column = "identifier"},
	{table = "user_parkings", column = "identifier"},
}

Any ideas what’s wrong?

Found more error…
If player are in jail, because of this script, it doesn’t check the status of the player when loaded
if a player is dead and logout and logback in they won’t be sent to the hospital because again it doesn’t check for a status

Hello all, just implemented this into my RP server i’m working on but I’m a complete noob with CSS. I centred the buttons using;

.btn-play {
text-align:center;
background: #43A047;
color: #FFFFFF;
float:left;
margin-right: 1000px;
background-position:left 36px;
left: 950px;
top: 650px;
position:absolute;

but now when I press play, the button is still in the middle of my screen forever (i’m assuming this is because of the “position:absolute”. If there’s a better way to do it, please let me know :stuck_out_tongue:

Still have problems with item duplication. Otherwise everything seems to work fine. Anybody else?

Having troubles with the js, im wanting it to display the jobLabel instead of the name, ive seen a few comments on here already about it but nothing straight forward enough for me to handle, ive tried modifying a few things like adding an array of the job names that the ‘char.job’ could be but no luck. Any help or copy of a script would be much appreciated.

Guess ill leave the post here for support as it took me 10min to figure out… Just an array to set each job name through the JavaScript

(() => {
Kashacter = {};

Kashacter.ShowUI = function(data) {
    $('.main-container').css({"display":"block"});
    if(data.characters !== null) {
        $.each(data.characters, function (index, char) {
			if (char.job === "ambulance") {
				char.job = "Paramedic";
			}
			if (char.job === "cardealer") {
				char.job = "Car Dealership";
			}
			if (char.job === "gopostal") {
				char.job = "Australia Post";
			}
			if (char.job === "mechanic") {
				char.job = "Turbos Garage";
			}
			if (char.job === "police") {
				char.job = "NSW PD";
			}
			if (char.job === "unemployed") {
				char.job = "Unemployed";
			}
			if (char.job === "trucker") {
				char.job = "Trucker";
			}
            if (char.charid !== 0) {
                var charid = char.identifier.charAt(4);
                $('[data-charid=' + charid + ']').html('<h3 class="character-fullname">'+ char.firstname +' '+ char.lastname +'</h3><div class="character-info"><p class="character-info-work"><strong>Work: </strong><span>'+ char.job +'</span></p><p class="character-info-money"><strong>Cash: </strong><span>'+ char.money +'</span></p><p class="character-info-bank"><strong>Bank: </strong><span>'+ char.bank +'</span></p> <p class="character-info-dateofbirth"><strong>Date of birth: </strong><span>'+ char.dateofbirth +'</span></p> <p class="character-info-gender"><strong>Gender: </strong><span>'+ char.sex +'</span></p></div>').attr("data-ischar", "true");
            }
        });
    }
};
if (char.job === "trucker") {
        JobLabel = "Trucker";
}

Then in the code below which displays all the info, replace char.job with JobLabel

Edit: Also! You should have elseif instead of just if’s in the code. I’m on my phone, so can’t give you my code.

1 Like

is there someone who fixed infinity loading black screen ? (position error?..)

Anyone?

halp

[ERROR] [MySQL] [esx_kashacters] An error happens on MySQL for query "[object Object]": ER_DUP_ENTRY: Duplicate entry 'Char1:110000106b945dd' for key 'PRIMARY'
Error: (node:19460) UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION]: unexpected PromiseRejectEvent
    at process.<anonymous> (internal/process/promises.js:27:25)
    at <anonymous>
    at Query.db.query [as _callback] (mysql-async.js:4973:13)
    at Query.Sequence.end (mysql-async.js:280:24)
    at Query.ErrorPacket (mysql-async.js:2122:8)
    at Protocol._parsePacket (mysql-async.js:5941:23)
    at Parser.write (mysql-async.js:6198:12)
    at Protocol.write (mysql-async.js:5701:16)
    at Socket.<anonymous> (mysql-async.js:693:28)
    at emitOne (events.js:116:13)
Error: (node:19460) 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)
Error: (node:19460) UnhandledPromiseRejectionWarning: Error: ER_DUP_ENTRY: Duplicate entry 'Char1:110000106b945dd' for key 'PRIMARY'
    at Query.Sequence._packetToError (mysql-async.js:244:14)
    at Query.ErrorPacket (mysql-async.js:2109:18)
    at Protocol._parsePacket (mysql-async.js:5941:23)
    at Parser.write (mysql-async.js:6198:12)
    at Protocol.write (mysql-async.js:5701:16)
    at Socket.<anonymous> (mysql-async.js:693:28)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    --------------------
    at Pool.query (mysql-async.js:4728:23)
    at Promise (mysql-async.js:4970:12)
    at new Promise (<anonymous>)
    at execute (mysql-async.js:4967:26)
    at Object.global.exports [as callback] (mysql-async.js:4993:5)
    at citizen:/scripting/v8/main.js:96:41
Error: (node:19460) 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: 4)

guys, seriously no one has found the black loading screen bug fix ? really?

Can u post your error code here please ?

Try a clean reinstall and do not edit anything in the files.

Also a problem I’ve faced is when creating more than 1 character, you enter a situation in which the resource is identifying a “duplicate” identity, something you can do to avoid that is deleting all data rows including identities (steamID, owner column, etc.).

i added it to my server and started it but it is giving me a problem. if you press play or delete to any character you have it will freeze. Like something is wrong.

Also this step is not clear for me.

  • Comment out the NetworkIsSessionStarted loop in essentialmode\client\main.lua (you can comment out the whole Citizen.Createthread() )

everytime i chane main.lua for the essential mode the server break.

I do know that if you change user you do not still be admin unless given perm on all 3 characters

what was your problem? i have also that i can click on the buttons “create character” but nothing happens

code was way too buggy / no checks so id refrain from using this unless someone wants to pick up the project and clean it up…

Im using the CivLifeRP character Registration, then the buttons wont work :frowning: , sorry im newb in this, but with the standard esx_identity it works flawless :slight_smile: ( great script )! :slight_smile: can someone explain me what im doing wrong or what i should change to make it work? sorry for my english