Skip to content

Your resource beside it

Exports and state bags is about talking to the phone. This is the other direction: the handful of things a resource should know so that the two of you are not fighting over the same player.

None of it needs a dependency, an event or permission. Four state bags and one export, and most scripts need one line.


A photograph is the whole frame. Whatever you were drawing when the shutter went — a help prompt, a marker label, a progress bar, a text UI — is in the picture, and this resource cannot stop you drawing it. Nothing of ours sits between your draw call and the screen.

So there is something to ask instead:

if LocalPlayer.state.phoneCamera then goto skip end -- or return, or whatever your loop wants

phoneCamera is true from the moment a viewfinder opens until it closes. One line and your prompt stays out of a stranger’s photo album.

The phone’s own HUD is already out of the way: the game’s minimap and health bars are hidden for as long as the camera is up, so what somebody frames is what they get.

The folding phone is two objects attached to the ped’s hand. A script that sweeps up loose props, or offers Press [E] to delete the object to whatever is nearby, will offer to delete somebody’s phone — and will do it while they are holding it.

The general rule is worth more than a model name: an object attached to a ped is not litter.

if IsEntityAttached(object) then goto skip end

If you need to be specific, the models are pear_fold_base* and pear_fold_leaf*, one per finish.

3. The ped belongs to the phone while it is out

Section titled “3. The ped belongs to the phone while it is out”

mic_phone_props owns the ped’s pose while the phone is in the hand, and it means it: there is a watchdog that puts its holding animation back within half a second of anything else taking the upper body. It cannot tell whose animation it is looking at.

If your script poses that ped — a call, a scenario, a task of your own — ask for the arms first:

exports.mic_phone_props:SetPose(false) -- they are yours; the phone hangs where a phone hangs
-- … your animation …
exports.mic_phone_props:SetPose(true) -- and back

Standing down moves the prop too: it goes to the bone and offset the game’s own prop_npc_phone_02 uses, and folds, so every stock cellphone animation works without you measuring anything. SetPose(true) gives back the grip, the hinge angle and the animation it had before.

IsOut() says whether there is anything to stand down from.

4. Item mode changes what an identifier means

Section titled “4. Item mode changes what an identifier means”

When phones are items, a phone belongs to the device rather than to the character. phoneDevice on the player is the item it lives in, and is nil in character mode.

It matters if you store anything against a phone: a number, a subscription, a licence. Use exports.mic_phone:GetDevice() and key against that, or your data follows the person when the phone was what they sold.

5. Four bags, and one command that prints them all

Section titled “5. Four bags, and one command that prints them all”
phoneOpen boolean the phone is out and on screen
phoneCamera boolean a viewfinder is up
onCallWith number | nil the source at the other end
flashlight boolean their torch is on

The full list, with the rest, is in Exports and state bags. phoneapi <id> prints every one of them for a player in the server console, which is faster than guessing which side is wrong.


A notification, a message, a mail, an invoice — all server exports, all one line, all in Exports and state bags.

A whole app of your own is your own app on it: one call, no phone config, no restart, and it runs in a frame of its own.

There is no hook for refusing to open the phone. The rules live in Config.Open.Restrict — dead, cuffed, swimming, driving and so on — and a resource cannot add one of its own. If you need a phone to be unopenable during your minigame today, the honest options are a config rule that happens to match your state, or exports.mic_phone:Close() when your thing starts. Say so if you need the hook; it is a small one to add and nobody has asked yet.


  • Does your script draw on screen? → skip it while phoneCamera
  • Does it delete, sweep or grab nearby objects? → skip attached ones
  • Does it animate the player? → SetPose(false) and SetPose(true)
  • Does it store anything per phone? → key on phoneDevice, not the character
  • Does it need to know whether somebody is reachable? → phoneOpen, onCallWith