Search someone helping me write a new Plugin

The next generation of server controlling with clean and powerful user interface

Moderators: reaby, oliverde8, NADEO

Post Reply
Mirery
Posts: 29
Joined: 27 Dec 2014, 14:28

Search someone helping me write a new Plugin

Post by Mirery »

I'm new to eXpansion and i would have to learn a lot of things to create a new Plugin...

Perhaps someone of you feels boring enough to help me...

All i want is a Chat Command if the User use it he will get a reply but it has to be a private message .
oliverde8
Posts: 1345
Joined: 16 Jun 2010, 07:33
Location: in a Blue Box

Re: Search someone helping me write a new Plugin

Post by oliverde8 »

Hi,
there is a few tutorials written here for plugin making : https://github.com/eXpansionPluginPack/ ... developers
I do recommend you to use an ide such as netbeans/phpstorm you should have auto completion nearly everywhere which should make your task easier. :D
You can also use Manialive tutorials to understand a few things. Our tutorials where written but I never tested the code in them. Feel free to ask any question :D and good look with the devs
Image
Developper for The next generation, Clean and Powerfull controller eXpansion for your SM & TM server . Working on eXpansion² with full MP4 support and many other awesome features...
User avatar
w1lla
Posts: 2396
Joined: 15 Jun 2010, 11:09
Location: Netherlands
Contact:

Re: Search someone helping me write a new Plugin

Post by w1lla »

For manialive it can be done like this:

Code: Select all

<?php
namespace ManiaLivePlugins\UserTest\UserTest;

	use ManiaLive\Data\Storage;
	use ManiaLive\Utilities\Console;

class UserTest extends \ManiaLive\PluginHandler\Plugin {

function onInit() {

}

function onLoad() {
$cmd = $this->registerChatCommand('pmme', 'pmme', 0, false);
		$cmd->help = 'PM Myself';
}

function pmme($login) {
$this->connection->chatSendServerMessage('$fff» $fa0Welcome, You got a PM Message!', $login);
}

}
?>
This can be done in ManiaLive, for eXpansion its a bit different but it might work in combination with both i believe.

In config.ini write following:

Code: Select all

 manialive.plugins[] = '\ManiaLivePlugins\UserTest\UserTest'
TM² Info
SM Info
QM Info

OS: Windows 10 x64 Professional
MB: MSI 970A-G46
Processor: AMD FX-6300 3500 mHz
RAM Memory: 16 GB DDR3
Video: SAPPHIRE DUAL-X R9 280X 3GB GDDR5
KB: Logitech G510s
Mouse: Logitech G300s
Mode Creation
ManiaScript Docs
oliverde8
Posts: 1345
Joined: 16 Jun 2010, 07:33
Location: in a Blue Box

Re: Search someone helping me write a new Plugin

Post by oliverde8 »

[quote="w1lla"][/quote]
This would work in eXpansion but without autoload and i18n and other eXpansion specific stuff.

Equivalent of this for eXpansion would be :

Code: Select all

<?php
namespace ManiaLivePlugins\UserTest\UserTest;

   use ManiaLive\Data\Storage;
   use ManiaLive\Utilities\Console;

class UserTest extends ManiaLivePlugins\eXpansion\Core\types\BasicPlugin {

function exp_onInit() {
}

function exp_onLoad() {
$cmd = $this->registerChatCommand('pmme', 'pmme', 0, false);
      $cmd->help = 'PM Myself';
}

function pmme($login) {
$this->exp_chatSendServerMessage('$fff» $fa0Welcome, You got a PM Message!', $login);
}

}
?>
and plus you need to define and MetaData file as explained in the first tutorial :)
Image
Developper for The next generation, Clean and Powerfull controller eXpansion for your SM & TM server . Working on eXpansion² with full MP4 support and many other awesome features...
User avatar
w1lla
Posts: 2396
Joined: 15 Jun 2010, 11:09
Location: Netherlands
Contact:

Re: Search someone helping me write a new Plugin

Post by w1lla »

Correct. But i did it only basic manialive way tutorial ^^.
TM² Info
SM Info
QM Info

OS: Windows 10 x64 Professional
MB: MSI 970A-G46
Processor: AMD FX-6300 3500 mHz
RAM Memory: 16 GB DDR3
Video: SAPPHIRE DUAL-X R9 280X 3GB GDDR5
KB: Logitech G510s
Mouse: Logitech G300s
Mode Creation
ManiaScript Docs
Mirery
Posts: 29
Joined: 27 Dec 2014, 14:28

Re: Search someone helping me write a new Plugin

Post by Mirery »

oliverde8 wrote:

Code: Select all

function pmme($login) {
$this->exp_chatSendServerMessage('$fff» $fa0Welcome, You got a PM Message!', $login);
}

This isn't working^^

Do i not need to set this Part to true??? In all other Plugins it is -1 and true not 0 and false... 0 false isn't working. 0 ture is working

Code: Select all

function exp_onLoad() {
$cmd = $this->registerChatCommand('pmme', 'pmme', 0, true);
      $cmd->help = 'PM Myself';
}
oliverde8
Posts: 1345
Joined: 16 Jun 2010, 07:33
Location: in a Blue Box

Re: Search someone helping me write a new Plugin

Post by oliverde8 »

hi, can you post all your plugin as you test it. And have you activated the plugin?
Image
Developper for The next generation, Clean and Powerfull controller eXpansion for your SM & TM server . Working on eXpansion² with full MP4 support and many other awesome features...
Mirery
Posts: 29
Joined: 27 Dec 2014, 14:28

Re: Search someone helping me write a new Plugin

Post by Mirery »

Code: Select all

<?php
namespace ManiaLivePlugins\eXpansion\Invite;

   use ManiaLive\Data\Storage;
   use ManiaLive\Utilities\Console;

class Invite extends \ManiaLivePlugins\eXpansion\Core\types\BasicPlugin {

function exp_onInit() {
}

public function exp_onLoad() {
      $cmd = $this->registerChatCommand('invite', 'invite', 0, true);
      $cmd->help = 'PM Myself';
}

function invite($login) {
$zahl = mt_rand();
$this->exp_chatSendServerMessage('$fff» $fa0Welcome your Login is your Accountname and your Password is, ' . $zahl . '' , $login);
}

}
?>
THIS CODE IS THE WORKING CODE!!! But your code was:
$cmd = $this->registerChatCommand('pmme', 'pmme', 0, false);
This was just a smal test and i just want to inform you that your "false" hint was make me crazy for a long time, but then i had have a look into other Plugins and all the registerChatCommands are true there for example your Quiz.php
$command = $this->registerChatCommand("ask", "ask", -1, true);
$command = $this->registerChatCommand("kysy", "ask", -1, true);
$command = $this->registerChatCommand("points", "showPointsWindow", 0, true);
$command = $this->registerChatCommand("pisteet", "showPointsWindow", 0, true);
$command = $this->registerChatCommand("tilanne", "showPoints", 0, true);
$command = $this->registerChatCommand("point", "addPointsWindow", 0, true);
$command = $this->registerChatCommand("piste", "addPointsWindow", 0, true);
$command = $this->registerChatCommand("cancel", "cancel", 0, true);
$command = $this->registerChatCommand("peruuta", "cancel", 0, true);
$command = $this->registerChatCommand("answer", "showAnswer", 0, true);
$command = $this->registerChatCommand("vastaus", "showAnswer", 0, true);
$command = $this->registerChatCommand("question", "showQuestion", 0, true);
$command = $this->registerChatCommand("kysymys", "showQuestion", 0, true);
$command = $this->registerChatCommand("reset", "reset", 0, true);
$command = $this->registerChatCommand("nollaa", "reset", 0, true);
So i also do it and sinsce then my testplugin is working. But what means the 0 and -1? "ask" and "kysy" are -1 and all other 0....
oliverde8
Posts: 1345
Joined: 16 Jun 2010, 07:33
Location: in a Blue Box

Re: Search someone helping me write a new Plugin

Post by oliverde8 »

Well if you use an idea it will tell you which parameters is what,
For register chat Command :
1 name of the command
2 method to call
3 number of parameters required, 0 means none - 1 infinite
4 should the login of the user of the cmd be sent as a parameter to themethod
Image
Developper for The next generation, Clean and Powerfull controller eXpansion for your SM & TM server . Working on eXpansion² with full MP4 support and many other awesome features...
Post Reply

Return to “eXpansion”

Who is online

Users browsing this forum: No registered users and 1 guest