Page cover image

โš™๏ธConfiguration

Discover how to config your script.

Files that are configurable

zr-identity/zr-config/zr-config.lua

zr-identity/zr-config/zr-build-c.lua

zr-identity/zr-config/zr-build-s.lua

To ensure you have everything you need, we are constantly updating our config files.

-- Change the framework to 'QB' or 'ESX':
zr_config.framework = 'QB'

-- If you have custom frameworks names, you can change them here:
zr_config.QB = 'qb-core'
zr_config.ESX = 'es_extended'

-- Here you can change the interior and camera coords:
zr_config.Interior = vector3(-169.286, 486.4938, 137.4436)
zr_config.PlaCoords = vector4(-176.0504, 491.7193, 133.8438, 190.9712)
zr_config.CamCoords = vector4(-176.5, 498.7330, 134.8, 12)
zr_config.EndCoords = vector4(-176.1338, 500.2804, 134.6434, 180)

-- Make it false to disable the interior loading if you have a custom map.
zr_config.ToggleInterior = true


-- You can change default spawn coords from here:
zr_config.DefaultSpawn = vector3(-1035.71, -2731.87, 12.86)

-- Here you can change the default models:
zr_config.DefaultModels = {"mp_m_freemode_01","mp_f_freemode_01"}

-- If you have bought our zr-notify script, set this to true, if not keep it false:
zr_config.zr_notify = true

zr_config.spawn = 'qb-spawn'  -- or 'ps-housing' ('zr-locations' is being used by multicharacter not identity.)

-- Only for QBcore: Disable/Enable Starting Apartment.
-- Make sure to do the same in the qb-apartments -> config.lua
-- if 'true' make sure to keep 'qb-spawn' installed in your resources.
zr_config.StartingAppartment = true 

-- Conditions for Creating character:
zr_config.maxlength = 18; -- Maximum length for names
zr_config.minlength = 2; -- Minimum Lenght for names
zr_config.zr_minYear = 1900; -- Minimum Year
zr_config.zr_maxYear = 2005; -- Maximum Year
zr_config.zr_Format = "d/m/Y"; -- Date format

-- Change it with your discord link
zr_config.discord = 'https://discord.gg/FwedjEV6kY'

-- Here you can translate the notifications messages to the language you prefer
zr_trans.notify_rls = 'Read & accept the rules first!'
zr_trans.notify_fld = 'All field are required!'
zr_trans.notify_fnm = 'First name length must be between '..zr_config.minlength..' and '..zr_config.maxlength..' characters!'
zr_trans.notify_lnm = 'Last name length must be between '..zr_config.minlength..' and '..zr_config.maxlength..' characters!'
zr_trans.notify_dat = 'Date format Invalide!'

-- Here you can translate the script to the language you prefer
zr_trans.maxch = zr_config.maxlength.." Characters Maximum."
zr_trans.miny = "Must be at least 18 years."
zr_trans.org = 'OR'
zr_trans.nat = "The country you come from."
zr_trans.hei = "Must be between 160 and 215 CM."

zr_trans.grul = "General rules"
zr_trans.grult = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
zr_trans.rrul = "Roleplay rules"
zr_trans.rrult = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
zr_trans.conf = "I confirm that I have read and accept all the server rules."

zr_trans.cancel = "Cancel"
zr_trans.create = "Create character"
zr_trans.join = "Join our discord."

zr_trans.Pfname = "FIRST NAME"
zr_trans.Plname = "LAST NAME"
zr_trans.Pdob = "DATE OF BIRTH"
zr_trans.Pnat = "NATIONALITY"
zr_trans.Phei = "HEIGHT"

-- Change the link to yours.
zr_config.discord = 'https://discord.gg/FwedjEV6kY'

Open Source part of the script that we do provide in order to make your necessary changes for your server compatibility.

function zr_identity_show_public()
	-- Trigger Custom Functions/Events when display menu.
end

function zr_identity_hide_public()
	-- Trigger Custom Functions/Events when hide menu.
end

if (zr_config.framework=='ESX') then

    RegisterNetEvent('esx:playerLoaded')
	AddEventHandler('esx:playerLoaded', function(zr_playerdata, zr_isnew, zr_skin)
		local zr_spawn = zr_playerdata.coords or zr_config.DefaultSpawn
		if zr_isnew or not zr_skin or #zr_skin == 1 then
			local done = false
			local zr_gender = zr_playerdata.sex -- local zr_gender = 'm' (https://github.com/zaphosting/esx_12)
			zr_skin = zr_config.DefaultSkins[zr_gender]
			zr_skin.sex = zr_gender == "m" and 0 or 1 
			if zr_skin.sex == 0 then zr_model = zr_config.DefaultModels[1] else zr_model = zr_config.DefaultModels[2] end
			zr_identity_loadModel(zr_model)
			SetPlayerModel(PlayerId(), zr_model)
			SetModelAsNoLongerNeeded(zr_model)
			TriggerEvent('skinchanger:loadSkin', zr_skin, function()
                TriggerEvent('esx_skin:openSaveableMenu', function()
                    done = true end, function() done = true
                end)
			end)
			repeat Wait(200) until done
		end
		DoScreenFadeOut(100)
		SetEntityCoordsNoOffset(PlayerPedId(), zr_spawn.x, zr_spawn.y, zr_spawn.z, false, false, false, true)
		SetEntityHeading(PlayerPedId(), zr_spawn.heading)
		if not zr_isnew then TriggerEvent('skinchanger:loadSkin', zr_skin) end
		Wait(400)
		DoScreenFadeIn(400)
		repeat Wait(200) until not IsScreenFadedOut()
		TriggerServerEvent('esx:onPlayerSpawn')
		TriggerEvent('esx:onPlayerSpawn')
		TriggerEvent('playerSpawned')
		TriggerEvent('esx:restoreLoadout')
        FreezeEntityPosition(PlayerPedId(), false)
	end)
end

RegisterNetEvent('zr-identity:hide', function()
    zr_identity_hide()
    if (zr_config.framework=='QB') then
        DoScreenFadeOut(500)
        Wait(2000)
        SetEntityCoords(PlayerPedId(), zr_config.DefaultSpawn.x, zr_config.DefaultSpawn.y, zr_config.DefaultSpawn.z)
        TriggerServerEvent('QBCore:Server:OnPlayerLoaded')
        TriggerEvent('QBCore:Client:OnPlayerLoaded')
        TriggerServerEvent('qb-houses:server:SetInsideMeta', 0, false)
        TriggerServerEvent('qb-apartments:server:SetInsideMeta', 0, 0, false)
        Wait(500)
        SetEntityVisible(PlayerPedId(), true)
        Wait(500)
        DoScreenFadeIn(250)
        TriggerEvent('qb-weathersync:client:EnableSync')
        if not zr_config.StartingAppartment then
            TriggerEvent('qb-clothes:client:CreateFirstCharacter')
        end
    end
end)

function zr_player_created()
    -- If you want to trigger a custom event or funtion after the character is created
end

function zr_identity_notify(zr_msg)
    if (zr_config.zr_notify) then
        exports['zr-notify']:zr_notify('info', zr_msg, 5000, 'info', 'left')
    else
        if (zr_config.framework=='QB') then
            QBcore.Functions.Notify(zr_msg, "info")
        else
            ESX.ShowNotification(zr_msg, "info", 3000)
        end
    end
end
if (zr_config.framework=='QB') then
    function zr_identity_givestartingitems(source)
        local zr_source = source
        local zr_player = QBcore.Functions.GetPlayer(zr_source)
        for _, v in pairs(QBcore.Shared.StarterItems) do
            local info = {}
            if v.item == "id_card" then
                info.citizenid = zr_player.PlayerData.citizenid
                info.firstname = zr_player.PlayerData.charinfo.firstname
                info.lastname = zr_player.PlayerData.charinfo.lastname
                info.birthdate = zr_player.PlayerData.charinfo.birthdate
                info.gender = zr_player.PlayerData.charinfo.gender
                info.nationality = zr_player.PlayerData.charinfo.nationality
            elseif v.item == "driver_license" then
                info.firstname = zr_player.PlayerData.charinfo.firstname
                info.lastname = zr_player.PlayerData.charinfo.lastname
                info.birthdate = zr_player.PlayerData.charinfo.birthdate
                info.type = "Class C Driver License"
            end
            if (zr_config.quasarInventory==true) then
                exports['qs-inventory']:AddItem(zr_source, v.item, v.amount, false, info)
            else
                zr_player.Functions.AddItem(v.item, v.amount, false, info)
            end
        end
    end

    function zr_custom_spawn_menu(zr_source, zr_fdata)
        -- custom spawn menu after character creation
    end
end

Last updated