Page 1 of 1
After the administrator changes a setting, how to make it effective for everyone immediately?
Posted: Sun Mar 20, 2022 1:03 am
by sdgmlj
My script is written like this:
script.on_event(defines.events.on_runtime_mod_setting_changed, function(event)
local player = game.players[event.player_index]
layer.character_running_speed_modifier = settings.global["running_speed_modifier"].value
end)
But I found that after the modification in the game, only the administrator has the effect, and others are invalid. How can I modify it to make it effective for everyone?
It's better to be more detailed, because I don't know anything about multiplayer games: (thank you
By the way, the second question: is there an instruction that can detect whether the current game is a "stand-alone game" or a "multiplayer game"?
Re: After the administrator changes a setting, how to make it effective for everyone immediately?
Posted: Sun Mar 20, 2022 8:08 am
by sdgmlj
No one to help? This is very important to me. I have solved the first problem. I want to test whether the current game is a "stand-alone game" or a "multiplayer game". Who can tell me? Thank you
Re: After the administrator changes a setting, how to make it effective for everyone immediately?
Posted: Sun Mar 20, 2022 8:40 am
by DaveMcW
Code: Select all
script.on_event(defines.events.on_runtime_mod_setting_changed, function(event)
if event.setting ~= "running_speed_modifier" then return end
for _, player in pairs(game.players) do
player.character_running_speed_modifier = settings.global["running_speed_modifier"].value
end
end)
Re: After the administrator changes a setting, how to make it effective for everyone immediately?
Posted: Sun Mar 20, 2022 8:48 am
by steinio
sdgmlj wrote: ↑Sun Mar 20, 2022 8:08 am
No one to help? This is very important to me. I have solved the first problem. I want to test whether the current game is a "stand-alone game" or a "multiplayer game". Who can tell me? Thank you
https://lua-api.factorio.com/next/LuaGa ... ultiplayer shows if it's a multiplayergame.
Re: After the administrator changes a setting, how to make it effective for everyone immediately?
Posted: Sun Mar 20, 2022 10:46 am
by sdgmlj
DaveMcW wrote: ↑Sun Mar 20, 2022 8:40 am
Code: Select all
script.on_event(defines.events.on_runtime_mod_setting_changed, function(event)
if event.setting ~= "running_speed_modifier" then return end
for _, player in pairs(game.players) do
player.character_running_speed_modifier = settings.global["running_speed_modifier"].value
end
end)
Thank you. The problem has been solved
Re: After the administrator changes a setting, how to make it effective for everyone immediately?
Posted: Sun Mar 20, 2022 10:46 am
by sdgmlj
steinio wrote: ↑Sun Mar 20, 2022 8:48 am
sdgmlj wrote: ↑Sun Mar 20, 2022 8:08 am
No one to help? This is very important to me. I have solved the first problem. I want to test whether the current game is a "stand-alone game" or a "multiplayer game". Who can tell me? Thank you
https://lua-api.factorio.com/next/LuaGa ... ultiplayer shows if it's a multiplayergame.
Thank you. The problem has been solved