local modstorage = core.get_mod_storage()
modstorage:set_string("switch", "0")
local player=""
while modstorage:set_string("switch")=="1" do
minetest.send_chat_message("/kick "..player)
end
core.register_chatcommand("kick_on", {
description = "enable autokick",
func = function()
modstorage:set_string("switch", "1")
end,
})
core.register_chatcommand("kick_off", {
description = "disable autokick",
func = function()
modstorage:set_string("switch", "0")
end,
})
HackerinPink wrote:@Polysaken
What am I supposed to do, change the CSM every time i want to kick another player?
local modstorage = core.get_mod_storage()
modstorage:set_string("switch", "0")
modstorage:set_string("name", "nullplayer")
local player=""
while modstorage:get_string("switch")=="1" do
minetest.send_chat_message("/kick "..modstorage:get_string("name"))
end
core.register_chatcommand("kick_on", {
description = "enable autokick",
func = function()
modstorage:set_string("switch", "1")
end,
})
core.register_chatcommand("kick_off", {
description = "disable autokick",
func = function()
modstorage:set_string("switch", "0")
end,
})
core.register_chatcommand("change_name", {
description = "modify playername to kick",
func = function(param)
modstorage:set_string("name", param)
end,
})
2019-11-22 13:28:02: ERROR[Main]: ModError: Failed to load and run script from C:\MTC\0.4.16\bin\..\clientmods\kick_csm\init.lua:
2019-11-22 13:28:02: ERROR[Main]: C:\MTC\0.4.16\bin\..\clientmods\kick_csm\init.lua:27: attempt to call field 'register_on_receiving_chat_message' (a nil value)
2019-11-22 13:28:02: ERROR[Main]: Check debug.txt for details.
HackerinPink wrote:@Polysaken
This makes things easier, but why can't it be in one command like MinionToby's??
It's over complicating things to use 2 commands to perform 1 simple function.
I'm testing MinionToby's one now... let's see if it works!
EDIT:
Bad news, it gave me a mod error. This is what I saw (copied from debug.txt)
- Code: Select all
2019-11-22 13:28:02: ERROR[Main]: ModError: Failed to load and run script from C:\MTC\0.4.16\bin\..\clientmods\kick_csm\init.lua:
2019-11-22 13:28:02: ERROR[Main]: C:\MTC\0.4.16\bin\..\clientmods\kick_csm\init.lua:27: attempt to call field 'register_on_receiving_chat_message' (a nil value)
2019-11-22 13:28:02: ERROR[Main]: Check debug.txt for details.
2019-11-28 10:52:48: ERROR[Main]: ModError: Failed to load and run script from /home/[username]/snap/minetest-luk3yx-4/97/.minetest/clientmods/kick_csm/init.lua:
2019-11-28 10:52:48: ERROR[Main]: ...etest-luk3yx-4/97/.minetest/clientmods/kick_csm/init.lua:27: attempt to call field 'register_on_receiving_chat_message' (a nil value)
2019-11-28 10:52:48: ERROR[Main]: Check debug.txt for details.
Miniontoby wrote:Please try to add the line csm_restriction_flags = 0 to the minetest.conf file for the server that you're testing with and try again.
And I'm trying to solve the problem also
PolySaken wrote:Miniontoby wrote:Please try to add the line csm_restriction_flags = 0 to the minetest.conf file for the server that you're testing with and try again.
And I'm trying to solve the problem also
This doesn't seem very safe. If your mod requires users to disable security features, it's probably not a great mod.
HackerinPink wrote:@Lone_Wolf
I'm not using 5.x, I'm using the 'luk3yx-4' fork, which allows me to play both 4.x servers and 5.x servers.
Users browsing this forum: No registered users and 0 guests