I want to prevent my friends from using the commands /give and /gamemode, however I wish to allow them to use commands such as /tp. How could I prevent them from using these commands, without turning the allow cheats option off?
2 Answers
I have solved the TP problem by creating command blocks that when activated return players to a central "teleportation" hub. Then, from the hub, they can teleport back to any of the teleportation stations.
I suspect judicious use of command blocks should enable any other limited command use your players desire.
There is no way (for as far as I know) to check what people type in chat. There was [/testfor] source command but that was removed from the game and wouldn't exactly give you what you want.
One way I could think of would be to check for players in a certain gamemode :
[gamemode=GAMEMODE] Deal damage to the players in that gamemode :
/effect @e[type=Player] 1 7 1 true
/kill @playerSet that player back to the previous gamemode :
/gamemode 2 @a
/deop @aThe obvious drawback being that people who are allowed to be in said gamemode will also be instantly killed and de-opped.
You could (when testfor still worked) use :
/testfor @p[r=5,name=<PlayerName>]To exclude people from the above command, thus keeping people who are allowed to be op from suffering the server wrath but i'm not sure if there is a way to still get this to work.