Server side
🆔 Identify Player
Get player source id by phone number, phone imei or identifier(citizen id).
GetPlayerSourceIdByPhoneNumber
---@return string The source id of the player by phone number. Phone must be set as primary phone in the databse(e.g. last used phone)
exports.yseries:GetPlayerSourceIdByPhoneNumber(phoneNumber)
GetPlayerSourceIdByPhoneImei
---@return string The source id of the player by phone imei. Phone must be set as primary phone in the databse(e.g. last used phone)
exports.yseries:GetPlayerSourceIdByPhoneImei(phoneImei)
GetPlayerSourceIdByIdentifier
---@return string The source id of the player by identifier(citizen id). Phone must be set as primary phone in the databse(e.g. last used phone)
exports.yseries:GetPlayerSourceIdByIdentifier(phoneNumber)
Get phone number by player source id, phone imei or identifier(citizen id).
GetPhoneNumberByIdentifier
---@param identifier string The identifier of the player(citizenid, identifier)
---@return string The phone number of the player
exports.yseries:GetPhoneNumberByIdentifier(phoneNumber)
GetPhoneNumberByImei
---@param identifier string The imei of the phone
---@return string The phone number of the player
exports.yseries:GetPhoneNumberByImei(phoneNumber)
GetPhoneNumberBySourceId
---@param number string The player id
---@return number The phone number of the player
exports.yseries:GetPhoneNumberBySourceId(source)
Get phone imei by player source id, phone number or identifier(citizen id).
GetPhoneImeiByPhoneNumber
---@param phoneNumber string The phone number of the target phone
---@return string The imei of the phone
exports.yseries:GetPhoneImeiByPhoneNumber(phoneNumber)
GetPhoneImeiByIdentifier
---@param identifier string The identifier of the target player's phone
---@return string The imei of the phone
exports.yseries:GetPhoneImeiByIdentifier(phoneNumber)
GetPhoneImeiBySourceId
---@param source number The player id
---@return string The imei of the phone
exports.yseries:GetPhoneImeiBySourceId(source)
☎️ Sim Cards
RecoverSimCard
---Recover a Sim Card on a new phone(when stolen, lost).
---Note: The old phone's sim card will be changed.
---@param phoneImei number The imei of the phone that you want to recover the number to.
---@param simNumber number The sim number that you want to assign to the phone.
exports.yseries:RecoverSimCard(phoneImei, simNumber)
ChangePhoneNumber
---Change the Sim Card number for a given phone.
---The new number MUST match the phone number generation in config.
---@param phoneImei number The imei of the phone that you want to change the number.
---@param simNumber number The new sim number.
exports.yseries:ChangePhoneNumber(phoneImei, simNumber)
🌟 Groups
GetGroupLeader
---@param groupId number
---@return number Group leader's source id
exports.yseries:GetGroupLeader(groupId)
IsGroupLeader
---@param groupId number
---@param playerSrc number
---@return number true or false if the source player is group leader
exports.yseries:IsGroupLeader(groupId, playerSrc)
GetGroupMembers
---@param groupId number
---@return table Returns a table of group members(source ids and character names)
exports.yseries:GetGroupMembers(groupId)
FindGroupByMember
---@param playerSrc number
---@return number Finds a group by player source id
exports.yseries:FindGroupByMember(playerSrc)
GetJobStatus
---@param groupId number
---@return string Gets a group's job status
exports.yseries:GetJobStatus(groupId)
SetJobStatus
---@param groupId number
---@param status string
exports.yseries:SetJobStatus(groupId, status)
GetGroupMembersCount
---@param groupId number
---@return number Gets a group's current members count
exports.yseries:GetGroupMembersCount(groupId)
CreateBlipForGroup
---@param groupId number
---@param name string
---@param data table
exports.yseries:CreateBlipForGroup(groupId, name, data)
RemoveBlipForGroup
---@param groupId number
---@param name string
exports.yseries:RemoveBlipForGroup(groupId, name)
SendGroupEvent
---@param groupId number
---@param event string
---@param args table
exports.yseries:SendGroupEvent(groupId, event, args)
SetGroupData
---@param groupId number
---@param key string
---@param data table
exports.yseries:SetGroupData(groupId, key, data)
GetGroupData
---@param groupId number
---@param key string
---@return table Gets group data
exports.yseries:GetGroupData(groupId, key)
DestroyGroupData
---@param groupId number
---@param key string
exports.yseries:DestroyGroupData(groupId, key)
NotifyGroup
---Sends a Phone notification to every group member. Timeout is optional(default is 3000ms).
---@param groupId number
---@param message string
---@param timeout number
exports.yseries:NotifyGroup(groupId, message, timeout)
🌐 Cell Broadcast
Cell broadcast is a technology that allows messages (such as public alerts) to be broadcast to all mobile users in the server
---Sends a cell broadcast message.
---@param to number The recipient of the message. Source id.
---@param title string The title of the message.
---@param content string The content of the message.
---@param iconUrl string The URL of the icon to display with the message.
exports.yseries:CellBroadcast(to, title, content, iconUrl)
💵 YPay
---Adds a new transaction to display in YPay app.
---@param senderNumber number The sender of the transaction. Phone number.
---@param recipientNumber number The recipient of the transaction. Phone number.
---@param amount number The amount of the transaction.
---@param reason string The description of the transaction.
exports.yseries:YPayAddTransaction(senderNumber, recipientNumber, amount, reason)
✉️ Mail
Send Mail - Used to send a mail - Preview
SendMail
-- 'source' or 'phoneNumber' or 'phoneImei' or 'all'
local receiverType = 'all'
-- phone number or phone imei or source id or empty if `receiverType` is 'all'
local receiver = '088-888-8888'
--local receiver = GetPlayerServerId(PlayerId()) // Use it to get the source id of the player if you're using it in a client script.
-- email - table
-- email.title - string, title(subject) of the email
-- email.sender - string, email of the sender
-- email.senderDisplayName - string, display name of the sender
-- email.content - string, content of the email
-- email.actions - table(optional), button actions to add to the email
-- email.attachments - table(optional), attachments to add to the email(photo, location)
-- toType: string, type of recipient, can be "phoneNumber" or "phoneImei" or "all"
-- to: string, recipient's phone number or imei or empty if `toType` is 'all' (optional)
local insertId, received = exports.yseries:SendMail({
title = "Email title",
sender = 'phone@yflip.com',
senderDisplayName = 'YFlip Phone',
content = 'Email content',
actions = { -- actions are optional
{
label = "Accept",
data = {
event = "yseries:client:mail:test-callback",
isServer = false,
data = "test data",
-- if *true: the email tab will be closed after the callback is executed, *false: keep the email details tab open
shouldClose = true
}
},
{
label = "Decline",
data = {
event = "yseries:client:mail:test-callback",
isServer = true,
data = "test data",
shouldClose = false
}
}
},
attachments = {
{ photo = "https://i.imgur.com/2QZQ5kL.png" },
{ location = { x = 10, y = 10 } }
}
}, receiverType, receiver)
DeleteMail
---@param id string The id of the mail
---@return boolean
local success = exports.yseries:DeleteMail(id)
📪 Notifications
SendNotification
-- 'source' or 'phoneNumber' or 'phoneImei'
local receiverType = 'source'
-- phone number or phone imei or source id
local receiver = '4F2B8BDFF107B71'
-- notification - table
-- notification.app - string, app name
-- notification.title - string, title of the notification
-- notification.text - string, text of the notification
-- notification.timeout - number(optional), timeout of the notification
-- notification.icon - string(optional), icon of the notification
-- toType: string, type of recipient, can be "phoneNumber" or "phoneImei" or "source"
-- to: string, recipient's phone number or imei or playerId - source (optional)
-- returns: boolean, true if phone is disabled, false if it isn't
exports.yseries:SendNotification({
app = 'email',
title = email.senderDisplayName,
text = email.title,
timeout = 3500, -- Default is 3000(optional).
icon = 'https://cdn-icons-png.flaticon.com/128/10125/10125166.png', -- Default is the app icon, if you want custom don't send app(optional).
}, receiverType, receiver)
📵 Screen Damage
Break screen
Example of a broken phone - Preview
-- phoneImei - string, The target phone's IMEI.
-- level - number(optional), The level of damage. *default(1-9)
-- breackTouchscreen - boolean(optional), Whether the phone screen should work.
-- If the optional properties aren't passed, the function will randomize the values.
exports.yseries:BreakScreen(phoneImei, level, breakTouchscreen)
Fix screen
-- phoneImei - string, The target phone's IMEI.
exports.yseries:FixScreen(phoneImei)
🎯 Modify Nui focus input
Useful when working on custom apps and dealing with input fields.
-- focus - boolean
exports.yseries:SetNuiFocusKeepInput(focus)
Feel free to request an export to suit your needs.
Last updated