Phone System in FiveM — Install and Customize lb-phone
Phone System in FiveM — lb-phone
The Phone system in FiveM turns a normal server into a lively virtual world. Players can call, SMS, take photos and use social apps.
lb-phone Overview
lb-phone is the most popular phone resource. It has features:
- 📞 Telephone and voicemail
- 💬 SMS and group chats
- 📷 Camera and gallery
- 🗺️ GPS/Map
- 💰 Banking app
- 📱 Twitter-like social media (Twitchel)
Installation
# server.cfg
ensure lb-phone
-- fxmanifest.lua of the resource to integrate
dependencies { 'lb-phone' }
Integration — Send SMS from Script
-- server.lua
local function SendSMS(number, message, sender)
exports['lb-phone']:sendMessage({
number = number,
message = message,
sender = sender or 'Unknown'
})
end
-- Example: Send an SMS when a job is delivered.
RegisterNetEvent('job:newDelivery')
AddEventHandler('job:newDelivery', function(deliveryData)
local src = source
local xPlayer = ESX.GetPlayerFromId(src)
SendSMS(
xPlayer.getMeta('phone_number'),
'New task: Delivery to ' .. deliveryData.address .. ' wage $' .. deliveryData.pay,
'Work system'
)
end)
Custom App Integration
-- Create custom app in lb-phone
exports['lb-phone']:registerApp({
name = 'myjob', -- app ID
label = 'My work',
icon = 'briefcase', -- lucid icon name
color = '#FFD700',
-- The app opens in the NUI of the script itself.
ui = 'https://cfx-nui-myjobapp/html/index.html'
})
-- Open app from event
RegisterNetEvent('phone:openJobApp')
AddEventHandler('phone:openJobApp', function()
exports['lb-phone']:openApp('myjob')
end)
Phone Number System
-- Set phone number when character create
local function GeneratePhoneNumber()
return string.format('%d-%04d',
math.random(100, 999),
math.random(0, 9999)
)
end
-- Save phone numbers
AddEventHandler('esx:playerLoaded', function(playerId, xPlayer)
local phone = xPlayer.getMeta('phone_number')
if not phone then
local newNumber = GeneratePhoneNumber()
xPlayer.setMeta('phone_number', newNumber)
print('Assigned phone: ' .. newNumber .. ' to ' .. xPlayer.identifier)
end
end)
Contacts Integration
-- Add contact automatically
exports['lb-phone']:addContact(source, {
name = 'Emergency Police',
number = '911',
avatar = 'https://...'
})
-- Contacts for business
exports['lb-phone']:addContact(source, {
name = 'Legion Shop',
number = '555-0100'
})
Bank App Integration
-- Send transaction notification via phone
exports['lb-phone']:sendBankNotification(source, {
type = 'debit',
amount = 500,
message = 'Buy products at the store',
balance = newBalance
})
Summary
lb-phone is a feature that takes server immersion to a whole new level. Integrating with other scripts through exports makes every system "connected" so players feel like they're actually in the world.
Related Articles
Breaking: GTA Online อัพเดท "Money Fronts" — FiveM Server Owners ต้องทำอะไร?
Rockstar ปล่อย GTA Online อัพเดท Money Fronts มีผลกระทบต่อ FiveM servers บางส่วน นี่คือสิ่งที่ต้องทำทันทีหลังอัพเดท
Community Spotlight: Script และ Projects ที่น่าสนใจจาก FiveM Community
รวม scripts, tools และ projects ที่โดดเด่นจาก FiveM community ในช่วงที่ผ่านมา ตั้งแต่ free resources ถึง open-source projects
txAdmin อัพเดทใหม่ — Dashboard, Diagnostics และ Ban System ที่ดีขึ้น
txAdmin ซึ่งตอนนี้เป็นส่วนหนึ่งของ Cfx.re อย่างเป็นทางการ ได้รับการอัพเดทครั้งใหญ่ มี features ใหม่ที่ทำให้ Server Management ง่ายขึ้นมาก