Server exportları

Kripto

Coin veren, alan ve okuyan, Kripto piyasasına kendi coin'ini ekleyen server export'ları.

coin her zaman bir coin id'sidir, örneğin 'bitcoin' ya da kendi coin'inin id'si. GetCryptoWallet ve GetCoinValue client export'ları Diğer (client) sayfasındadır.

#AddCrypto

Bir karaktere coin verir.

lua---@param identifier string
---@param coin string
---@param amount number decimal amounts are allowed
---@return boolean added
exports['fx-phone']:AddCrypto(identifier, coin, amount)
luaexports['fx-phone']:AddCrypto(citizenid, 'bitcoin', 0.5)
  • Bilinmeyen bir coin ya da geçersiz bir miktar için false döndürür.

#RemoveCrypto

Bir karakterden coin alır.

lua---@param identifier string
---@param coin string
---@param amount number
---@return boolean removed false when they do not hold enough
exports['fx-phone']:RemoveCrypto(identifier, coin, amount)
luaif exports['fx-phone']:RemoveCrypto(citizenid, 'bitcoin', 0.1) then deliver() end

#GetOwnedCoin

Bir karakterin bir coin'den ne kadar tuttuğunu döndürür.

lua---@param identifier string
---@param coin string
---@return number amount 0 when they hold none
exports['fx-phone']:GetOwnedCoin(identifier, coin)
lualocal amount = exports['fx-phone']:GetOwnedCoin(citizenid, 'bitcoin')

#GetCoin

Bir coin'i ve güncel fiyatını döndürür.

lua---@param id string
---@return { id: string, symbol: string, name: string, icon: string|nil, price: number, change24h: number, canBuy: boolean, canSell: boolean, canTransfer: boolean, history: table }|nil coin
exports['fx-phone']:GetCoin(id)
lualocal coin = exports['fx-phone']:GetCoin('bitcoin')

#AddCustomCoin

Kripto piyasasına kendi coin'ini ekler ya da onu günceller.

lua---@class CustomCoin
---@field id string
---@field symbol string
---@field name string
---@field price number
---@field icon? string
---@field change24h? number
---@field canBuy? boolean
---@field canSell? boolean
---@field canTransfer? boolean

---@param def CustomCoin
---@return boolean ok
exports['fx-phone']:AddCustomCoin(def)
luaexports['fx-phone']:AddCustomCoin({ id = 'candycoin', symbol = 'CNDY', name = 'CandyCoin', price = 12.5 })
  • Coin'i değiştirmek için aynı id ile yeniden çağır. Bir script kendi coin'inin fiyatını bu şekilde oynatır; yeni fiyat her telefona gönderilir.