πŸ“žCalls

CreateCall

Initiates a phone call from the client side, showing the calling screen and triggering the default call functionality. This export replicates the normal call action from the UI.

---@param targetNumber string The phone number to call
---@param options table|nil Optional: { anonymous?: boolean }
---@return boolean True if call was initiated successfully, false otherwise
local success = exports.yseries:CreateCall("0882222")

if success then
    print("Call initiated successfully")
else
    print("Failed to initiate call")
end

Validation Checks:

  • Validates target number is provided and not empty

  • Checks if trying to call yourself (returns false)

  • Checks if already in a call (returns false)

  • Checks if airplane mode is enabled (returns false)

  • Checks if service/signal is available (returns false)

Example Usage:

-- Basic call
exports.yseries:CreateCall("0882222")

-- Anonymous call
exports.yseries:CreateCall("0882222", { anonymous = true })

Note: This export will show the calling screen UI and trigger the full call flow, including validation, recent call logging, and call state management. It replicates the behavior of calling from the phone's contacts, recents, or keypad.

Note: Use CreateCall if you want to always show the calling screen UI. Use CallContact for programmatic calls without UI interaction.


IsInCall

Checks if the local player is currently in a phone call and returns the call ID if they are.

---@return boolean True if player is in a call, false otherwise
---@return number|nil CallId if player is in a call, nil otherwise
local inCall, callId = exports.yseries:IsInCall()

if inCall then
    print("Player is currently in a call with CallId: " .. tostring(callId))
else
    print("Player is not in a call")
end

Example Usage:

local inCall, callId = exports.yseries:IsInCall()

if inCall and callId then
    -- Player is in a call, you can use callId to get more details
    print("Player is in call: " .. callId)
    -- Optionally end the call
    -- exports.yseries:CancelCall()
end

CancelCall

Cancels the current active call.

exports.yseries:CancelCall()

Note: This will end the call for all participants and trigger cleanup events.


GetTargetPlayerCallStatus

Checks the call status of a target player by their phone number.

---@param targetNumber string The target phone number
---@return table Status object with busy, canCall, isOnline, inCall fields
local status = exports.yseries:GetTargetPlayerCallStatus("0882222")

if status.canCall and not status.inCall then
    print("Target can receive calls")
else
    print("Target is busy or unavailable")
end

Returns:

{
    busy = false,
    canCall = true,
    isOnline = true,
    inCall = false
}

GetCallConfig

Retrieves the call configuration settings.

---@return table Call configuration settings
local config = exports.yseries:GetCallConfig()

print("Call repeats: " .. config.CallRepeats)
print("Repeat timeout: " .. config.RepeatTimeout)

Last updated