Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into update
Browse files Browse the repository at this point in the history
  • Loading branch information
thelindat committed Jun 21, 2021
2 parents 379d42a + 252a987 commit 76eaad8
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 36 deletions.
3 changes: 2 additions & 1 deletion client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------------

Expand Down
8 changes: 8 additions & 0 deletions html/locales/tr.js
Original file line number Diff line number Diff line change
@@ -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";
9 changes: 9 additions & 0 deletions locales/tr.lua
Original file line number Diff line number Diff line change
@@ -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",
}
64 changes: 33 additions & 31 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
### 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`
- Set your database name for `Config.Database` in server/main.lua
- 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)
Expand All @@ -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
Expand Down
12 changes: 8 additions & 4 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 76eaad8

Please sign in to comment.