Tizzi / fivem-Character-Creator

40 stars 38 forks source link

Old skin menu opens together with Character Creator #9

Open Samnick86 opened 4 years ago

Samnick86 commented 4 years ago

How I can stop old skin manager? New character creation open both menu 20200519215520_2

kielerboy commented 4 years ago

whats identity use you esx_identity or jsfour-register or other ?

Westyasha commented 4 years ago

How I can stop old skin manager? New character creation open both menu 20200519215520_2

Sorry for the offtop, can you please tell me how to install this script? I don’t know where to write the code, please help.

kielerboy commented 4 years ago

installation : copy to resource folder and start it in server.cfg to call the menu add this line in esx_identity: or other identity

for jsfour-register open client.lua and find TriggerEvent('esx_skin:openSaveableMenu') and replace with TriggerEvent('mpcreator:OpenMenu')

for other identity addon search TriggerEvent('esx_skin:openSaveableMenu') and replace with TriggerEvent('mpcreator:OpenMenu')

Samnick86 commented 4 years ago

I installed this resource (copy + start in server.cfg)

I made this change here: /esx_identity/client/main.lua

` 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')
TriggerServerEvent('esx_identity:setIdentity', data, myIdentifiers) EnableGui(false) Citizen.Wait(500) else ESX.ShowNotification(reason) end

end) `

kielerboy commented 4 years ago

search TriggerEvent('esx_skin:openSaveableMenu')

Samnick86 commented 4 years ago

In /esx_identity/client/main.lua there is no "TriggerEvent('esx_skin:openSaveableMenu')"

kielerboy commented 4 years ago

ok search for register event esx_skin:openSaveableMenu and remove this

Samnick86 commented 4 years ago

if remove this line TriggerEvent('esx_skin:openSaveableMenu', myIdentifiers.id) still is opened old skin and new

    if reason == "" then
        TriggerServerEvent('esx_identity:setIdentity', data, myIdentifiers)
        EnableGui(false)
        Citizen.Wait(500)
--      TriggerEvent('esx_skin:openSaveableMenu', myIdentifiers.id)
        TriggerEvent('mpcreator:OpenMenu')
    else
        ESX.ShowNotification(reason)
    end
kielerboy commented 4 years ago

upload plz here the full client lua

Samnick86 commented 4 years ago

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
    TriggerServerEvent('esx_identity:setIdentity', data, myIdentifiers)
    EnableGui(false)
    Citizen.Wait(500)

-- TriggerEvent('esx_skin:openSaveableMenu', myIdentifiers.id) TriggerEvent('mpcreator:OpenMenu') 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 DisableControlAction(0, 245, true) -- disable chat DisableControlAction(0, 23, true) -- enter veh DisableControlAction(0, 29, true) -- b DisableControlAction(0, 311, true) -- k end Citizen.Wait(1) 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

Hajreza01 commented 1 year ago

Just remove esx_skin from resource folder then revmove from server cfg