improvement(multicharacter): Version bump

This commit is contained in:
Linden
2021-07-28 21:44:05 +10:00
parent 99cd701286
commit 8560a9438b
6 changed files with 47 additions and 43 deletions
+3 -3
View File
@@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
esx_multicharacter
Copyright (C) 2021 Linden and KASH
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
esx_multicharacter Copyright (C) 2021 Linden and KASH
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
+24 -24
View File
@@ -25,12 +25,17 @@ if ESX.GetConfig().Multichar then
ESX.PlayerLoaded = false
ESX.PlayerData = {}
Spawned = false
cam = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", Config.Spawn.x, Config.Spawn.y+1.6, Config.Spawn.z+1.3, 0.0, 0.0, 180.0, 100.00, false, 0)
SetEntityCoords(PlayerPedId(), Config.Spawn.x, Config.Spawn.y, Config.Spawn.z, true, false, false, false)
SetEntityHeading(PlayerPedId(), Config.Spawn.w)
cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true)
local playerPed = PlayerPedId()
SetEntityCoords(playerPed, Config.Spawn.x, Config.Spawn.y, Config.Spawn.z, true, false, false, false)
SetEntityHeading(playerPed, Config.Spawn.w)
local offset = GetOffsetFromEntityInWorldCoords(playerPed, 0, 1.7, 0.4)
DoScreenFadeOut(0)
SetCamActive(cam, true)
RenderScriptCams(true, false, 1, true, true)
SetCamCoord(cam, offset.x, offset.y, offset.z)
PointCamAtCoord(cam, Config.Spawn.x, Config.Spawn.y, Config.Spawn.z + 1.3)
ESX.UI.HUD.SetDisplay(0.0)
StartLoop()
ShutdownLoadingScreen()
@@ -110,8 +115,8 @@ if ESX.GetConfig().Multichar then
TriggerEvent('skinchanger:loadSkin', skin)
end
DoScreenFadeIn(400)
while IsScreenFadedOut() do Citizen.Wait(100) end
end)
repeat Citizen.Wait(200) until not IsScreenFadedOut()
elseif Characters[index] and Characters[index].skin then
if Characters[Spawned] and Characters[Spawned].model then
@@ -254,20 +259,9 @@ if ESX.GetConfig().Multichar then
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(playerData, isNew, skin)
DoScreenFadeOut(100)
local spawn = playerData.coords
local playerPed = PlayerPedId()
FreezeEntityPosition(playerPed, true)
SetEntityCoords(playerPed, spawn.x, spawn.y, spawn.z-1.3, true, false, false, false)
SetEntityHeading(playerPed, spawn.heading)
Citizen.Wait(300)
SetCamActive(cam, false)
RenderScriptCams(0, 0)
DestroyAllCams(true)
DoScreenFadeIn(400)
Citizen.Wait(400)
if isNew or not skin or #skin == 1 then
local finished = false
local sex = skin.sex or 0
if sex == 0 then model = `mp_m_freemode_01` else model = `mp_f_freemode_01` end
RequestModel(model)
@@ -286,16 +280,22 @@ if ESX.GetConfig().Multichar then
TriggerEvent('esx_skin:openSaveableMenu', function()
finished = true end, function() finished = true
end)
SetEntityHeading(playerPed, spawn.heading)
end)
while not finished do Citizen.Wait(200) end
else
local playerPed = PlayerPedId()
SetEntityHeading(playerPed, spawn.heading)
TriggerEvent('skinchanger:loadSkin', skin or Characters[Spawned].skin)
playerPed = PlayerPedId()
SetEntityVisible(playerPed, true, 0)
repeat Citizen.Wait(200) until finished
end
DoScreenFadeOut(100)
repeat Citizen.Wait(200) until IsScreenFadedOut()
SetCamActive(cam, false)
RenderScriptCams(false, false, 0, true, true)
cam = nil
local playerPed = PlayerPedId()
FreezeEntityPosition(playerPed, true)
SetEntityCoords(playerPed, spawn.x, spawn.y, spawn.z-1.3, true, false, false, false)
SetEntityHeading(playerPed, spawn.heading)
if not isNew then TriggerEvent('skinchanger:loadSkin', skin or Characters[Spawned].skin) end
Citizen.Wait(400)
DoScreenFadeIn(400)
repeat Citizen.Wait(200) until not IsScreenFadedOut()
TriggerServerEvent('esx:onPlayerSpawn')
TriggerEvent('esx:onPlayerSpawn')
TriggerEvent('playerSpawned')
+2 -1
View File
@@ -2,7 +2,8 @@ Config = {}
Config.Locale = 'en'
Config.Slots = 4
Config.Spawn = vector4(-113.7, 565.3, 195.2, 0)
Config.Spawn = vector4(-113.7, 565.3, 195.2, 0) -- Sets the location for character selection
-- To set the spawn location for new characters, modify the default value in the `users` SQL table
--------------------
-- Do not use unless you are prepared to adjust your resources to correctly reset data
@@ -1,7 +1,7 @@
fx_version 'adamant'
game 'gta5'
description 'https://github.com/thelindat/esx_multicharacter'
version '1.2.1'
version '1.2.2'
dependencies {
'es_extended',
+5 -9
View File
@@ -1,8 +1,5 @@
<h3 align='center'>Although this resource is included, a more updated version <a href='https://github.com/thelindat/esx_multicharacter'>may be available</a>.</h3>
### Requirements (ensure you are using the latest)
- [ESX Legacy](https://github.com/esx-framework/es_extended/tree/legacy)
- [ESX Legacy](https://github.com/esx-framework/esx-legacy)
- [MySQL Async 3.3.2](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)
@@ -12,27 +9,26 @@
- 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
- The resource will attempt to set columns automatically
### Conflicts
* The following resources should not be used with ESX Legacy and can result in errors
- **essentialsmode**
- essentialmode
- 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
- Use a fresh spawnmanager as many people alter the code
- Ensure none of the conflicting resources are enabled
#### mysql-async duplicate entry
- You have not increased the VARCHAR size of the table holding identifiers - usually `owner` or `identifier`
#### 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)
![image](https://user-images.githubusercontent.com/65407488/126976325-17cc3241-bb9e-451f-a6ed-610a8ef52fa5.png)
### Relogging
- Do not enable this setting if you do not intend to properly set up relog support
@@ -1,5 +1,5 @@
if not ESX then
SetTimeout(3000, print('[^3WARNING^7] Unable to start Multicharacter - your version of ESX is not compatible '))
SetTimeout(3000, function() print('[^3WARNING^7] Unable to start Multicharacter - your version of ESX is not compatible ') end)
elseif ESX.GetConfig().Multichar == true then
local IdentifierTables, Fetch = {}, -1
@@ -44,12 +44,20 @@ elseif ESX.GetConfig().Multichar == true then
local DeleteCharacter = function(playerId, charid)
local identifier = Config.Prefix..charid..':'..ESX.GetIdentifier(playerId)
local counter = 0
for k, v in pairs(IdentifierTables) do
MySQL.Async.execute("DELETE FROM "..v.table.." WHERE "..v.column.." = ?", {
identifier
})
}, function()
counter = counter + 1
if counter == #IdentifierTables then
print(('[^2INFO^7] Player [%s] %s has deleted a character (%s)'):format(GetPlayerName(playerId), playerId, identifier))
Citizen.Wait(100)
SetupCharacters(playerId)
end
end)
Citizen.Wait(5)
end
print(('[^2INFO^7] Player [%s] %s has deleted a character (%s)'):format(GetPlayerName(playerId), playerId, identifier))
end
MySQL.ready(function()
@@ -106,7 +114,6 @@ elseif ESX.GetConfig().Multichar == true then
local src = source
if type(charid) == "number" and string.len(charid) <= 2 then
DeleteCharacter(src, charid)
SetupCharacters(src)
end
end)
@@ -121,5 +128,5 @@ elseif ESX.GetConfig().Multichar == true then
end, true)
else
SetTimeout(3000, print('[^3WARNING^7] Multicharacter is disabled - please check your ESX configuration'))
SetTimeout(3000, function() print('[^3WARNING^7] Multicharacter is disabled - please check your ESX configuration') end)
end