Phone System ใน FiveM — ติดตั้งและ Customize lb-phone
Phone System ใน FiveM — lb-phone
Phone system ใน FiveM เปลี่ยน server ธรรมดาให้กลายเป็น virtual world ที่มีชีวิตชีวา ผู้เล่นสามารถโทร, SMS, ถ่ายรูป และใช้ social apps ได้
lb-phone Overview
lb-phone เป็น phone resource ที่ได้รับความนิยมสูงสุด มี features:
- 📞 โทรศัพท์ และ voicemail
- 💬 SMS และ group chats
- 📷 Camera และ gallery
- 🗺️ GPS/Map
- 💰 Banking app
- 📱 Twitter-like social media (Twitchel)
การติดตั้ง
# server.cfg
ensure lb-phone
-- fxmanifest.lua ของ resource ที่ต้องการ integrate
dependencies { 'lb-phone' }
Integration — ส่ง SMS จาก Script
-- server.lua
local function SendSMS(number, message, sender)
exports['lb-phone']:sendMessage({
number = number,
message = message,
sender = sender or 'Unknown'
})
end
-- ตัวอย่าง: ส่ง SMS เมื่อมี delivery งาน
RegisterNetEvent('job:newDelivery')
AddEventHandler('job:newDelivery', function(deliveryData)
local src = source
local xPlayer = ESX.GetPlayerFromId(src)
SendSMS(
xPlayer.getMeta('phone_number'),
'งานใหม่: ส่งของไปที่ ' .. deliveryData.address .. ' ค่าจ้าง $' .. deliveryData.pay,
'ระบบงาน'
)
end)
Custom App Integration
-- สร้าง custom app ใน lb-phone
exports['lb-phone']:registerApp({
name = 'myjob', -- app ID
label = 'งานของฉัน',
icon = 'briefcase', -- lucide icon name
color = '#FFD700',
-- app เปิดใน NUI ของ script เอง
ui = 'https://cfx-nui-myjobapp/html/index.html'
})
-- เปิด app จาก event
RegisterNetEvent('phone:openJobApp')
AddEventHandler('phone:openJobApp', function()
exports['lb-phone']:openApp('myjob')
end)
Phone Number System
-- กำหนด phone number ตอน character create
local function GeneratePhoneNumber()
return string.format('%d-%04d',
math.random(100, 999),
math.random(0, 9999)
)
end
-- บันทึกเบอร์โทร
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
-- เพิ่ม contact อัตโนมัติ
exports['lb-phone']:addContact(source, {
name = 'ตำรวจฉุกเฉิน',
number = '911',
avatar = 'https://...'
})
-- Contacts สำหรับ business
exports['lb-phone']:addContact(source, {
name = 'ร้านค้า Legion',
number = '555-0100'
})
Bank App Integration
-- ส่ง transaction notification ผ่าน phone
exports['lb-phone']:sendBankNotification(source, {
type = 'debit',
amount = 500,
message = 'ซื้อสินค้าที่ร้านค้า',
balance = newBalance
})
สรุป
lb-phone เป็น feature ที่ยก immersion ของ server ขึ้นอีกระดับ การ integrate กับ scripts อื่นผ่าน exports ทำให้ทุกระบบ "connected" กัน ผู้เล่นรู้สึกเหมือนอยู่ใน 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 ง่ายขึ้นมาก