Client exports
Calls and contacts
Client exports that start and end calls from the player's phone and add contacts to it.
How calls work for players is described in Calls. The server has matching exports: see Calls and contacts (server).
#CreateCall
Starts a call from this player's phone.
lua---@class CallOptions
---@field number string a phone number, or 'job:<name>' to ring a company line
---@field hideNumber? boolean true to call with a hidden number
---@field video? boolean true for a video call
---@param opts CallOptions
---@return boolean ok
---@return string|nil err
exports['fx-phone']:CreateCall(opts)
lualocal ok, err = exports['fx-phone']:CreateCall({ number = '5551234' })
- Returns
false, 'invalid'whenoptsis not a table. - Common errors:
unavailable,busy,airplane,denied(acreateCallcheck blocked it). See Error codes. - The export waits for the server's answer.
#StartVideoCall
Starts a video call and opens the Phone app.
lua---@param opts CallOptions `video` is always true
---@return boolean ok
---@return string|nil err
exports['fx-phone']:StartVideoCall(opts)
luaexports['fx-phone']:StartVideoCall({ number = '5551234' })
#EndCall
Hangs up. If a call is ringing in, it is declined.
lua---@return boolean ended false when there is no call
exports['fx-phone']:EndCall()
luaexports['fx-phone']:EndCall()
#IsInCall
Returns whether the player is in a call, ringing included.
lua---@return boolean inCall
exports['fx-phone']:IsInCall()
luaif exports['fx-phone']:IsInCall() then return end
#AddContact
Adds a contact to this player's phone.
lua---@param data { number: string, firstname: string, lastname?: string, avatar?: string }
---@return boolean ok
---@return string|nil err
exports['fx-phone']:AddContact(data)
luaexports['fx-phone']:AddContact({ number = '5550100', firstname = 'Tow', lastname = 'Service' })
avataris an image link.- Errors:
invalid,self,exists.