if reason == "" then
TriggerEvent('mpcreator:OpenMenu') --##########Call Character creator#######
TriggerServerEvent('esx_identity:setIdentity', data, myIdentifiers)
EnableGui(false)
Citizen.Wait(500)
else
ESX.ShowNotification(reason)
end
Change this function in esx_clotheshop to call the menu for clothes
function OpenShopMenu()
HasPaid = false
ESX.TriggerServerCallback('esx_clotheshop:buyClothes', function(bought)
if bought then
HasPaid = true
TriggerEvent('mpcreator:OpenClothesMenu')
else
ESX.ShowNotification(_U('not_enough_money'))
end
end)
end
Could you explain more exactly how to integrate it into esx?
Only this does not seem to work
if reason == "" then
TriggerEvent('mpcreator:OpenMenu') --##########Call Character creator#######
TriggerServerEvent('esx_identity:setIdentity', data, myIdentifiers)
EnableGui(false)
Citizen.Wait(500)
else
ESX.ShowNotification(reason)
end
local guiEnabled = false
local myIdentity = {}
local myIdentifiers = {}
local hasIdentity = false
local isDead = false
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
AddEventHandler('esx:onPlayerDeath', function(data)
isDead = true
end)
AddEventHandler('playerSpawned', function(spawn)
isDead = false
end)
function EnableGui(state)
SetNuiFocus(state, state)
guiEnabled = state
SendNUIMessage({
type = "enableui",
enable = state
})
end
RegisterNetEvent('esx_identity:showRegisterIdentity')
AddEventHandler('esx_identity:showRegisterIdentity', function()
if not isDead then
EnableGui(true)
end
end)
RegisterNetEvent('esx_identity:identityCheck')
AddEventHandler('esx_identity:identityCheck', function(identityCheck)
hasIdentity = identityCheck
end)
RegisterNetEvent('esx_identity:saveID')
AddEventHandler('esx_identity:saveID', function(data)
myIdentifiers = data
end)
RegisterNUICallback('escape', function(data, cb)
if hasIdentity then
EnableGui(false)
else
TriggerEvent('chat:addMessage', { args = { '^1[IDENTITY]', '^1You must create your first character in order to play' } })
end
end)
RegisterNUICallback('register', function(data, cb)
local reason = ""
myIdentity = data
for theData, value in pairs(myIdentity) do
if theData == "firstname" or theData == "lastname" then
reason = verifyName(value)
if reason ~= "" then
break
end
elseif theData == "dateofbirth" then
if value == "invalid" then
reason = "Invalid date of birth!"
break
end
elseif theData == "height" then
local height = tonumber(value)
if height then
if height > 200 or height < 140 then
reason = "Unacceptable player height!"
break
end
else
reason = "Unacceptable player height!"
break
end
end
end
if reason == "" then
TriggerEvent('mpcreator:OpenMenu') --##########Call Character creator#######
TriggerServerEvent('esx_identity:setIdentity', data, myIdentifiers)
EnableGui(false)
Citizen.Wait(500)
else
ESX.ShowNotification(reason)
end
if reason == "" then
TriggerServerEvent('esx_identity:setIdentity', data, myIdentifiers)
EnableGui(false)
Citizen.Wait(500)
TriggerEvent('esx_skin:openSaveableMenu', myIdentifiers.id)
else
ESX.ShowNotification(reason)
end
end
)
Citizen.CreateThread(function()
while true do
if guiEnabled then
DisableControlAction(0, 1, true) -- LookLeftRight
DisableControlAction(0, 2, true) -- LookUpDown
DisableControlAction(0, 106, true) -- VehicleMouseControlOverride
DisableControlAction(0, 142, true) -- MeleeAttackAlternate
DisableControlAction(0, 30, true) -- MoveLeftRight
DisableControlAction(0, 31, true) -- MoveUpDown
DisableControlAction(0, 21, true) -- disable sprint
DisableControlAction(0, 24, true) -- disable attack
DisableControlAction(0, 25, true) -- disable aim
DisableControlAction(0, 47, true) -- disable weapon
DisableControlAction(0, 58, true) -- disable weapon
DisableControlAction(0, 263, true) -- disable melee
DisableControlAction(0, 264, true) -- disable melee
DisableControlAction(0, 257, true) -- disable melee
DisableControlAction(0, 140, true) -- disable melee
DisableControlAction(0, 141, true) -- disable melee
DisableControlAction(0, 143, true) -- disable melee
DisableControlAction(0, 75, true) -- disable exit vehicle
DisableControlAction(27, 75, true) -- disable exit vehicle
end
Citizen.Wait(10)
end
end)
function verifyName(name)
-- Don't allow short user names
local nameLength = string.len(name)
if nameLength > 25 or nameLength < 2 then
return 'Your player name is either too short or too long.'
end
-- Don't allow special characters (doesn't always work)
local count = 0
for i in name:gmatch('[abcdefghijklmnopqrstuvwxyzåäöABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ0123456789 -]') do
count = count + 1
end
if count ~= nameLength then
return 'Your player name contains special characters that are not allowed on this server.'
end
-- Does the player carry a first and last name?
--
-- Example:
-- Allowed: 'Bob Joe'
-- Not allowed: 'Bob'
-- Not allowed: 'Bob joe'
local spacesInName = 0
local spacesWithUpper = 0
for word in string.gmatch(name, '%S+') do
if string.match(word, '%u') then
spacesWithUpper = spacesWithUpper + 1
end
spacesInName = spacesInName + 1
end
if spacesInName > 2 then
return 'Your name contains more than two spaces'
end
if spacesWithUpper ~= spacesInName then
return 'your name must start with a capital letter.'
end
return ''
end
take out
if reason == “” then
TriggerServerEvent(‘esx_identity:setIdentity’, data, myIdentifiers)
EnableGui(false)
Citizen.Wait(500)
TriggerEvent(‘esx_skin:openSaveableMenu’, myIdentifiers.id)
else
ESX.ShowNotification(reason)
end
it should look like this
local guiEnabled = false
local myIdentity = {}
local myIdentifiers = {}
local hasIdentity = false
local isDead = false
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent(‘esx:getSharedObject’, function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
function EnableGui(state)
SetNuiFocus(state, state)
guiEnabled = state
SendNUIMessage({
type = "enableui",
enable = state
})
end
RegisterNetEvent(‘esx_identity:showRegisterIdentity’)
AddEventHandler(‘esx_identity:showRegisterIdentity’, function()
if not isDead then
EnableGui(true)
end
end)
RegisterNetEvent(‘esx_identity:saveID’)
AddEventHandler(‘esx_identity:saveID’, function(data)
myIdentifiers = data
end)
RegisterNUICallback(‘escape’, function(data, cb)
if hasIdentity then
EnableGui(false)
else
TriggerEvent(‘chat:addMessage’, { args = { ‘^1[IDENTITY]’, ‘^1You must create your first character in order to play’ } })
end
end)
RegisterNUICallback(‘register’, function(data, cb)
local reason = “”
myIdentity = data
for theData, value in pairs(myIdentity) do
if theData == “firstname” or theData == “lastname” then
reason = verifyName(value)
if reason ~= "" then
break
end
elseif theData == "dateofbirth" then
if value == "invalid" then
reason = "Invalid date of birth!"
break
end
elseif theData == "height" then
local height = tonumber(value)
if height then
if height > 200 or height < 140 then
reason = "Unacceptable player height!"
break
end
else
reason = "Unacceptable player height!"
break
end
end
end
if reason == "" then
TriggerEvent('mpcreator:OpenMenu') --##########Call Character creator#######
TriggerServerEvent('esx_identity:setIdentity', data, myIdentifiers)
EnableGui(false)
Citizen.Wait(500)
else
ESX.ShowNotification(reason)
end
–[[
if reason == “” then
TriggerServerEvent(‘esx_identity:setIdentity’, data, myIdentifiers)
EnableGui(false)
Citizen.Wait(500)
–TriggerEvent(‘esx_skin:openSaveableMenu’, myIdentifiers.id)
else
ESX.ShowNotification(reason)
end
]]–
end
function verifyName(name)
– Don’t allow short user names
local nameLength = string.len(name)
if nameLength > 25 or nameLength < 2 then
return ‘Your player name is either too short or too long.’
end
-- Don't allow special characters (doesn't always work)
local count = 0
for i in name:gmatch('[abcdefghijklmnopqrstuvwxyzåäöABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ0123456789 -]') do
count = count + 1
end
if count ~= nameLength then
return 'Your player name contains special characters that are not allowed on this server.'
end
-- Does the player carry a first and last name?
--
-- Example:
-- Allowed: 'Bob Joe'
-- Not allowed: 'Bob'
-- Not allowed: 'Bob joe'
local spacesInName = 0
local spacesWithUpper = 0
for word in string.gmatch(name, '%S+') do
if string.match(word, '%u') then
spacesWithUpper = spacesWithUpper + 1
end
spacesInName = spacesInName + 1
end
if spacesInName > 2 then
return 'Your name contains more than two spaces'
end
if spacesWithUpper ~= spacesInName then
return 'your name must start with a capital letter.'
end
return ''
Hello, I have installed this resource, and made the changes in esx_identity and the character creator appear, however the skinchanger menu appears in front of it .
I need to disable skinchanger or make any changes on that resource?
Also, when I restart the server, the character face is not saved (returns to default face)
I think the problem is that the character is not being saved on the database, so the solution is to create a function that save the character created into esx database. (I have no idea how to solve it)
I have tried following the instructions here multiple times on a new server configuration and no matter what I do the “Skin Menu” keeps coming back. Only way I have been able to stop it is to not enable “esx_skin”, “skinchanger” and “esx_clotheshop”. With any of those enabled it seem the skin menu always shows up over top of the character creator. When I have been able to create my character and log out, when I log back in I am invisible.
What controls the camera when the character is created? I am trying to change the angle that the camera shows the character during the creation cause it shows from the back.