Skip to Content
ドキュメントQb DocQb Core↗ 共有エクスポート

↗ 共有エクスポート

Function or Event

Scope

Description

returns
exports[‘qb-core’]:AddItem(itemName, item)Server

Accepts an item name and item object - will add new entry to QBCore.Shared.Items

boolean, string
exports[‘qb-core’]:AddJob(jobName, job)Server

Accepts an job name and job object - will add new entry to QBCore.Shared.Jobs

boolean, string
exports[‘qb-core’]:AddGang(gangName, gang)Server

Accepts an gang name and gang object - will add new entry to QBCore.Shared.Gangs

boolean, string
exports[‘qb-core’]:AddItems(items)Server

Accepts a table or array - will loop through the table and add new entries to QBCore.Shared.Items

boolean, string, errorItem
exports[‘qb-core’]:AddJobs(jobs)Server

Accepts a table or array - will loop through the table and add new entries to QBCore.Shared.Jobs

boolean, string, errorItem
exports[‘qb-core’]:AddGangs(gangs)Server

Accepts a table or array - will loop through the table and add new entries to QBCore.Shared.Gangs

boolean, string, errorItem
QBCore.Functions.AddItem(itemName, item)Server

Accepts an item name and item object - will add new entry to QBCore.Shared.Items

boolean, string
QBCore.Functions.AddJob(jobName, Job)Server

Accepts an job name and job object - will add new entry to QBCore.Shared.Jobs

boolean, string
QBCore.Functions.AddGang(gangName, gang)Server

Accepts an gang name and gang object - will add new entry to QBCore.Shared.Gangs

boolean, string
QBCore.Functions.AddItems(items)Server

Accepts a table or array - will loop through the table and add new entries to QBCore.Shared.Items

boolean, string, errorItem
QBCore.Functions.AddJobs(jobs)Server

Accepts a table or array - will loop through the table and add new entries to QBCore.Shared.Jobs

boolean, string, errorItem
QBCore.Functions.AddGangs(gangs)Server

Accepts a table or array - will loop through the table and add new entries to QBCore.Shared.Gangs

boolean, string, errorItem
TriggerServerEvent(‘QBCore:Sever:UpdateObject’)Server

Accepts nothing - used to update the core object (PLEASE USE THE BELOW EXAMPLE)

none
TriggerClientEvent(‘QBCore:Client:UpdateObject’)Client

Accepts nothing - used to update the core object (PLEASE USE THE BELOW EXAMPLE)

none

インポートジョブ

  • この方法により、任意のリソースからコアの共有ファイルにジョブデータを挿入できます。つまり、リソースを作成し、ロード時にそれらのジョブを使用可能にすることが可能です。これは、以下に示すいずれかの方法で実現できます。この機能を使用するにはコアをインポートする必要がありますが、エクスポートを使用する場合は不要です。

[!WARNING] 読んで理解を深めてください共有.mdこれらを使用する前に構造を確認してください

[!WARNING] コアオブジェクトが必要な場合は、これらを使用する際に、リソースのクライアント側ファイルにこのコードを追加する必要があります。

RegisterNetEvent('QBCore:Client:UpdateObject', function() QBCore = exports['qb-core']:GetCoreObject() end)

[!WARNING] コアオブジェクトが必要な場合は、これらを使用する際に、リソースのサーバー側ファイルにこのコードを追加する必要があります。

RegisterNetEvent('QBCore:Server:UpdateObject', function() if source ~= '' then return false end QBCore = exports['qb-core']:GetCoreObject() end)

QBCore.Functions.AddJob

QBCore.Functions.AddJob(jobName --[[string]], job --[[table]]) -- Example QBCore.Functions.AddJob('unemployed', { label = 'Civilian', defaultDuty = true, offDutyPay = false, grades = { ['0'] = { name = 'Freelancer', payment = 10 } } })

エクスポート[‘qb-core’]:ジョブの追加

exports['qb-core']:AddJob(jobName --[[string]], job --[[table]]) -- Example exports['qb-core']:AddJob('unemployed', { label = 'Civilian', defaultDuty = true, offDutyPay = false, grades = { ['0'] = { name = 'Freelancer', payment = 10 } } })

QBCore.Functions.AddJobs

QBCore.Functions.AddJobs(jobs --[[table]]) -- Example QBCore.Functions.AddJobs({ ['unemployed'] = { label = 'Civilian', defaultDuty = true, offDutyPay = false, grades = { ['0'] = { name = 'Freelancer', payment = 10 } }, ['trucker'] = { label = 'Trucker', defaultDuty = true, offDutyPay = false, grades = { ['0'] = { name = 'Driver', payment = 50 } } })

エクスポート[‘qb-core’]:ジョブの追加

exports['qb-core']:AddJobs(jobs --[[table]]) -- Example exports['qb-core']:AddJobs({ ['unemployed'] = { label = 'Civilian', defaultDuty = true, offDutyPay = false, grades = { ['0'] = { name = 'Freelancer', payment = 10 } }, ['trucker'] = { label = 'Trucker', defaultDuty = true, offDutyPay = false, grades = { ['0'] = { name = 'Driver', payment = 50 } } })

輸入ギャング

  • この方法により、任意のリソースからコアの共有ファイルにギャングデータを挿入できます。つまり、リソースを作成し、ロード時にそれらのギャングを使用可能にすることが可能です。これは、以下に示すいずれかの方法で実現できます。この機能を使用するにはコアをインポートする必要がありますが、エクスポートを使用する場合は不要です。

QBCore.Functions.AddGang

QBCore.Functions.AddGang(gangName --[[string]], gang --[[table]]) -- Example QBCore.Functions.AddGang('azteca', { label = 'Azteca', grades = { ['0'] = { name = 'Recruit' } } })

エクスポート[‘qb-core’]:AddGang

exports['qb-core']:AddGang(gangName --[[string]], gang --[[table]]) -- Example exports['qb-core']:AddGang('azteca', { label = 'Azteca', grades = { ['0'] = { name = 'Recruit' } } })

QBCore.Functions.AddGangs

QBCore.Functions.AddGangs(gangs --[[table]]) -- Example QBCore.Functions.AddGangs({ ['lostmc'] = { label = 'Lost MC', grades = { ['0'] = { name = 'Recruit' } } }, ['ballas'] = { label = 'Ballas', grades = { ['0'] = { name = 'Recruit' } } } })

エクスポート[‘qb-core’]:AddGangs

exports['qb-core']:AddGangs(gangs --[[table]]) -- Example exports['qb-core']:AddGangs({ ['lostmc'] = { label = 'Lost MC', grades = { ['0'] = { name = 'Recruit' } } }, ['ballas'] = { label = 'Ballas', grades = { ['0'] = { name = 'Recruit' } } } })

アイテムのインポート

  • この方法により、任意のリソースからコアの共有ファイルにアイテムデータを挿入できます。つまり、リソースを作成し、ロード時にそれらのアイテムを使用可能にすることが可能です。これは、以下に示すいずれかの方法で実現できます。この機能を使用するにはコアをインポートする必要がありますが、エクスポートを使用する場合は不要です。

QBCore.Functions.AddItem

QBCore.Functions.AddItem(itemName --[[string]], item --[[table]]) -- Example QBCore.Functions.AddItem('water_bottle', { name = 'water_bottle', label = 'Bottle of Water', weight = 10, type = 'item', image = 'water_bottle.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'For all the thirsty out there' })

エクスポート[‘qb-core’]:アイテムを追加

exports['qb-core']:AddItem(itemName --[[string]], item --[[table]]) -- Example exports['qb-core']:AddItem('water_bottle', { name = 'water_bottle', label = 'Bottle of Water', weight = 10, type = 'item', image = 'water_bottle.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'For all the thirsty out there' })

QBCore.Functions.AddItems

QBCore.Functions.AddItems(items --[[table]]) -- Example QBCore.Functions.AddItems({ ['water_bottle'] = { name = 'water_bottle', label = 'Bottle of Water', weight = 10, type = 'item', image = 'water_bottle.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'For all the thirsty out there' }, ['sandwich'] = { name = 'sandwich', label = 'Sandwich', weight = 10, type = 'item', image = 'sandwich.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Nice bread for your stomach' } })

エクスポート[‘qb-core’]:アイテムの追加

exports['qb-core']:AddItems(items --[[table]]) -- Example exports['qb-core']:AddItems({ ['water_bottle'] = { name = 'water_bottle', label = 'Bottle of Water', weight = 10, type = 'item', image = 'water_bottle.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'For all the thirsty out there' }, ['sandwich'] = { name = 'sandwich', label = 'Sandwich', weight = 10, type = 'item', image = 'sandwich.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Nice bread for your stomach' } })
Last updated on