Client exportları
Diğer
Kripto değerleri, tuş atamaları, kontroller ve envanter sayıları için client export'ları.
#GetCryptoWallet
Bu oyuncunun elindeki coin'leri döndürür.
lua---@return { coin: string, symbol: string, amount: number, value: integer }[] wallet
exports['fx-phone']:GetCryptoWallet()
luafor _, entry in ipairs(exports['fx-phone']:GetCryptoWallet()) do print(entry.symbol, entry.amount, entry.value) end
value, miktarın güncel fiyatla çarpımının aşağı yuvarlanmış halidir.- Coin listesi client'ta kısa bir süre önbellekte tutulur; ilk çağrı server'a sorar ve bekler.
#GetCoinValue
Bir coin'in güncel fiyatını döndürür.
lua---@param id string coin id
---@return number|nil price nil for an unknown coin
exports['fx-phone']:GetCoinValue(id)
lualocal price = exports['fx-phone']:GetCoinValue('bitcoin')
#AddKeyBind
Oyuncunun GTA tuş atama ayarlarında yeniden atayabileceği bir tuş ekler.
lua---@class KeyBindOptions
---@field name string letters, digits and `_`
---@field description? string label in the settings, up to 60 characters
---@field key? string default key, for example 'CAPITAL'
---@field onPress? function
---@field onRelease? function
---@param opts KeyBindOptions
---@return { Remove: fun() }|nil bind
exports['fx-phone']:AddKeyBind(opts)
lualocal bind = exports['fx-phone']:AddKeyBind({
name = 'radio_ptt', description = 'Talk on the radio app', key = 'CAPITAL', onPress = function() startTalking() end,
})
optstablo değilse ya danamebaşka karakterler içeriyorsanildöndürür.- Komut
phone_<name>olarak kaydedilir.bind.Remove()tuşu devre dışı bırakır; atamanın kendisi oyun ayarlarında kalır.
#AddCheck
Telefonun açılmasını durdurabilen bir fonksiyon ekler.
lua---@param event 'openPhone'
---@param fn fun(): boolean|nil, string|nil return false to block; the optional text is shown to the player
---@return integer|nil id
exports['fx-phone']:AddCheck(event, fn)
lualocal id = exports['fx-phone']:AddCheck('openPhone', function()
if LocalPlayer.state.inJail then return false, 'Phones are not allowed here.' end
end)
- Client tarafında yalnızca
openPhoneçalışır. Server'ın daha fazla event'i vardır: bkz. Kontroller (checks). - 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)
#getQuantity
Oyuncunun bir item'dan kaç tane taşıdığını döndürür.
lua---@param item string item name
---@return integer count 0 when `item` is not a string
exports['fx-phone']:getQuantity(item)
lualocal count = exports['fx-phone']:getQuantity('water')
#hasEnoughOfItem
Oyuncunun bir item'dan en az o kadar taşıyıp taşımadığını döndürür.
lua---@param item string item name
---@param amount? integer default 1
---@return boolean enough
exports['fx-phone']:hasEnoughOfItem(item, amount)
luaif exports['fx-phone']:hasEnoughOfItem('lockpick', 2) then startLockpick() end