Befehle#
Befehl | Wer | Was er macht |
|---|---|---|
| Alle | Öffnet oder schließt das Handy. Auf F1 gelegt ( |
| Alle | Nimmt einen eingehenden Anruf bei geschlossenem Handy an (Q) oder lehnt ihn ab (E). |
| Alle | Halten, um mit Aura zu sprechen (B). Benötigt das Aura DLC. |
| Alle | Sendet einen Emergency SOS an diensthabende Sanitäter. |
| Jobs in | Sendet einem Spieler eine Rechnung. Nur mit dem eingebauten Billing. |
| Admins, Konsole | Vergibt oder entfernt das Verifiziert-Abzeichen bei |
| Admins, Konsole | Gibt aus, wie die Telefonnummer jedes Online-Spielers ermittelt wird. Nutze es, wenn Spieler melden, dass sie sich eine Nummer teilen. |
| Konsole | Zeigt die zwischengespeicherten Cloudflare-TURN-Server und wann sie ablaufen. |
| Konsole | Holt sofort neue Cloudflare-TURN-Zugangsdaten. |
Mit Config.Debug = true stehen außerdem einige Testbefehle zur Verfügung: /phonecall (ein eingehender Testanruf); /phonecallvideo [accept|decline|ignore] (bei diesem Testanruf, nach dem Annehmen: Die Gegenseite bittet um einen Wechsel zu Video oder beantwortet deine eigene Anfrage so, wie du es wählst); /phonenotify [id|number|me] [app] [message] (eine Testbenachrichtigung; ohne Ziel oder mit me geht sie an dich); und /phoneseed (füllt dein Handy mit Beispieldaten). Schalte Debug auf einem Live-Server aus.
Client-Exports#
Export | Gibt zurück | Was er macht |
|---|---|---|
| boolean | Ob das Handy offen ist. |
| — | Sperrt das Handy ( |
| boolean | Ob das Handy gesperrt ist. |
| boolean | Öffnet eine App, während das Handy offen ist. |
| table | Startet einen |
| string |
|
| — | Fügt ein Ladegerät in einem Haus hinzu. |
| — | Entfernt es. |
-- Block the phone while the player is in jail
exports['qs-smartphone']:ToggleDisabled(true)
-- Start a call from your script
local result = exports['qs-smartphone']:call('555-0100', 'audio', {
callerNumberOverride = '555-9999', -- optional
})
if not result.success then
print(result.error, result.message)
end
-- House charger for qs-housing
exports['qs-smartphone']:BatteryRegisterHousingCharger(houseId, vector3(x, y, z), 2.0)Dynamic Island#
Zeige deine eigene Pill in der Dynamic Island. Sie konkurriert mit denen des Handys über priority: Anrufe 100, Nearby Sharing 90, Timer 70, Musik 60, eigene standardmäßig 50.
exports['qs-smartphone']:showDynamicIsland({
id = 'delivery-status',
icon = 'tram_fill', -- Framework7 icon name
title = 'Delivery',
subtitle = 'On the way',
color = '#22c55e',
progress = 45, -- optional 0-100 bar
priority = 65,
duration = 8000, -- optional auto-hide (ms)
persistent = true, -- stays when the phone closes
expandedContent = {
lines = { { label = 'ETA', value = '4 min' } },
actions = { { id = 'track', label = 'Track', icon = 'map' } },
},
onClick = function() end,
onDismiss = function() end,
})
exports['qs-smartphone']:updateDynamicIsland('delivery-status', { progress = 80 })
exports['qs-smartphone']:hideDynamicIsland('delivery-status')
AddEventHandler('phone:dynamicIsland:action', function(islandId, actionId)
if islandId == 'delivery-status' and actionId == 'track' then
-- set a waypoint
end
end)Außerdem verfügbar: getDynamicIsland(id), getAllDynamicIslands() und hasDynamicIsland(). Islands werden entfernt, wenn deine Ressource stoppt.
Eigene Apps#
Export | Was er macht |
|---|---|
| Registriert eine App. Gibt |
| Registriert mehrere Apps auf einmal. |
| Ändert Felder, zum Beispiel |
| Entfernt eine App. |
| Listet jede registrierte App. |
Server-Exports#
Handy und Benachrichtigungen#
-- The player's active number
local number = exports['qs-smartphone']:GetCurrentPhoneNumber(source)
-- The player's phone id (device), needed for notifications by scope
local scopeId = exports['qs-smartphone']:getPhoneScopeIdentifier(source)
-- Push notification to a player
exports['qs-smartphone']:sendPhoneNotification(source, {
appId = 'my_app',
title = 'New order',
text = 'Your package is ready for pickup.',
closeTimeout = 5000,
})
-- Same, by phone id
exports['qs-smartphone']:sendPhoneNotificationToScope(scopeId, { appId = 'my_app', title = 'Hello', text = 'World' })
-- Block or allow a player's phone
exports['qs-smartphone']:ToggleDisabled(source, true)Bei einem Fehler geben die Benachrichtigungs-Exports false und einen Fehlercode zurück: INVALID_SOURCE, NO_SCOPE (der Spieler hat kein aktives Handy) oder INVALID_PAYLOAD.
Nachrichten#
SendNewMessageFromApp legt eine SMS in die Nachrichten-App, von einem Absender, den du benennst (eine Bank, das Rathaus, dein Job). Die Nachricht wird auch gespeichert, wenn der Spieler offline ist.
-- Short form: by number or by player id
exports['qs-smartphone']:SendNewMessageFromApp('555-0100', 'Bank', 'Your account has been credited with $500.')
exports['qs-smartphone']:SendNewMessageFromApp(source, 'Job Center', 'Your application has been approved.')
-- Full form
local result = exports['qs-smartphone']:SendNewMessageFromApp({
source = source, -- or targetPhone = '555-0100'
appLabel = 'City Hall', -- sender name
message = 'You have been hired as a mechanic.', -- max 4096 characters
requireOnline = false, -- true = fail if the player is offline
push = { title = 'City Hall', text = 'You have a new message' }, -- false = no notification
})
if not result.ok then
print(result.error) -- e.g. TARGET_PHONE_NOT_FOUND
endUm Unterhaltungen zu lesen (zum Beispiel von einer Smartwatch), nutze GetMessageConversations(source | number | { source, limit, cursor }), GetThreadMessages({ source, threadId, limit, beforeMessageId }) und GetMessageUnreadCount(source). Jeder gibt { ok = true, ... } zurück und zeigt nur Threads, zu denen die Nummer gehört.
Mail#
System-E-Mail in den Mail-Posteingang eines Spielers. Der Spieler muss auf dem Handy einen Mail-Account erstellt haben.
-- Short form
exports['qs-smartphone']:SendMail(source, 'Parking fine', 'You have been fined $500.', 'City Hall')
exports['qs-smartphone']:SendMail('[email protected]', 'Welcome', 'Thanks for joining the server.')
-- Full form
local result = exports['qs-smartphone']:SendMail({
targetSource = source, -- or to = '[email protected]' / { ... }, or targetIdentifier
subject = 'Service notice', -- max 500 characters
body = 'Your impound fee is due.', -- max 60000 characters
fromName = 'LSPD',
fromEmail = '[email protected]',
push = true, -- false = no notification
})
-- Does the player have a Mail account?
local account = exports['qs-smartphone']:GetMailAccount(source) -- nil, or { id, email, displayName, ownerIdentifier }Fehler: MAIL_ACCOUNT_NOT_FOUND, INVALID_RECIPIENTS, INVALID_BODY, BODY_TOO_LONG, SUBJECT_TOO_LONG, SEND_FAILED.
Rechnungen#
-- Built-in billing only; with another billing script use its own API
local billId, err = exports['qs-smartphone']:CreateBill(targetSource, {
title = 'EMS',
subtitle = 'Medical treatment',
price = 500,
job = 'ambulance', -- uses Config.BillingJobs.ambulance as the icon
avatar = 'f7:cross_case_fill', -- optional
})
local bills = exports['qs-smartphone']:GetBills(source) -- { { id, title, subtitle, price, avatar, job }, ... }
local ok = exports['qs-smartphone']:PayBill(source, billId)Marketplace-Dienst#
Steuere den Marketplace-Status "Enter service" aus deinem Job-Script. Nutze Framework-Jobnamen; das Handy findet den Shop in config/marketplace.lua.
Export | Gibt zurück |
|---|---|
| Ob ein Shop diesen Job nutzt. |
| Ob der Spieler im Dienst ist. |
| Der Job, für den er im Dienst ist, oder nil. |
| Für diesen Job einstempeln oder ohne Job ausstempeln. |
| Ob jemand für diesen Job im Dienst ist. |
Item-Benutzung im Inventar#
Für Inventare, die beim Benutzen eines Items einen Export aufrufen (ox_inventory, qs-inventory): qs-smartphone.useItem (Handys), qs-smartphone.useSimCard, qs-smartphone.usePowerbank und qs-smartphone.useWirelessEarbuds. Siehe Installation.
Call Interception#
Führe deinen eigenen Code aus, bevor ein Anruf klingelt: Baue Geschäftsleitungen, Telefonmenüs, Anruflogs oder Job-Dispatch. Die eingebauten Servicenummern (911…) nutzen dasselbe System. Ein vollständiges Beispiel liegt in [examples]/phone-business-line.
exports['qs-smartphone']:registerCallInterceptor('555-1234', function(callData)
-- callData: sessionId, callerSource, callerNumber, callerDisplayName,
-- calleeSource, calleeNumber, calleeDisplayName, callType
return { action = 'allow' } -- ring normally
-- return { action = 'reject' } -- reject silently
-- return { action = 'handle' } -- hold the call; you accept or reject it within 30 s
-- return { action = 'reroute', reroute_target = playerId }
-- return { action = 'reroute', reroute_targets = { id1, id2 }, reroute_label = 'Mechanic' }
end, { priority = 10 })
-- '*' sees every call (runs after the specific numbers)
exports['qs-smartphone']:registerCallInterceptor('*', function(callData)
print(('[CALL] %s -> %s'):format(callData.callerNumber, callData.calleeNumber))
return { action = 'allow' }
end, { priority = -100 })Export | Was er macht |
|---|---|
| Verbindet einen gehaltenen Anruf. |
| Lehnt ihn ab. |
| Lässt ihn bei der ursprünglichen Nummer klingeln. |
| Die Daten des gehaltenen Anrufs. |
| Entfernt deinen Interceptor. Passiert auch, wenn deine Ressource stoppt. |
| Prüfe, was registriert ist. |
| Ob der Spieler in einem Anruf ist. |
| Der aktuelle Anruf: |
| Legt den Anruf des Spielers auf. |
Events#
Höre mit AddEventHandler darauf. Es sind lokale Events; registriere sie nicht mit RegisterNetEvent.
Event | Seite | Wann |
|---|---|---|
| Client, Server | Das Handy wurde geöffnet. Client: |
| Client, Server | Das Handy wurde geschlossen. |
| Client | Ein Anruf kommt an oder sein Status ändert sich. |
| Client | Der Spieler hat das Handy-Item benutzt. |
| Client | Der Spieler hat zu einem anderen Handy-Item gewechselt. |
| Client | Ein Button auf deiner Dynamic Island wurde gedrückt. |
| Server | Der Marketplace-Dienst hat sich geändert: |
| Server | Die Schritte eines abgefangenen Anrufs. |
-- Hide your HUD while the phone is open
AddEventHandler('phone:opened', function(payload)
if payload.mode == 'full' then
-- hide HUD
end
end)
AddEventHandler('phone:closed', function(payload)
-- show HUD
end)Für eine einmalige Prüfung ist
exports['qs-smartphone']:IsPhoneOpen()einfacher, als die Events zu verfolgen.



