TGIANN
YoutubeDiscordTebexFivem
  • Main
    • Welcome
    • How to Find My Transaction ID
    • How can i download my script
    • How can i transfer my script
    • Whats escrow system?
    • Switching from MySQL Async to oxmysql
    • Basic Aces & Principals overview/guide
    • Using QB scripts in QBOX
    • How can i use Fivemanage
  • Common errors
    • SCRIPT ERROR: ?:-1: attempt to call a nil value
    • TGIANN-Core script is not in my keymaster account
    • You lack the required entitlement to use tgiann-*
    • Error parsing script / Failed to load script
    • Error: syntax error near '<\1>'
    • When I buy something, the money goes negative
    • Failed to verify protected resource
  • Map
    • lumi-delperropier
      • Setup
      • Conflicts
      • Disable NPC
      • Rcore Funfair Cords
      • CS-Hall Config
  • Scripts
    • tgiann-animpos-photo-cam
      • Editable Files
      • Config File
      • Exports
    • tgiann-self-storage-v2
      • Editable Files
        • Language File
        • Client Editable
        • Server Editable
      • Config File
    • tgiann-radio
      • Guides
        • Recommended settings for PMA Voice
        • How to change the animation
      • Installation
      • Config file
      • Editable Files
        • Language File
        • Client Editable
        • Server Editable
      • Exports
    • tgiann-core
      • Config file
      • Exports
      • Integration
        • QB
          • DrawText
    • tgiann-lumihud
      • Events / Exports
      • Editable Files
        • Language File
        • Client
          • playerStatus.lua
          • qbclient.lua
          • editable.lua
          • moneyEditable.lua
          • harnessBeltEditable.lua
        • Server
          • qbserver.lua
          • editable.lua
      • Config Files
        • config.lua
        • configHudSettings
        • configWeaponList.lua
        • qbStressConfig
      • Integration
        • Notify
        • Progressbar
    • tgiann-realparking
      • Events / Exports
      • Editable Files
        • Language File
        • Client
          • editable.lua
        • Server
          • editable.lua
      • Config Files
        • blipsConfig.lua
        • config.lua
        • impoundConfig.lua
        • insuranceConfig.lua
    • tgiann-vehicleshop
      • Exports
      • Editable Files
        • Language File
        • Client
          • editable.lua
        • Server
          • editable.lua
          • commands.lua
      • Config Files
    • tgiann-gps
      • Client Exports
      • Editable Files
        • config.lua
        • client/editable.lua
        • Language File
    • tgiann-clothing
      • Guides
        • Installation
          • ESX
          • QB
          • QBX
          • tgiann-inventory clothe items
        • Migration
        • How to take clothes images
      • Comman Proplems
      • Events / Exports
      • Admin Commands
      • Editable Files
        • client/editable.lua
        • server/editable.lua
      • Configs
        • blacklist
          • famale.lua
          • male.lua
        • clotheList
          • global
            • female.lua
            • male.lua
        • clothingPrice
          • female.lua
          • male.lua
        • tattoo
          • customTattoo.lua
          • tattoo.lua
        • clothingRoomsOutfits.lua
        • config.lua
        • hairOverlays.lua
        • pedList.lua
    • tgiann-inventory
      • Guides
        • Installation
          • ESX
          • QB
          • QBOX
        • How to adapt your script
        • How do money as item
          • QB
          • QBOX
          • ESX
            • ESX V11
            • ESX V12
        • Creating Items
        • Item İmages
        • Item Metadata
        • Migration
      • Common Problems
      • Exports
        • Server
        • Client
      • Hooks
      • Events
        • Server
        • Client
      • Admin Commands
      • Editable Files
        • client/editable.lua
        • client/topheader.lua
        • server/editable.lua
        • server/commands.lua
        • server/convert.lua
      • Configs
        • config.lua
        • configAmmo.lua
        • configAntiSwimingItems
        • configAttachment.lua
        • configAttachmentName.lua
        • configBlockItems.lua
        • configCarryItems.lua
        • configClotheBackpack.lua
        • configCommands.lua
        • configCraft.lua
        • configDecayableItems.lua
        • configDrop.lua
        • configEditableItems.lua
        • configFilter.lua
        • configItemStash.lua
        • configMaxStack.lua
        • configMaxUseAmount.lua
        • configMetadata.lua
        • configMetadataAdvance.js
        • configRealisticArmor.lua
        • configShop.lua
        • configStashes.lua
        • configThrowableItems.lua
        • configVendingMachine.lua
        • configWeapon.lua
    • lumi-delperropier-texonstone
      • Setup
    • tgiann-antirpf
      • Editable files
    • tgiann-secondhand
      • Editable files
      • config.lua
    • tgiann-multicharacter + spawn selector
      • Guides
        • Installation
        • Discord Permmission integration
        • Tebex integration
      • Common Problems
      • Configs
        • config.lua
        • multicharConfig.lua
        • photocamConfig.lua
        • spawnSelectorConfig.lua
      • Editable Files
        • Language File
        • client/editable.lua
        • server/editable.lua
        • server/commands.lua
    • tgiann-attachment
      • Config file
      • Event List
    • tgiann-bank
      • Migration
      • Exports
      • Config files
        • config.lua
        • configGangAccounts.lua
        • configHacking.lua
        • configJob.lua
        • configJobAccounts.lua
      • Editable Files
    • tgiann-bettercombat
      • Config file
      • Event List
    • tgiann-bobcat
      • Config file
    • tgiann-boombox
      • Config file
    • tgiann-vehiclecontrol
      • Exports
      • Config file
      • Editable Files
    • tgiann-card
      • Config file
      • QB Core Item
      • Ox Inventory Item
      • Sql File
    • tgiann-carhud
      • Config file
    • tgiann-carmod
      • Config file
      • Sql File
    • tgiann-chair
      • Config file
      • QB Core Item
    • tgiann-chopshop
      • Config file
      • QB Core Item
    • tgiann-damage-indicator
      • Config file
      • Editable files
    • tgiann-dna
      • Sql File
    • tgiann-document
      • Config file
      • QB Core Item
      • Ox Inventory Item
      • Sql File
    • tgiann-doorlock-v2
      • How can i find door model and other details
      • Config file
    • tgiann-dropweaponwhendie
      • Config file
    • tgiann-drugsell
      • Config file
    • tgiann-erpv2
      • Config file
    • tgiann-fallouthacker
      • Usage
    • tgiann-garage
      • Config file
      • Event List
      • Exports List
      • QB Sql File
      • ESX Sql File
    • tgiann-hotwire
      • Item List
      • Editable Files
        • Language File
        • Client/editable.lua
        • Client/migrate.lua
        • Server/commands.lua
      • Config file
      • Exports
    • tgiann-house
      • Stash Function
      • Common errors
      • Config file
      • Event List
      • Sql File
      • Editable Files
    • tgiann-hud
      • Config file
    • tgiann-hudv2
      • Config file
      • Event List
    • tgiann-job
      • Config file
      • Sql File
    • tgiann-market
      • Editable Files
      • Config file
      • Sql File
    • tgiann-mdt
      • Config file
      • ESX Sql File
      • QB Sql File
    • tgiann-megaphone
      • Setup
        • QB Core Item
        • Ox Inventory Item
      • Language File
      • Config file
      • Event List
      • Exports List
      • Recommended PMA Voice Settings
      • Common Problems
    • tgiann-moder-hud
      • Config file
      • Editable files
      • Event list
    • tgiann-naked
      • Config file
      • Editable Files
      • Sql File
      • Wrong Clothes
    • tgiann-platechanger
      • Config file
    • tgiann-policealert
      • Config file
      • Event List
    • tgiann-postcard
      • Editable Files
      • Config file
      • QB Core Item
      • Ox Inventory Item
    • tgiann-radio (Old)
      • Common errors
      • Config file
      • Event List
      • Exports List
      • Recommended settings for PMA Voice
    • tgiann-rentscooter
      • Config file
    • tgiann-sblauncher
      • Config file
      • QB Core Item
    • tgiann-self-storage
      • Config file
      • Editable files
      • Sql File
    • tgiann-exit-log
      • Config file
      • Editable files
    • tgiann-weapons-on-back
      • Config file
      • Editable files
    • tgiann-sellnpc
      • Config file
    • tgiann-smokegrenade
      • Config file
    • tgiann-sounds
      • Example Usage
    • tgiann-stashhouse
      • Config file
      • Sql File
    • tgiann-statushud
    • tgiann-vehicleoutfit
      • Config file
      • Sql File
    • tgiann-vehicleradio
      • Config file
      • Event list
    • tgiann-vehicleshop
      • Config file
      • Sql File
    • tgiann-trade
      • Config file
      • Server editable.lua
      • Client editable.lua
    • tgiann-zombie
      • Config file
      • Client editable.lua
      • Server editable.lua
      • Common errors
    • tgiann-planting
      • Config file
      • Editable Files
    • tgiann-realistic-car-crash
      • Config file
      • Editable Files
    • tgiann-graphic-menu
      • Config file
      • Editable Files
    • tgiann-firefighterjob
      • Installation
      • Config file
      • Editable Files
    • tgiann-coinshop
      • Config file
      • Editable Files
    • tgiann-vehiclepaint
      • Config file
      • Setup
    • tgiann-drone
      • Config file
      • Editable Files
    • tgiann-musical-chairs
      • Config file
      • Editable Files
    • tgiann-pursuitmode
      • Config file
      • Editable Files
    • tgiann-food-jobs
      • Config file
      • Editable Files
      • Example Location Config
Powered by GitBook
On this page
  1. Scripts
  2. tgiann-multicharacter + spawn selector
  3. Editable Files

client/editable.lua

function loadPedClothing(skinData, charPed)
    if not skinData?.skin then return end
    if config.tgiann_clothing then return TriggerEvent('tgiann-clothing:client:loadPedClothing', skinData.skin, charPed) end
    if config.framework == "qb" then return TriggerEvent('qb-clothing:client:loadPlayerClothing', skinData.skin, charPed) end
end

function networkSessionStarted() -- Triggered when entering the game
    exports["spawnmanager"]:setAutoSpawn(false)
end

function multiCharMenuOpened()
    MumbleSetVolumeOverride(PlayerId(), 0.0)
    ShutdownLoadingScreen()
    ShutdownLoadingScreenNui()
    if config.framework == "esx" then
        TriggerEvent("esx:loadingScreenOff")
    end
end

function spawnChar(isNewChar, selectedCharData, spawnCoords, spawnData)
    MumbleSetVolumeOverride(PlayerId(), -1.0)
    FreezeEntityPosition(PlayerPedId(), false)
    SetEntityVisible(PlayerPedId(), true)
    if config.framework == "esx" then
        local skinData = selectedCharData?.skinData
        tgiCore.cbFunction("tgiann-multichar:spawnselector:CharacterChosen", function()
            exports.spawnmanager:spawnPlayer({
                x = spawnCoords.x,
                y = spawnCoords.y,
                z = spawnCoords.z,
                heading = spawnCoords.w,
                model = skinData.model or `mp_m_freemode_01`,
                skipFade = true,
            }, function()
                if config.tgiann_clothing then
                    return
                end
                if skinData then
                    if not skinData.model then
                        if skinData.sex == "female" then
                            skin.sex = 1
                        else
                            skin.sex = 0
                        end
                    end
                    TriggerEvent("skinchanger:loadSkin", skin)
                end
            end)
        end, selectedCharData.playerData.identifier)
    elseif config.framework == "qb" then
        teleportPlayer(spawnCoords)
        if isNewChar then
            if spawnData?.isApartment then
                TriggerServerEvent("apartments:server:CreateApartment", spawnData.apartType, spawnData.apartLabel)
            end
        else
            tgiCore.cbFunction("tgiann-multichar:spawnselector:CharacterChosen", function()
                local PlayerData = tgiCore.core.Functions.GetPlayerData()
                local insideMeta = PlayerData.metadata?.inside
                if spawnData?.isLast then -- last location
                    if insideMeta.house ~= nil then
                        local houseId = insideMeta.house
                        TriggerEvent('qb-houses:client:LastLocationHouse', houseId)
                    elseif insideMeta.apartment.apartmentType ~= nil or insideMeta.apartment.apartmentId ~= nil then
                        local apartmentType = insideMeta.apartment.apartmentType
                        local apartmentId = insideMeta.apartment.apartmentId
                        TriggerEvent('qb-apartments:client:LastLocationHouse', apartmentType, apartmentId)
                    end
                elseif spawnData?.isHouse then
                    TriggerEvent('qb-houses:client:enterOwnedHouse', spawnCoords)
                    TriggerServerEvent('qb-houses:server:SetInsideMeta', 0, false)
                    TriggerServerEvent('qb-apartments:server:SetInsideMeta', 0, 0, false)
                else
                    TriggerServerEvent('qb-houses:server:SetInsideMeta', 0, false)
                    TriggerServerEvent('qb-apartments:server:SetInsideMeta', 0, 0, false)
                end
                TriggerServerEvent('QBCore:Server:OnPlayerLoaded')
                TriggerEvent('QBCore:Client:OnPlayerLoaded')
            end, selectedCharData.playerData.citizenid)
        end
    end
end

function teleportPlayer(coords)
    SetEntityCoords(PlayerPedId(), coords.x, coords.y, coords.z)
end

function takeScreenShoot()
    if GetResourceState("screenshot-basic") ~= "started" then
        print("You need screenshot-basic script")
        return false
    end
    local screenShotData = nil
    tgiCore.cbFunction("tgiann-multichar:multichar:getScreenshotWebHook", function(hook)
        if hook and hook ~= "" then
            exports['screenshot-basic']:requestScreenshotUpload(tostring(hook), "files[]", function(data)
                local image = json.decode(data)
                if image then
                    screenShotData = image.attachments[1].proxy_url
                    TriggerClientEvent("tgiann-multichar:notif", lang.photoUrlCopied, "success", 2500)
                else
                    screenShotData = false
                end
            end)
        else
            screenShotData = false
        end
    end)
    while screenShotData == nil do Wait(10) end
    return screenShotData
end

function getExtraSpawnLocations(selectedCharData)
    local data = {}
    if config.framework == "qb" then
        local waitCb = true
        tgiCore.cbFunction('tgiann-multichar:spawnselector:getOwnedHouses', function(houses)
            for i = 1, #houses do
                data[#data + 1] = {
                    label = Houses[houses[i].house].adress,
                    desc = "House",
                    icon = "house.svg",
                    coords = nil,
                    data = {
                        isHouse = true,
                    }
                }
            end
            waitCb = false
        end, selectedCharData.playerData.citizenid)
        while waitCb do Wait(10) end

        if config.qb_apartments then
            local waitCb2 = true
            tgiCore.cbFunction('apartments:GetOwnedApartment', function(result)
                if result then
                    local apartData = Apartments.Locations[result.type]
                    data[#data + 1] = {
                        label = result.label,
                        desc = "Apartment",
                        icon = "apartment.svg",
                        coords = apartData.coords.enter,
                        data = {
                            isApartment = true,
                            apartLabel = result.label,
                            apartType = result.type,
                            apartId = result.name
                        }
                    }
                    TriggerEvent('apartments:client:SetHomeBlip', result.type)
                end
                waitCb2 = false
            end, selectedCharData.playerData.citizenid)
            while waitCb2 do Wait(10) end
        end
    end
    return data
end

RegisterNetEvent("esx:playerLoaded")
AddEventHandler("esx:playerLoaded", function()
    while not tgiCore.core.GetPlayerData()?.loadout do Wait(100) end -- Wait for esx loadout
    TriggerServerEvent("esx:onPlayerSpawn")
    TriggerEvent("esx:onPlayerSpawn")
    TriggerEvent("playerSpawned")
    TriggerEvent("esx:restoreLoadout")
end)

RegisterNetEvent("tgiann-multichar:multichar:qbCharCreated")
AddEventHandler("tgiann-multichar:multichar:qbCharCreated", function()
    if config.qb_apartments and Apartments?.Starting then
        local apartSpawnmLocations = {}
        for apartType, data in pairs(Apartments.Locations) do
            apartSpawnmLocations[#apartSpawnmLocations + 1] = {
                label = data.label,
                desc = "Apartment",
                icon = "apartment.svg",
                coords = data.coords.enter,
                data = {
                    isApartment = true,
                    apartLabel = data.label,
                    apartType = apartType
                }
            }
        end
        setupSpawns(apartSpawnmLocations, false)
    else
        TriggerServerEvent('QBCore:Server:OnPlayerLoaded')
        TriggerEvent('QBCore:Client:OnPlayerLoaded')
        TriggerServerEvent('qb-houses:server:SetInsideMeta', 0, false)
        TriggerServerEvent('qb-apartments:server:SetInsideMeta', 0, 0, false)
        TriggerEvent('qb-weathersync:client:EnableSync')
        TriggerEvent('qb-clothes:client:CreateFirstCharacter')
    end
end)
PreviousLanguage FileNextserver/editable.lua

Last updated 10 months ago