[Manialive 2.7] tunnelSendDataFromString Relay issue

Discuss the Dedicated Server Tools developed by Nadeo Live such as ManiaLive, Trust Circles, Dedicated Manager, Competition Manager and Lobbies

Moderator: NADEO

Post Reply
User avatar
w1lla
Posts: 2287
Joined: 15 Jun 2010, 11:09
Location: Netherlands
Contact:

[Manialive 2.7] tunnelSendDataFromString Relay issue

Post by w1lla »

Hi,

I'm trying to send a prefix message towards a relay through tunnelSendDataFromString.

This does work if i change the login towards the own serverlogin. But if i try to send it towards the Relay server it seems its being dissolved in mid-air.

It does appear in the callback of Maniaplanet.TunnelDataRecieved but then it doesn't do anything.

I and maybe other server owners / coders do not want to run two server accounts do to they fact that it might be troubled to do so.

Hope this can be fixed in an overall issue.

Below is the code i tried to work on:

Code: Select all

<?php
/**
 * RelayChat
 * @name RelayChat
 * @data-made 08-02-2013
 * @date-finished 08-02-2013
 * @version 1.0
 * @package RelayChat
 *
 * @author Willem van den Munckhof
 * @copyright © 2013
 *
 * ---------------------------------------------------------------------
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * ---------------------------------------------------------------------
 * You are allowed to change things or use this in other projects, as
 * long as you leave the information at the top (name, date, version,
 * website, package, author, copyright) and publish the code under
 * the GNU General Public License version 3.
 * ---------------------------------------------------------------------
 */
namespace ManiaLivePlugins\Test\Test;

    use ManiaLive\Utilities\Console;
	use DedicatedApi\Xmlrpc\Base64;
class Test extends \ManiaLive\PluginHandler\Plugin {
		
		
	public $isrelay = false;
	public $relaymaster = null;
	public $relaylist = array();
		
	/**
     * onInit()
     * Function called on initialisation of ManiaLive.
     *
     * @return void
     */
    function onInit() {
        $this->setVersion('0.0.1');
    }
	
	/**
     * onLoad()
     * Function called on loading of ManiaLive.
     *
     * @return void
     */
    function onLoad() {
        $this->enableDedicatedEvents();
	
    }
	
	 public function onReady() {
	 $this->onShow();
	 }
	 
	 function onShow() {
	 
		Console::println(' #####################################################################');
		Console::println('[eXpension Pack] Checking for a ManiaChannel!');
		try {
		$playerspeclist = $this->connection->getPlayerList(300,1,3);
		$this->relaylist = $playerspeclist;
		foreach ($playerspeclist as $plspeclist)
		{
		//var_dump($plspeclist->spectatorStatus);
		//var_dump($plspeclist->login);
		if ($plspeclist->isServer == true && $plspeclist->spectatorStatus == 2551101){
		Console::println('[eXpension Pack] Found a ManiaChannel: Login:		'.$plspeclist->login.'');
		Console::println('[eXpension Pack] Found a ManiaChannel: Nickname:	'.$plspeclist->nickName.'');
		Console::println(' #####################################################################');
		}
		elseif ($plspeclist->isServer == false && $plspeclist->spectatorStatus == 0){

		}
		}
        } catch (\Exception $e) {
         Console::println('[eXpension Pack] No ManiaChannel Found!');               
                    }
					
		$this->SendtoRelay();

		}

	function SendtoRelay(){
	$data = 'Hello! Welcome to the TM2 Stadium RelayChat plugin made by w1lla';
	$data64len = strlen($data);
	if($data64len > 5450){ // using TunnelSendDataToId
		Console::println('sendToRelay:: Error, data too big: encoded/compressed data exceed 5450 bytes ('.$data64len.') !');
		return false;
	}
	//var_dump($data);
	$sent = $this->connection->tunnelSendDataFromString($this->relaylist[0]->login, $data);
	//var_dump($sent);
	var_dump($this->relaylist[0]->login);
	}
	
	function onTunnelDataReceived($playerUid, $login, $data) { 
	var_dump($login);
	var_dump($playerUid);
	$this->connection->chatSendServerMessage($data, $login);
	}
	
	}
?>
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
The_Big_Boo
Posts: 1026
Joined: 15 Jun 2010, 15:46

Re: [Manialive 2.7] tunnelSendDataFromString Relay issue

Post by The_Big_Boo »

Code: Select all

function onTunnelDataReceived($playerUid, $login, $data) {
   $this->connection->chatSendServerMessage($data, $login);
}
What are you trying to do with this? TunnelSendData methods and TunnelDataReceived callback are working perfectly fine but I'm sure you don't want to call ChatSendServerMessage with the login of the main server (because it obviously fails).
OS: Win 7 Pro x64
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310
User avatar
w1lla
Posts: 2287
Joined: 15 Jun 2010, 11:09
Location: Netherlands
Contact:

Re: [Manialive 2.7] tunnelSendDataFromString Relay issue

Post by w1lla »

Hi,

I did this to make it eventually work:

Run 2 manialives.

1 has all the plugins loaded for the master game server and one 1 manialive is running my test plugin to show the onTunnelDataRecieved function.

If i send a manialink code towards the relay login it gets shown to all spectators on the relay.

So in this case it will work.

My problem was just to run multiple instances of manialive to achieve it.

My test plugins can be found here: https://github.com/w1lla/ManiaLive/comm ... 038f0b9c95

Test can be used on the master game server and test1 can be used on the relay server.

with kind regards,

w1lla.
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
Post Reply

Return to “Dedicated Server Tools”

Who is online

Users browsing this forum: No registered users and 0 guests