diff --git a/client/main.lua b/client/main.lua index 1952744..aa787e2 100644 --- a/client/main.lua +++ b/client/main.lua @@ -283,13 +283,14 @@ if ESX.GetConfig().Multichar then end) end) else - TriggerEvent('skinchanger:loadSkin', Characters[Spawned].skin) + TriggerEvent('skinchanger:loadSkin', skin or Characters[Spawned].skin) Citizen.Wait(1500) end Characters = {} TriggerServerEvent('esx:onPlayerSpawn') TriggerEvent('esx:onPlayerSpawn') TriggerEvent('playerSpawned') + TriggerEvent('esx:restoreLoadout') playerPed = PlayerPedId() FreezeEntityPosition(playerPed, false) SetEntityHeading(PlayerPed, spawn.heading) diff --git a/config.lua b/config.lua index d19cb5b..5612106 100644 --- a/config.lua +++ b/config.lua @@ -6,6 +6,7 @@ Config.Spawn = vector4(-113.7, 565.3, 196, 0) -------------------- -- Do not use unless you are prepared to adjust your resources to correctly reset data +-- Information: https://github.com/thelindat/esx_multicharacter#relogging Config.Relog = false -------------------- diff --git a/html/locales/tr.js b/html/locales/tr.js new file mode 100644 index 0000000..ab82073 --- /dev/null +++ b/html/locales/tr.js @@ -0,0 +1,8 @@ +const translate = new Object(); + +translate.name = "İsim"; +translate.job = "Meslek"; +translate.bank = "Banka"; +translate.money = "Nakit"; +translate.gender = "Cinsiyet"; +translate.dob = "Doğum Tarihi"; diff --git a/locales/tr.lua b/locales/tr.lua new file mode 100644 index 0000000..6fc35da --- /dev/null +++ b/locales/tr.lua @@ -0,0 +1,9 @@ +Locales['tr'] = { + ['delete_label'] = "Sil %s %s?", + ['select_char'] = "Karakter Seç", + ['create_char'] = "Yeni Karakter Oluştur", + ['char_play'] = "Bu Karakterle Oyna", + ['char_delete'] = "Bu Karakteri Sil", + ['cancel'] = "İptal", + ['confirm'] = "Onayla", +} diff --git a/readme.md b/readme.md index a28acaf..1531c08 100644 --- a/readme.md +++ b/readme.md @@ -1,17 +1,9 @@ ### Requirements -#### [ESX Legacy](https://github.com/esx-framework/es_extended/tree/legacy) -- Minimum commit: 89f8d87 -- Legacy is an update from v1 Final with bug fixes, optimisations and some new features -#### [MySQL Async](https://github.com/brouznouf/fivem-mysql-async/releases/tag/3.3.2) -- Minimum commit: ec81359 -#### [ESX Identity](https://github.com/esx-framework/esx_identity) -- Minimum commit: 5d28b23 -- Required for character registration -#### [ESX Skin](https://github.com/esx-framework/esx_skin) -- Minimum commit: 3a81208 -- If you wish to use other resources, you will need to adjust events in multicharacter -#### [Spawnmanager](https://github.com/citizenfx/cfx-server-data/tree/master/resources/%5Bmanagers%5D/spawnmanager) -- Required for spawning as well as ESX Legacy +- [ESX Legacy](https://github.com/esx-framework/es_extended/tree/legacy) +- [MySQL Async](https://github.com/brouznouf/fivem-mysql-async/releases/tag/3.3.2) +- [ESX Identity](https://github.com/esx-framework/esx_identity) +- [ESX Skin](https://github.com/esx-framework/esx_skin) +- [Spawnmanager](https://github.com/citizenfx/cfx-server-data/tree/master/resources/%5Bmanagers%5D/spawnmanager) ### Installation - Modify your ESX config with `Config.Multichar = true` @@ -19,14 +11,31 @@ - All owner and identifier columns should be set to `VARCHAR(60)` to ensure correct data entry - Use the `varchar` command from the console to update your SQL tables - Once you have used the command you should just remove it for sanity's sake + +### Conflicts +* The following resources should not be used with ESX Legacy and can result in errors + - **essentialsmode** + - basic-gamemode + - fivem-map-skater + - fivem-map-hipster + - default_spawnpoint + - cui_character (or other resources that modify spawn behaviour) + +### Common issues +#### Black screen / loading scripts + - Download and run all requirements + - Ensure none of the conflicting resources are enabled +#### mysql-async duplicate entry + - You have not increased the VARCHAR size of your tables (use the command) + +#### The menu interface is esx_menu_default - you can use any version if you want a different appearance +![image](https://user-images.githubusercontent.com/65407488/119010385-592a8c80-b9d7-11eb-9aa1-eb7051004843.png) + ### Relogging -- Modify the config with `Config.Relog = true` -- Use the latest version of [ESX Status](https://github.com/esx-framework/esx_status) -- If you have any threads running with `while true do` I recommend using `while ESX.PlayerLoaded do` instead - - For threads that are triggered by a spawn/load event this will ensure they do not start a second time - - You can clear loops that may break after ESX.PlayerData is cleared - - For an example, refer to my [boilerplate](https://github.com/thelindat/esx_legacy_boilerplate/blob/main/client.lua) -- Add the following event to any resources that will benefit from clearing ESX.PlayerData +- Do not enable this setting if you do not intend to properly set up relog support +- Requires the latest update for ESX Status (prevents multiple status ticks from running) +- Add the following events to resources that require support for relogging, or +- Add them to [@esx/imports.lua](https://github.com/esx-framework/es_extended/blob/legacy/imports.lua) (and use the imports in your resources) ```lua RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(xPlayer) @@ -40,17 +49,10 @@ AddEventHandler('esx:onPlayerLogout', function() ESX.PlayerData = {} end) ``` - -#### The menu interface is esx_menu_default - you can use any version if you want a different appearance -![image](https://user-images.githubusercontent.com/65407488/119010385-592a8c80-b9d7-11eb-9aa1-eb7051004843.png) - -## Conflicts -* The following resources should not be used with ESX Legacy and can result in errors - - **essentialsmode** - - basic-gamemode - - fivem-map-skater - - fivem-map-hipster - - default_spawnpoint +- Any threads using ESX.PlayerData in a loop should check if ESX.PlayerLoaded is true + - This ensures the resource does not error after relogging, or while on character selection + - Setup correctly you can break your loops and trigger them again after loading + - Refer to my [boilerplate](https://github.com/thelindat/esx_legacy_boilerplate) for more information and usage examples ### Notes - This resource is not compatible with ExtendedMode or previous versions of ESX diff --git a/server/main.lua b/server/main.lua index 2d9845f..f65ae6c 100644 --- a/server/main.lua +++ b/server/main.lua @@ -27,16 +27,20 @@ if ESX.GetConfig().Multichar == true then }, function(result) local characters = {} for i=1, #result, 1 do - local job = ESX.Jobs[result[i].job] - local grade = ESX.Jobs[job.name].grades[tostring(result[i].job_grade)].label + local job, grade = result[1].job, tostring(result[1].job_grade) + if ESX.Jobs[job] and ESX.Jobs[job].grades[grade] then + grade = ESX.Jobs[job].grades[grade].label + job = ESX.Jobs[job].label + else + job, grade = 'Unemployed', '' + end local accounts = json.decode(result[i].accounts) - if grade == 'Unemployed' then grade = '' end local id = tonumber(string.sub(result[i].identifier, #Config.Prefix+1, string.find(result[i].identifier, ':')-1)) characters[id] = { id = id, bank = accounts.bank, money = accounts.money, - job = job.label, + job = job, job_grade = grade, firstname = result[i].firstname, lastname = result[i].lastname,