Code: Select all
commands.add_command("setTickRate","Sets how often the mod should scan for things. (default: 20)",
function(list)
global.tickRate = list[1]
game.player.print(global.tickRate)
end
)
Code: Select all
/setTickRate 50
Code: Select all
commands.add_command("setTickRate","Sets how often the mod should scan for things. (default: 20)",
function(list)
global.tickRate = list[1]
game.player.print(global.tickRate)
end
)
Code: Select all
/setTickRate 50
That worked perfectly, thanks!Rseding91 wrote:Commands pass a table just like events.
The table contains the following parameters:
name - the command name
player_index - the player doing the command if any
parameter - the parameters provided as a string
In your case list.parameter would == "50".
Code: Select all
commands.add_command("setRate","Sets some value to something",
function(arguments)
global.rateThing = tonumber(arguments.parameter)
game.player.print(global.rateThing )
end
)