Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // lol hi
- class Page // where to put page infos
- {
- public $from = "Mystery"; // mystery person sending you messages :o
- public $to = "God"; // lol
- public $where = "Hell"; // :B
- public $message = "GIMME A REFUND";
- function __construct($where, $from, $to, $message)
- {
- $this->where = $where;
- $this->from = $from;
- $this->to = $to;
- $this->message = $message;
- }
- function format()
- {
- $to = $this->to;
- $from = $this->from;
- $where = explode(":", $this->where, 2)[1];
- $message = $this->message;
- return "<b>$to:</b> $from sent a message to you from $where: \"$message\"";
- }
- }
- class PageModule extends extension
- {
- public $name = 'Page';
- public $version = 1;
- public $about = 'Leave messages for other users the next time they are seen.';
- public $status = true; // What da heck is this? o.O
- public $author = 'MegaLoler'; // :D
- public $type = EXT_CUSTOM;
- public $pages; // Where we put da pages :D
- function init() //mispelled function at first, lol
- {
- $this->pages = array();
- $this->addCmd('page', 'c_page'); // only command? o.o
- $this->cmdHelp('page', 'Leave a message for someone the next time they are seen.');
- $this->hook('e_recv', 'recv_msg');
- }
- function e_recv($ns, $from, $message, $target)
- {
- if(array_key_exists(strtolower($from), $this->pages)) // oh noes, they have pages!
- {
- $list = $this->pages[strtolower($from)];
- foreach($list as $p)
- {
- $this->dAmn->say($ns, $p->format());
- }
- unset($this->pages[strtolower($from)]); // throw away the pages :D
- }
- }
- function c_page($ns, $from, $message, $target) // where dey said it, who said it, what dey said, and...something, I dunno
- {
- $parts = explode(" ", $message, 3); // GO BOOM!
- if(count($parts) > 2) // exploded enough
- {
- $recipient = $parts[1];
- $msg = $parts[2];
- $p = new Page($ns, $from, $recipient, $msg);
- if(array_key_exists(strtolower($recipient), $this->pages))
- {
- array_push($this->pages[strtolower($recipient)], $p);
- }
- else
- {
- $this->pages[strtolower($recipient)] = array($p);
- }
- $this->dAmn->say($ns, "Okay, $from, I will let $recipient know that the next time I see them!");
- }
- else // didn't explide enough :noes: so complain about it :lol:
- {
- $this->dAmn->say($ns, "<b>$from:</b> The correct syntax is this: \"page [recipient] [message]\"");
- }
- }
- }
- new PageModule($core);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement