Exports and Statebags
Public API contracts (exports/statebags) for gcm_securezone.
This section intentionally covers only exports and statebags.
Exports
playerInZone() (client export)
- Context: client export
- Resource:
gcm_secureZone
Signature
lua
local inZone = exports['gcm_secureZone']:playerInZone()
Returns
booleantrue: player is currently inside a managed zone.false: player is outside all managed zones.
Usage example
lua
CreateThread(function()
while true do
local inZone = exports['gcm_secureZone']:playerInZone()
if inZone then
-- Example: disable a custom interaction while inside zones
DisableControlAction(0, 38, true)
end
Wait(0)
end
end)
Statebags
LocalPlayer.state.isLoggedIn
- Owner: local player statebag
- Where set: client load handler (
gcm_securezone:client:PlayerLoad)
Observed write in resource
lua
LocalPlayer.state.isLoggedIn = true
Read example
lua
CreateThread(function()
while true do
if LocalPlayer.state.isLoggedIn then
-- Player finished framework/resource load flow
end
Wait(1000)
end
end)
Write example
lua
-- Recommended explicit statebag write form
LocalPlayer.state:set('isLoggedIn', true, true)
Use writes carefully because this key can also be used by other resources/framework logic.