Welcome, Guest. Please login or register.
Kingdoms of Ahln
Pages: [1]
  Print  
Author Topic: Temporarily disabling commands for players  (Read 457 times)
Saffire
Citizen
***
Posts: 136


View Profile
« on: November 16, 2008, 01:51:41 am »

How would I go about temporarily disabling a command so that a player cannot use it until it is re-enabled for that player? I've been attempting to do it for a couple hours, but I don't seem to be getting it, so I think it's time I called in a pro Tongue
Logged
Justin
Administrator
Citizen
*****
Posts: 189



View Profile
« Reply #1 on: November 16, 2008, 02:25:49 am »

Well, there are many ways you could go about this. Off the top of my head, modifying player.rb would probably be the best if you are doing it per-player.

I would add an info field that is an array of commands, something like disabled_commands. After the command from the player is parsed, check the resulting event against the disabled commands.

Code:
--- objects/player.rb   (revision 125)
+++ objects/player.rb   (working copy)
@@ -212,6 +212,8 @@
                        else
                                output 'Not sure what you mean by that.'
                        end
+               elsif info.disabled_commands and info.disabled_commands.include? event[:action]
+                       output "You are not allowed to do that."
                elsif @asleep and event[:action] != 'wake'
                        output 'You cannot do that when you are asleep!'
                else

You could then use the AINFO SET commands to manipulate the disabled commands (like AINFO SET bob disabled_commands :look ) but then there is the problem of having multiple disabled commands per player. Since the AINFO command would assume disabled_commands is a single value unless it was already an array, that would be a problem. So it might be easier to just add a new admin command (a very simple one) to set info.disabled_commands for a player.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.15 | SMF © 2006-2009, Simple Machines
Terra97 design by Bloc