~/paste/1356
~/paste/1356
~/paste/1356

  1. *:/mail = >>>
  2.     msg('The following commands are available')
  3.     msg('- /mail: show this message')
  4.     msg('- /mail read: real all messages')
  5.     msg('- /mail read <id>: read message <id>')
  6.     msg('- /mail clear: clear all messages')
  7. <<<
  8.  
  9. *:/mail send $player $ = >>>
  10.     assign(@mail, get_value(concat('mail_', to_lower($player))))
  11.     assign(@msg, array(player(), $));
  12.     if(is_null(@mail),assign(@mail, array()))
  13.     array_push(@mail, @msg);
  14.     store_value(concat('mail_', $player), @mail);
  15.     msg(concat(color(green), 'Mail successfully sent to ', $player, color(white)))
  16.     if(_isonline($player),tmsg($player,concat(color(green), 'You have mail! Type /mail read to view.', color(white))))
  17. <<<
  18.  
  19. *:/mail read = >>>
  20.     assign(@mail, get_value(concat('mail_', to_lower(player()))))
  21.     assign(@i, 1);
  22.     if(is_null(@mail),
  23.         msg(concat(color(red), 'You have no mail', color(white)))
  24.     ,
  25.         foreach(@mail,@msg,
  26.             if(lt(length(@msg[1]),20),
  27.                 assign(@message, @msg[1])
  28.             ,
  29.                 assign(@message, concat(substr(@msg[1], 0, 17), '...'))
  30.             )
  31.             msg(concat(@i, ') [', color(red), @msg[0], color(white),'] ', @message))
  32.             inc(@i);
  33.         )
  34.     )
  35. <<<
  36.  
  37. *:/mail read $msg = >>>
  38.     assign(@mail, get_value(concat('mail_', to_lower(player()))))
  39.     try(
  40.         msg(concat('[', color(red), @mail[subtract($msg, 1)][0],color(white),'] ', @mail[subtract($msg, 1)][1]))
  41.     ,@ex,
  42.         msg(concat(color(red), 'That message does not exist', color(white)))
  43.     )
  44. <<<
  45.  
  46. *:/mail clear = >>>
  47.     store_value(concat('mail_', to_lower(player())), null)
  48.     msg(concat(color(green), 'Mail successfully cleared', color(white)))
  49. <<<
Language: commandhelper
Posted by Anonymous at 23 Jan 2012, 08:22:26 UTC