Skip to content

ReloadGameMode

Reloads this mode at the end of the tick, without restarting the server.

The running mode is shut down (OnGameModeExit), everything it made is torn down - zones, HUD texts, props, actors, state bags, nameplates, colours, teams, timers, SetPlayerData, the admins it promoted - and the script is read again from disk and initialised (OnGameModeInit), then told about every player again (OnPlayerConnect, OnPlayerLogin, OnPlayerSpawn). The players, their vitals, inventories, buffs, horses, drops, doors and containers stay as they are; everyone reads the game mode was reloaded: <name>. A script that fails to load leaves the built-in freeroam in charge until the next reload; a missing file refuses the reload. /reload (admins) and [gamemode] watch = true do the same.

ReloadGameMode([reason])
Parameter Type
reason string a word for the log ("the script asked" without one) (optional)

nothing

function OnPlayerCommandText(pid, cmd, args)
if cmd == "restart" and IsPlayerAdmin(pid) then
ReloadGameMode("/restart by " .. GetPlayerName(pid))
return true
end
return false
end

OnGameModeInit · OnGameModeExit · the Server and timers group of the index