Server exportları

Bildirimler

Telefonlara bildirim gönderen ve bir oyuncuya evet / hayır sorusu soran server export'ları.

Bildirim tablosu client'takiyle aynıdır: app, title (100 karakter), content (500 karakter), icon, thumbnail, timeout (milisaniye, varsayılan 5000), sound ve data. Bkz. Bildirimler (client). ServerConfig.Upload.AllowedHosts içinde izin verilmeyen bir sunucudaki icon ya da thumbnail atılır.

#SendNotification

Bir telefona bildirim gönderir.

lua---@param target integer|string a server id (number) or a phone number (string)
---@param data PhoneNotificationData
---@return integer|nil id the saved notification's id; nil when it was only shown
exports['fx-phone']:SendNotification(target, data)
luaexports['fx-phone']:SendNotification(source, { app = 'bank', title = 'Salary', content = 'You received your pay.' })
exports['fx-phone']:SendNotification('5551234', { app = 'mail', title = 'Court', content = 'Hearing tomorrow at 18:00.' })
target türü Sonuç
number (server id) O oyuncunun telefonunda hemen gösterilir. Kaydedilmez
string (telefon numarası) O telefon için kaydedilir ve oyuncu çevrimiçi olduğunda gösterilir
  • Belirleyici olan Lua türüdür: telefon numaralarını string olarak ver, yoksa server id olarak okunurlar.
  • Bilinmeyen bir telefon numarası için nil döndürür.

#PhoneNotification

Eski script'lerin kullandığı kısa, sıralı argüman biçimiyle çevrimiçi bir oyuncuya bildirim gönderir.

lua---@param src integer
---@param title string|PhoneNotificationData a title, or one table as for SendNotification
---@param text? string
---@param icon? string
---@param timeout? number milliseconds
exports['fx-phone']:PhoneNotification(src, title, text, icon, timeout)
luaexports['fx-phone']:PhoneNotification(source, 'Dispatch', '10-31 at Legion Square', 'siren', 6000)

#NotifyEveryone

Her telefona tek bir bildirim gönderir.

lua---@param scope 'online'|'all' 'all' also saves it for every phone; anything else means 'online'
---@param data PhoneNotificationData
exports['fx-phone']:NotifyEveryone(scope, data)
luaexports['fx-phone']:NotifyEveryone('online', { app = 'news', title = 'Weazel News', content = 'Storm warning.' })

#QueueNotificationForOffline

Bir karakter için identifier ile bildirim kaydeder. Karakter çevrimiçi olduğunda hemen gösterilir.

lua---@param identifier string
---@param data PhoneNotificationData
---@return integer|nil id nil for an unknown character
exports['fx-phone']:QueueNotificationForOffline(identifier, data)
luaexports['fx-phone']:QueueNotificationForOffline(citizenid, { app = 'bank', title = 'Loan', content = 'Your payment is due tomorrow.' })

#EmergencyNotification

Telefon uygulamasının simgesiyle, acil durum olarak işaretlenmiş bir bildirim gösterir.

lua---@param src integer
---@param data { title?: string, content?: string, text?: string, icon?: string }
exports['fx-phone']:EmergencyNotification(src, data)
luaexports['fx-phone']:EmergencyNotification(source, { title = 'Emergency Alert', content = 'Leave the area now.' })
  • Yalnızca gösterilir, kaydedilmez. data tablo değilse hiçbir şey olmaz.

#DoPhoneConfirmation

Bir oyuncuya telefonunda evet / hayır sorusu sorar ve yanıtı bekler.

lua---@param src integer
---@param title string up to 100 characters
---@param text string up to 500 characters
---@param icon? string
---@return boolean accepted
exports['fx-phone']:DoPhoneConfirmation(src, title, text, icon)
luaif exports['fx-phone']:DoPhoneConfirmation(source, 'Contract', 'Sign the lease?') then signLease(source) end
  • Yalnızca oyuncu kabul ettiğinde true döndürür. Yaklaşık bir dakika içinde yanıt gelmezse false sayılır.
  • Oyuncunun telefonu yüklenmemişse hemen false döndürür.
  • Export bekler; bu yüzden bir thread'den ya da bir event handler'dan çağır.
  • Telefon ekranı başlığı 60, metni 300 karakterde keserek gösterir.