Main Menu

Help for Lua Action

Started by Maelus999, May 13, 2023, 03:00 PM

Previous topic - Next topic

Maelus999

Hi ^^
i want ban player but i can't. How can i do this actions?
(this is my code)
elseif table["commande"] == "ban" then
            GetBanData()
            m.setCursorPos(1, 7)
            m.write("[Discord] -> Ban executer!");
            m.setCursorPos(1, 8)
            m.write("[Discord] -> Le joueur "..table["options"][1].." a etait ban");
            m.setCursorPos(1, 9)
            m.write("avec comme raison "..table["options"][2]..".");
            commands.exec("execute run ban "..playerbanned.." "..ReasonOfPlayerBan)
            commands.exec("say "..playerbanned.." "..ReasonOfPlayerBan)
            AntiSpamBan()

PS : I use a command computer and CC:Tweaked 1.19.4

SamH

Your code seems right but it is how Minecraft deals with admin commands. Even with a command block on my server I can't ban players. Minecraft probably restricts admin commands inside command blocks because none op hackers can summon command blocks with commands inserted that could ban players if allowed.
A command computer is basically a command block with a computer craft terminal attached on top.