Move players into a world#
local bucket = 50
exports['glitch-mapHandler']:SetBucketWorld(bucket, 'north_yankton')
SetPlayerRoutingBucket(src, bucket)
exports['glitch-mapHandler']:Sync(src)
Set the bucket world first, move the player, then call Sync so they load it right away.
End a match#
exports['glitch-mapHandler']:ClearBucketWorld(bucket)
SetPlayerRoutingBucket(src, 0)
exports['glitch-mapHandler']:Sync(src)
Survive a restart of the map handler#
AddEventHandler('glitch-mapHandler:server:ready', function()
-- restore your active buckets here
exports['glitch-mapHandler']:SetBucketWorld(50, 'north_yankton')
end)
Show one player a world#
exports['glitch-mapHandler']:SetPlayerWorld(src, 'north_yankton')
-- later, back to their bucket's world
exports['glitch-mapHandler']:SetPlayerWorld(src, nil)
A custom world in config/worlds.d#
Save as config/worlds.d/kart.lua:
Worlds.kart_circuit = {
label = 'Kart Circuit', enabled = true,
spawn = vec4(0.0, 0.0, 0.0, 0.0),
ymaps = { 'kart_circuit_main', 'kart_circuit_props' },
weather = 'EXTRASUNNY', hour = 13,
}
Put the matching map files in stream/kart_circuit/. Replace the placeholder spawn with a safe point inside your map.
Build a map picker#
for _, w in ipairs(exports['glitch-mapHandler']:ListWorlds()) do
print(w.id, w.label, w.racing)
end
React on the client#
AddEventHandler('glitch-mapHandler:client:changed', function(worldId)
print('world is now', worldId or 'city')
end)
Stuck on a step?Ask in the Discord →