State Bags & Events
5M Phone uses FiveM Synchronized State Bags on player entities for zero-latency UI reflection and client state monitoring.
Synchronized State Bags
Available on LocalPlayer.state (client) and Player(source).state (server):
| State Bag | Type | Description |
|---|---|---|
phoneOpen | boolean | True when the full phone screen is open |
phoneNumber | string | Equipped SIM phone number (e.g. 5551234567) |
phoneName | string | Display name of the handset |
flashlight | boolean | Torch on/off state |
phoneLandscape | boolean | Whether phone is rotated in landscape |
phoneVariation | number | Case/model variation index |
speakerphone | boolean | Call speakerphone toggle |
mutedCall | boolean | Call microphone mute toggle |
onCallWith | number | Server source ID of other person on call |
callAnswered | boolean | True once active call is picked up |
instapicIsLive | boolean | True when broadcasting live on Insta |
Example State Bag Listener
Lua
AddStateBagChangeHandler('phoneOpen', nil, function(bagName, key, value, _unused, replicated)
local ply = GetPlayerFromStateBagName(bagName)
if ply and ply == PlayerId() then
if value then
-- Play custom phone holding animation
else
-- Stop animation
end
end
end)Client Network Events
Lua
RegisterNetEvent('5m_phone:phoneToggled', function(open) end)
RegisterNetEvent('5m_phone:numberChanged', function(newNumber) end)
RegisterNetEvent('5m_phone:setOnScreen', function(onScreen) end)
RegisterNetEvent('5m_phone:settingsUpdated', function(newSettings) end)
RegisterNetEvent('5m_phone:phoneDied', function() end)
RegisterNetEvent('5m_phone:birdy:newPost', function(post) end)
RegisterNetEvent('5m_phone:instapic:newPost', function(post) end)
RegisterNetEvent('5m_phone:messages:messageSent', function(data) end)
RegisterNetEvent('5m_phone:darkchat:newMessage', function(data) end)
RegisterNetEvent('5m_phone:callAnswered', function(data) end)
RegisterNetEvent('5m_phone:callEnded', function(data) end)Server Network Events
Lua
RegisterNetEvent('5m_phone:numberChanged', function(source, newNumber) end)
RegisterNetEvent('5m_phone:factoryReset', function(source, phoneNumber) end)
RegisterNetEvent('5m_phone:messages:messageSent', function(data) end)
RegisterNetEvent('5m_phone:newCall', function(data) end)
RegisterNetEvent('5m_phone:callAnswered', function(data) end)
RegisterNetEvent('5m_phone:callEnded', function(data) end)
RegisterNetEvent('5m_phone:birdy:newPost', function(post) end)
RegisterNetEvent('5m_phone:instapic:newPost', function(post) end)
RegisterNetEvent('5m_phone:darkchat:newMessage', function(data) end)
RegisterNetEvent('5m_phone:mail:mailSent', function(data) end)
RegisterNetEvent('5m_phone:onAddTransaction', function(data) end)