This is my first of hopefully many plugins,
It is very simple but useful nonetheless.
The purpose of the plugin is to display the
rules to the player that uses the command /rules
Next realease hopefully you will be able to modify
the rules directly in-game : )
if you modify the plugin i would love to see how you
all use it just post the modified code here : )
CODE
<?php
/*
__PocketMine Plugin__
name=Rules
description=Displays current server rules.
version=0.1.1
author=iParadox
class=Rules
apiversion=9
*/
class Rules implements Plugin{
private $api, $path;
public function __construct(ServerAPI $api, $server = false){
$this->api = $api;
}
public function init(){
$this->api->console->register("rules", "Displays rules to user", array($this, "Rules"));
$this->api->ban->cmdWhitelist("rules"); // Non OPs can use the command too
$this->path = $this->api->plugin->configPath($this);
$this->msgs = new Config($this->path."msgs.yml", CONFIG_YAML, array( // configurable messages list, so it's easy to add a msg, just add one in the msgs.yml file
"<--RULEZ-->",
"1. No Killing!",
"2. No Griefing!",
"3. No Stealing!",
"4. No Swearing!",
"5. Obey admins at all times!",
));
$this->msgs = $this->api->plugin->readYAML($this->path . "msgs.yml"); // so it's not in the stupid config format
}
public function Rules($cmd, $args, $issuer){
$username = $issuer->username;
foreach($this->msgs as $msg){ // for each message in the msgs.yml file , send a msg to the player
$this->api->chat->sendTo(false, $msg, $username);
}
}
public function __destruct(){
}
}
Just copy the text and save it in notepad as rules, make sure you save it as a php file though,
then just drop it in your plugins folder and you are good to go : )
so ive been working alot with codeacademy and ive been just taking public plugins and dissecting them to figure out how certain functions work, do you have any other tips for a beginner : )
Lol im at basics youre intermediate and shogipc is pro lol
Sadly Shoghicp hasnt been on for nearly a month :/ I wanted to ask him about making plugins possible for local servers with the use of PHP Hook Functioning. :L
Im pretty new to Plugins as well, maybe we could help each other out (this is also aimed at wiezz as well)?
im always willing to help though i may not be at your level yet,
the only successful plugins ive made are this one and a simple
standalone heal command. : P
I would love to work with either of you anytime : )
im always willing to help though i may not be at your level yet,
the only successful plugins ive made are this one and a simple
standalone heal command. : P
I would love to work with either of you anytime : )
say well we can help each other then : )
i have a few minor plugins i will add here
when they are finished
any ideas for new SIMPLE ones lol,
we can work together
say well we can help each other then : )
i have a few minor plugins i will add here
when they are finished
any ideas for new SIMPLE ones lol,
we can work together
Thank You iParadox! I know nearly nothing about php and I was easily able to customize that plugin and even create my own version of it, it is very customizable and I have enjoyed it!
Rollback Post to RevisionRollBack
Hi! I am Glitchmaster_PE! I do MCPE and no other Minecraft I currently make PocketMine plugins and am planning on expanding to ModPE Scripts soon! I am a moderator on MinePocket servers! I have a Twitter with 750+ followers!
can you guys make a plugin that auto broadcasts a given message at a given time?
Rollback Post to RevisionRollBack
Hi! I am Glitchmaster_PE! I do MCPE and no other Minecraft I currently make PocketMine plugins and am planning on expanding to ModPE Scripts soon! I am a moderator on MinePocket servers! I have a Twitter with 750+ followers!
To post a comment, please login or register a new account.
It is very simple but useful nonetheless.
The purpose of the plugin is to display the
rules to the player that uses the command /rules
Next realease hopefully you will be able to modify
the rules directly in-game : )
if you modify the plugin i would love to see how you
all use it just post the modified code here : )
CODE
<?php
/*
__PocketMine Plugin__
name=Rules
description=Displays current server rules.
version=0.1.1
author=iParadox
class=Rules
apiversion=9
*/
class Rules implements Plugin{
private $api, $path;
public function __construct(ServerAPI $api, $server = false){
$this->api = $api;
}
public function init(){
$this->api->console->register("rules", "Displays rules to user", array($this, "Rules"));
$this->api->ban->cmdWhitelist("rules"); // Non OPs can use the command too
$this->path = $this->api->plugin->configPath($this);
$this->msgs = new Config($this->path."msgs.yml", CONFIG_YAML, array( // configurable messages list, so it's easy to add a msg, just add one in the msgs.yml file
"<--RULEZ-->",
"1. No Killing!",
"2. No Griefing!",
"3. No Stealing!",
"4. No Swearing!",
"5. Obey admins at all times!",
));
$this->msgs = $this->api->plugin->readYAML($this->path . "msgs.yml"); // so it's not in the stupid config format
}
public function Rules($cmd, $args, $issuer){
$username = $issuer->username;
foreach($this->msgs as $msg){ // for each message in the msgs.yml file , send a msg to the player
$this->api->chat->sendTo(false, $msg, $username);
}
}
public function __destruct(){
}
}
Just copy the text and save it in notepad as rules, make sure you save it as a php file though,
then just drop it in your plugins folder and you are good to go : )
if u do can i join?
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumIm pretty new to Plugins as well, maybe we could help each other out (this is also aimed at wiezz as well)?
Check out my game! It's an open-world, sandbox text adventure.
Follow @hexdro_
Hexdro © 2012-2015
the only successful plugins ive made are this one and a simple
standalone heal command. : P
I would love to work with either of you anytime : )
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumCheck out my game! It's an open-world, sandbox text adventure.
Follow @hexdro_
Hexdro © 2012-2015
i have a few minor plugins i will add here
when they are finished
any ideas for new SIMPLE ones lol,
we can work together
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumCheck out my game! It's an open-world, sandbox text adventure.
Follow @hexdro_
Hexdro © 2012-2015
maybe soon i'll add commands to change rules in game