Skip to content

Entegrasyon Rehberi

Kendi scriptlerinizi Janto Phone ile nasıl entegre edebileceğinize dair örnek senaryolar aşağıdadır.

Senaryo 1: Oyuncuya Bildirim Göndermek

Bir oyuncu mesleğiyle ilgili bir görevi tamamladığında ona telefon bildirimi göndermek isteyebilirsiniz.

Server Side Örneği:

lua
-- Örnek: Kargo teslim edildiğinde
RegisterNetEvent('kargo:teslimEdildi', function()
    local src = source
    local odeme = 500

    -- Oyuncuya para ver
    -- xPlayer.addMoney(odeme) ...

    -- Bildirim Gönder
    exports['janto-phone']:SendNotification(src, {
        app = 'Lojistik',
        title = 'Teslimat Başarılı',
        content = 'Kargo teslim edildi, hesabınıza $' .. odeme .. ' yatırıldı.',
        thumbnail = 'box' -- varsa ikon adı
    })
end)

Senaryo 2: Fatura Kesme (Billing)

Polis veya mekanik scriptinizin fatura sistemini Janto Phone'un banka uygulamasına bağlamak için:

Server Side Örneği:

lua
RegisterCommand('faturaKes', function(source, args)
    local targetId = tonumber(args[1])
    local amount = tonumber(args[2])
    
    if targetId and amount then
        -- Hedef oyuncunun CitizenID'sini almanız gerekir (Framework'e göre değişir)
        local xTarget = QBCore.Functions.GetPlayer(targetId)
        local citizenId = xTarget.PlayerData.citizenid

        exports['janto-phone']:CreateInvoice(
            citizenId,
            amount,
            "police", -- Faturayı kesen kurum
            "Hız Sınırı İhlali", -- Açıklama
            "Memur Janto" -- Gönderen adı
        )
        
        print("Fatura gönderildi!")
    end
end)

Senaryo 3: Konum Paylaşma

Oyuncunun telefonuna GPS koordinatı göndermek (örneğin bir delivery job için).

Server Side Örneği:

lua
local function SendJobOffer(playerPhone, targetCoords)
    -- Şirket numarasından oyuncuya mesaj at
    exports['janto-phone']:SendCoords(
        "555-PIZZA",    -- Gönderen (String olabilir)
        playerPhone,    -- Alıcı Numara
        "Yeni bir sipariş var! Konum ektedir.",
        {
            x = targetCoords.x,
            y = targetCoords.y
        }
    )
end

Released under the MIT License.