Developer
Overview
Integration uses server/client exports for radiation state, handler hooks in the open/ folder for custom logic, and a StateBag for real-time client-side access. Radiation is server-authoritative, the server only accepts increases from clients and handles all decreases internally. The mutating exports (`SetRadiation`, `AddRadiation`, `RemoveRadiation`) only accept calls from resources listed in `Config.AdminExportResources` (default: ml_radiation, ml_healthsystem, ml_staff); add your resource there to call them. `GetPlayerRadiation` is read-only and always open.
Server Exports
Radiation State
1local radiation = exports.ml_radiation:GetPlayerRadiation(source)
2exports.ml_radiation:SetRadiation(source, 500)
3exports.ml_radiation:AddRadiation(source, 100)
4exports.ml_radiation:RemoveRadiation(source, 200)
5exports.ml_radiation:RemoveRadiation(source) -- removes allGetPlayerRadiation(source): Returns current radiation level (0.0-1000.0)SetRadiation(source, level): Sets radiation to a specific value. Clamped between 0 andMaxRadiationAddRadiation(source, amount): Adds radiation to the current levelRemoveRadiation(source, amount?): Removes radiation. Ifamountis omitted, removes all radiation
Client Exports
1local radiation = exports.ml_radiation:GetRadiation()GetRadiation(): Returns the local player's current radiation level
State Bags
The player's radiation level is written to the player's own StateBag (server-side on change, client mirror every second). It is set with replication disabled, so each client reads only its own value:
1local radiation = LocalPlayer.state.radiationReadable from the local player's own client scripts without exports.
Server Handlers
Located in open/server.lua.
Item Control
1function OpenServer.BeforeGiveItem(src, item, amount)
2 return true -- return false to block
3endCalled before giving an item to the player (cure/immunity items). Return false to block.
Action Lifecycle
1function OpenServer.OnActionComplete(src, actionType, data)
2endFires after an action completes (e.g. using a cure or immunity item).
Client Handlers
Located in open/client.lua.
Interaction
1function OpenClient.BeforeOpenUI(data)
2 return true -- return false to block
3endCalled before the Geiger Counter UI opens. Return false to block.
Notifications
1function OpenClient.Notify(message, type)
2 Bridge.Notify(message, type)
3endOverride to use a custom notification system.
Shared Handlers
Located in open/shared.lua.
1function OpenHandlers.OnPlayerAction(src, data)
2 return true -- return false to block
3end
4
5function OpenHandlers.ValidateAction(src, actionType)
6 return true -- return false to block
7endOnPlayerAction: Global hook before any action. Returnfalseto block.ValidateAction: Pre-flight validation before an action is dispatched.
Commands
/movegeiger: Enter UI repositioning mode (Geiger must be open)/resetgeigerpos: Reset Geiger UI position to defaults/setradiation [level]: Sets your own radiation to a specific value (0-1000). Only registered when Config.Debug = true; it is a debug helper, not an admin command. It does not readServerConfig.AdminPermissions
Examples
1-- Server
2local rad = exports.ml_radiation:GetPlayerRadiation(source)
3if rad > 500 then
4 Bridge.NotifyPlayer(source, 'warning', 'High radiation detected!')
5end
6
7-- Client (via StateBag, no export needed)
8CreateThread(function()
9 while true do
10 local rad = LocalPlayer.state.radiation or 0
11 if rad > 750 then
12 -- trigger custom warning
13 end
14 Wait(5000)
15 end
16end)1function OpenClient.BeforeOpenUI(data)
2 local zone = GetNameOfZone(GetEntityCoords(cache.ped))
3 if zone == 'AIRP' then
4 Bridge.Notify('Cannot use Geiger here', 'error')
5 return false
6 end
7 return true
8end1-- Server: remove all radiation and add immunity via item system
2exports.ml_radiation:RemoveRadiation(source)