TheNinth

/tell

Jul 17th, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. # TELL in its final form, made by MazeXD and maintained by TheNinth
  2. @command # registers as a command
  3. def tell(script, name = None, *args):
  4.     if name is None or len(args) <= 0: # if either "/tell" or message isn't specified
  5.         script.connection.send_chat('Usage: /tell <player> <message>') # echo 'Usage: /tell <player> <message>' to player
  6.         return # end script
  7.     player = get_player(script.server, name) # grab the player ID proper by name specified as <player>
  8.     if player is script.connection: # if player ID is the initiator's ID
  9.         script.connection.send_chat('Cannot send private messages to yourself!') # complain
  10.         return # end script
  11.     message = '{0} -> {1}: {2}'.format(script.connection.name, player.name, ' '.join(args)) # build message
  12.     player.send_chat(message) # use send_chat on <player>
  13.     script.connection.send_chat(message) # IT WAS SUPER EFFECTIVE (echo message to intitiator)
  14.     print '[whisper] '+message # lol spy
  15. # EOF
Advertisement
Add Comment
Please, Sign In to add comment