Server exportları

Diğer

Kontroller, config, telefon kılıfları ve aksesuarları, FXLive kanalları ve sürüm kontrolü için server export'ları.

#AddCheck

Bir oyuncunun telefonda yaptığı bir şeyi engelleyebilen bir fonksiyon ekler.

lua---@param event 'sendMessage'|'createCall'|'transfer'|'buyCrypto'|'createDarkchat'|'post'
---@param fn fun(src: integer, ...): boolean|nil return false to block
---@return integer|nil id
exports['fx-phone']:AddCheck(event, fn)
lualocal id = exports['fx-phone']:AddCheck('sendMessage', function(src, conversationId, body)
    if Player(src).state.gagged then return false end
end)
  • Her event'in argümanları Kontroller (checks) sayfasında listelenir.
  • Hata fırlatan bir kontrol hiçbir zaman engellemez. Kontroller resource'un durduğunda kaldırılır.

#RemoveCheck

Eklediğin bir kontrolü kaldırır.

lua---@param id integer
---@return boolean removed
exports['fx-phone']:RemoveCheck(id)
luaexports['fx-phone']:RemoveCheck(id)

#GetConfig

fx-phone'un ortak Config tablosunu döndürür.

lua---@return table config
exports['fx-phone']:GetConfig()
lualocal config = exports['fx-phone']:GetConfig()
  • Bu yalnızca ortak config'tir. config_server.lua'daki yalnızca server'a ait ayarlar dahil değildir.

#GetPhoneKit

Bir oyuncunun telefonundaki kılıfı ve aksesuarları döndürür.

lua---@param src integer
---@return table|nil kit
exports['fx-phone']:GetPhoneKit(src)
lualocal kit = exports['fx-phone']:GetPhoneKit(source)
if kit and kit.case then print(kit.case) end
  • Tablo takılı parçaları tutar: case, charm, strap, grip, hug, flag, sticker, deco, letters. Her değer fx-phone-assets'teki bir model adıdır.
  • Aynı tablo fxphone_kit state bag'inde de yayımlanır. Bkz. State bag'ler.

#GiveAccessory

Bir karaktere resmi mağazadan bir kılıf ya da aksesuarı ödeme almadan verir.

lua---@param identifier string
---@param model string a model name from Config.Accessories
---@return boolean given false for an unknown model, or one they already own
exports['fx-phone']:GiveAccessory(identifier, model)
luaexports['fx-phone']:GiveAccessory(citizenid, 'fx_case_battery_black')

#GetEquippedCase

Bir karakterin Kılıf uygulamasından taktığı kılıf tasarımını döndürür.

lua---@param identifier string
---@return { id: integer, title: string, design: table }|nil case
exports['fx-phone']:GetEquippedCase(identifier)
lualocal case = exports['fx-phone']:GetEquippedCase(citizenid)

#GetLiveChannel

Bir karakterin FXLive kanalını sayılarla döndürür.

lua---@param identifier string
---@return { name: string, handle: string|nil, verified: boolean, opened: boolean, followers: integer, live: boolean, totals: table }|nil channel
exports['fx-phone']:GetLiveChannel(identifier)
lualocal channel = exports['fx-phone']:GetLiveChannel(citizenid)
  • Oyuncu uygulamada bir kanal açana kadar opened false olur; o zamana kadar name karakterin adıdır ve handle nil olur.
  • live, şu anda yayında olup olmadığını söyler. totals şunları tutar: streams, viewers, likes, minutes, peak, earned ve gifts.
  • Yalnızca identifier string değilse nil döndürür. Bkz. Canlı yayın.

#SetLiveVerified

Bir FXLive kanalına doğrulama rozeti verir ya da geri alır.

lua---@param identifier string
---@param verified boolean
---@return boolean ok false only when `identifier` is not a string
exports['fx-phone']:SetLiveVerified(identifier, verified)
luaexports['fx-phone']:SetLiveVerified(citizenid, true)

#GetVersionStatus

fx-phone'un bu kopyasının güncel olup olmadığını döndürür.

lua---@return { state: 'uptodate'|'outdated'|'ahead'|'unknown'|'disabled'|'error', current: string|nil, latest: string|nil, behind: integer|nil } status
exports['fx-phone']:GetVersionStatus()
lualocal version = exports['fx-phone']:GetVersionStatus()
print(version.state, version.current, version.latest)
  • Config.VersionCheck = false olduğunda state disabled olur. behind, yüklü sürüm ile en son sürüm arasındaki sürüm sayısıdır.