[release] Character creator for Fivem

Compatible with esx_skin and skinchanger
Features:

Summary

  • Customize any Peds :
  • Mp FreeMode Peds

    1. Gender
    1. List item
    1. Inheritance
    1. Face Shape
    1. Apparence
    1. Clothes
  • Sp Male Peds

    1. Clothes
  • Sp Female Peds

  • List item

  • Mp Peds
    Comming updates:

  • Accessories

  • Tatoos

  • Camera

  • Tell me what you want to add or help me contribute on github

  • There are some little bugs some where if you found just tell me

installation : copy to resource folder and start it in server.cfg

	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
  1. https://images-ext-2.discordapp.net/external/uQQfcgywZoXWwYixOh-o4BBHMv9iEz_ADghRdJFLwgI/https/cdn.discordapp.com/attachments/586996972427280405/590266359296950410/unknown.png
  2. https://media.discordapp.net/attachments/591119949557399563/591854242969550848/unknown.png
  3. https://media.discordapp.net/attachments/591119949557399563/591854291312967703/unknown.png
7 Likes

many features don’t work. the ability to change colors isn’t there but it looks great

I couldn’t install it what the magic? Replaces all of Clotheshop and Idendity, but not recognized as ped hash

1 Like

when i try to open it opens the old menu! what is left to open the menu Father and motherimage

1 Like

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

My:
esx_identity\client\main.lua

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
1 Like

Hi,

I’ve the same thing when I try to integrate this resource :wink:
Did you find an issue ?

1 Like

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)

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

how could we use this char creator with esx_kashacters?

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 :frowning: .
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)

For your first problem i commented the following line inside esx_identity-> main.lua

TriggerEvent('esx_skin:openSaveableMenu', myIdentifiers.id) 

I’m having the same problem with the face tho

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)

Have to admit I am confused by all this? Does all of this code go into esx_identity client main.lua? why is part of it block quoted?

will this work with esx_kashacters?

1 Like

Hey, any help to how to remove that in the menu ?
Screenshot_173

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.

I am at a loss at how to make this work.

hello i need help i can deactivate bproof https://www.youtube.com/watch?v=CzO504r-cRY&feature=emb_logo

Hello there,
I think that when the character is moving is so annoying. Anyone know how to stop this MF moving?

i have installed this with esx_identity but i cannot find where to put the command line for esx identity to open character creator.

Hi ! :slight_smile: I want add more Hair in that Menu how to do that ? :confused:

i being trying to get this to work and it not working for me, where about do we put the codes in the Lua

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.