2022-04-05 22:53:16 +00:00
|
|
|
-- name: Water Height Changer
|
|
|
|
-- description: Use /waterset and /waterget to manipulate water height.
|
|
|
|
|
2024-07-13 18:46:41 +00:00
|
|
|
local function on_get_command(msg)
|
2022-04-05 22:53:16 +00:00
|
|
|
if not network_is_server() then
|
|
|
|
djui_chat_message_create("You need to be the host!")
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
2024-07-13 18:46:41 +00:00
|
|
|
djui_chat_message_create(tostring(get_water_level(0)))
|
|
|
|
djui_chat_message_create(tostring(get_water_level(1)))
|
|
|
|
return true
|
2022-04-05 22:53:16 +00:00
|
|
|
end
|
|
|
|
|
2024-07-13 18:46:41 +00:00
|
|
|
local function on_set_command(msg)
|
2022-04-05 22:53:16 +00:00
|
|
|
if not network_is_server() then
|
|
|
|
djui_chat_message_create("You need to be the host!")
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
local num = tonumber(msg)
|
2024-07-13 18:46:41 +00:00
|
|
|
if not num then
|
|
|
|
djui_chat_message_create("Not a number!")
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
set_water_level(0, num, true)
|
|
|
|
set_water_level(1, num, true)
|
|
|
|
return true
|
2022-04-05 22:53:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
hook_chat_command("waterset", "to set the first two water levels", on_set_command)
|
|
|
|
hook_chat_command("waterget", "to get the first two water levels", on_get_command)
|