function work(pl, pos) {
if(pl.get_name()!=player_x(1).get_name()) {
return "This tool must be run as public player"
}
...
}Quote from: prissi on June 30, 2026, 08:35:40 AMOr you can use the trick of the testcode, and restore the budget after each build ...No, doesn't workpl.book_cash(amount - pl.get_current_net_wealth())
Quoteif (scenario) {
/**
* Change bank account of player by given amount @p delta.
* @param delta
* @ingroup scen_only
*/
register_method(vm, player_book_account, "book_cash", true);
}
Quotelocal werkzeug = command_x(tool_switch_player)command_x(tool_switch_player) doesn't work at all
local is_ok = werkzeug.work(publicPlayer,p1,"")

local [b]public_pl = player_x(1)[/b]
local factory_builder = command_x(tool_build_factory)
return factory_builder.work([b]public_pl[/b], pos, "" + ignore_climates.tointeger() + rotation + base_prod + "," + name)public_pl is ignoredQuote from: prissi on June 30, 2026, 08:35:40 AMOr you can use the trick of the testcode, and restore the budget after each build ...Ok this trick is a solution i think.pl.book_cash(amount - pl.get_current_net_wealth())
function build_factory(pos, ignore_climates, rotation, base_prod, name)
{
local public_pl = player_x(1)
local factory_builder = command_x(tool_build_factory)
return factory_builder.work(public_pl, pos, "" + ignore_climates.tointeger() + rotation + base_prod + "," + name)
}
pl.get_name() == player_x(1).get_name() then you are the public player.pl.book_cash(amount - pl.get_current_net_wealth())