Telefon
Sunucunun çalıştırdığı telefon script’i hangisiyse onun üzerinden telefon numaraları, mailler, mesajlar ve telefon bildirimleri.
Telefon çağrıları ai-core üzerinden gider, asla bir telefon script’inin kendi export’ları üzerinden değil. ai-core her çağrıyı çalışan ilk telefon script’ine iletir (tgiann-phone, lb-phone, gksphone ve uyumluluk listesindeki diğerleri). Hiçbir telefon çalışmıyorken her çağrı null ya da false cevabı verir.
GetPhoneNumber
Bir oyuncunun telefon numarası.
Taraf: Server · Bekler: hayır · Lib: phone.number
GetPhoneNumber(source: number): string | nulllocal number = exports['ai-core']:GetPhoneNumber(source) -- string ya da nilParametreler
Prop
Type
Dönüş değeri
string | null: telefon script’inin yazdığı haliyle numara. Oyuncunun numarası yoksa, hiçbir telefon çalışmıyorsa ya da source bir sayı değilse null.
Örnek
import { onClientCallback, resourceExport } from "@aicore-fivem/lib/server";
import { fail } from "@aicore-fivem/lib/shared";
const core = resourceExport("ai-core");
// Bir kartvizit eşyası sahibinin numarasını gösterir.
onClientCallback("myscript:myNumber", (source) => {
const number = core.GetPhoneNumber(source);
return number ? { ok: true, number } : fail("NO_PHONE_NUMBER");
});GetSourceByPhone
Bir telefon numarasına sahip çevrimiçi oyuncu.
Taraf: Server · Bekler: hayır · Lib: phone.sourceOf
GetSourceByPhone(number: string): number | nulllocal src = exports['ai-core']:GetSourceByPhone('5551234') -- sayı ya da nilParametreler
Prop
Type
Dönüş değeri
number | null: server id. O numaranın sahibi çevrimiçi değilse, numara bilinmiyorsa, hiçbir telefon çalışmıyorsa ya da number metin değilse null.
Örnek
import { notify, resourceExport } from "@aicore-fivem/lib/server";
import { Locale } from "common";
const core = resourceExport("ai-core");
/** Bir taksi mesleği, arayan çevrimiçiyse ona taksisinin yolda olduğunu söyler. */
export function cabOnTheWay(callerNumber: string): void {
const caller = core.GetSourceByPhone(callerNumber);
if (caller !== null) notify(caller, Locale("NOTIFY_CAB_COMING"), "info");
}HasPhone
Bir oyuncunun telefonu olup olmadığı (telefon eşyası isteyen telefon script’lerinde, bir tane taşıyıp taşımadığı).
Taraf: Server · Bekler: hayır · Lib: phone.hasPhone
HasPhone(source: number): booleanlocal has = exports['ai-core']:HasPhone(source)Parametreler
Prop
Type
Dönüş değeri
boolean: telefon script’i oyuncunun telefonu olduğunu söylediğinde true. Olmadığında, hiçbir telefon çalışmıyorsa ya da source bir sayı değilse false.
Örnek
import { onClientCallback, resourceExport } from "@aicore-fivem/lib/server";
import { fail } from "@aicore-fivem/lib/shared";
const core = resourceExport("ai-core");
// Görevleri mesajla dağıtan bir meslek telefon gerektirir.
onClientCallback("myscript:startDeliveries", (source) =>
core.HasPhone(source) ? { ok: true } : fail("NEED_PHONE"),
);SendPhoneMail
Bir oyuncunun telefonuna mail gönderir.
Taraf: Server · Bekler: hayır · Lib: phone.mail
SendPhoneMail(to: number | string, mail: PhoneMail): booleanlocal sent = exports['ai-core']:SendPhoneMail(source, { sender = 'LS Customs', subject = 'Invoice', message = '...' })Parametreler
Prop
Type
PhoneMail
Prop
Type
Metinler verildiği gibi gösterilir: çevrilmiş metinler ver. Bkz. PhoneMail.
Dönüş değeri
boolean: telefon script’i maili kabul ettiğinde true. Oyuncunun numarası yoksa, subject ya da message eksikse, hiçbir telefon çalışmıyorsa ya da reddettiyse false.
Örnek
import { resourceExport } from "@aicore-fivem/lib/server";
import { Locale } from "common";
const core = resourceExport("ai-core");
/** Soygun bağlantısı iş kabul edildikten sonra konumu mail atar. */
export function mailHeistLocation(source: number, street: string): void {
core.SendPhoneMail(source, {
sender: Locale("MAIL_CONTACT"),
subject: Locale("MAIL_HEIST_SUBJECT"),
message: Locale("MAIL_HEIST_BODY", street),
});
}SendPhoneMessage
Bir numaradan bir oyuncuya ya da numaraya mesaj gönderir.
Taraf: Server · Bekler: hayır · Lib: phone.message
SendPhoneMessage(from: string, to: number | string, text: string): booleanlocal sent = exports['ai-core']:SendPhoneMessage('Dispatch', source, 'Your cab is here.')Parametreler
Prop
Type
Dönüş değeri
boolean: telefon script’i mesajı kabul ettiğinde true. Alıcının numarası yoksa, from ya da text metin değilse, hiçbir telefon çalışmıyorsa ya da reddettiyse false.
Örnek
import { resourceExport } from "@aicore-fivem/lib/server";
import { Locale } from "common";
const core = resourceExport("ai-core");
/** Bir sonraki teslimat adresi mesajla gelir. */
export function textNextStop(source: number, street: string): void {
if (!core.SendPhoneMessage(Locale("SENDER_DISPATCH"), source, Locale("TEXT_NEXT_STOP", street)))
console.log(`player ${source} could not get the text`);
}PhoneNotify
Bir oyuncunun telefonunda bir bildirim gösterir.
Taraf: Server · Bekler: hayır · Lib: phone.notify
PhoneNotify(source: number, notification: PhoneNotification): booleanlocal shown = exports['ai-core']:PhoneNotify(source, { title = 'Bank', message = 'Salary paid', app = 'bank' })Parametreler
Prop
Type
PhoneNotification
Prop
Type
Bkz. PhoneNotification.
Dönüş değeri
boolean: telefon script’i gösterdiğinde true. title eksikse, hiçbir telefon çalışmıyorsa, source bir sayı değilse ya da reddettiyse false.
Örnek
import { resourceExport } from "@aicore-fivem/lib/server";
import { Locale } from "common";
const core = resourceExport("ai-core");
/** Sahibine arabasının çekildiğini söyler. */
export function towedNotice(source: number, plate: string): void {
core.PhoneNotify(source, { title: Locale("PHONE_TOW_TITLE"), message: Locale("PHONE_TOW_TEXT", plate) });
}