I want to prevent my friends from using the commands
/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?
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 :
Deal damage to the players in that gamemode :
/effect @e[type=Player] 1 7 1 true /kill @player
Set that player back to the previous gamemode :
/gamemode 2 @a /deop @a
The 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 :
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.
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.