[Xaseco] Nouse Winning V1.2

Discuss everything about Xymph's Aseco flavoured server control scripts for TM Forever / classic TMN and for TM² Canyon.

Moderators: Xymph, TM-Patrol

Post Reply
nouseforname
swift roadking
swift roadking
Posts: 840
Joined: 20 Apr 2008 08:58
Owned TM-games: TMUF,TMNF, TMN
Manialink(s): therookies
Location: Germany
Contact:

[Xaseco] Nouse Winning V1.2

Post by nouseforname » 23 Nov 2009 16:03

  • Plugin Winning v1.2

    Update:
    - added xml config
    - ROC support
    - Ignored players support


    As requested here viewtopic.php?p=160160#p160160.

    i just created a small plugin to do this job.

    it will pay coppers for the first three ranked players at rounds end.
    TA and Stunt mode tested.
    no chat commands or any special function, just paying coppers. :)
    configuration is inside plugin file itself this time ( i said it's a small one).

    options for:
    - min server coppers to enable function
    - min player limit to enable function (players have to finish)
    - copper amount for rank 1, 2 and 3

    it also will tell you if somebody don't use TMU.

    Download as here as usual.
Last edited by nouseforname on 03 Aug 2011 17:00, edited 2 times in total.
Owner of the Rookie servers and some more. :)
Rookies HP
My Project
Rookies Manialinkcolor>

User avatar
david_jumper
happy cruiser
happy cruiser
Posts: 140
Joined: 21 Mar 2009 09:28
Owned TM-games: TMU, TMS
Manialink(s): djump
Location: Pforzheim (Germany)
Contact:

Re: [Xaseco] Nouse Winning V1.0

Post by david_jumper » 23 Nov 2009 20:54

Thanks :D
Works fine! Also in Stunts Mode!

Mihalius
highway camper
highway camper
Posts: 3
Joined: 08 Dec 2008 16:27
Owned TM-games: TMUF

Re: [Xaseco] Nouse Winning V1.0

Post by Mihalius » 02 Mar 2010 20:07

HI,
I would like to ask, If possible to display messages in messages window not in chat?

Thanks

nouseforname
swift roadking
swift roadking
Posts: 840
Joined: 20 Apr 2008 08:58
Owned TM-games: TMUF,TMNF, TMN
Manialink(s): therookies
Location: Germany
Contact:

Re: [Xaseco] Nouse Winning V1.0

Post by nouseforname » 02 Mar 2010 20:35

Mihalius wrote:HI,
I would like to ask, If possible to display messages in messages window not in chat?

Thanks
at the moment its not possible, but it shouldnt be to haard to add this.
Owner of the Rookie servers and some more. :)
Rookies HP
My Project
Rookies Manialinkcolor>

«从々.»«ॐ²³»
sunday driver
sunday driver
Posts: 58
Joined: 28 Jun 2010 16:35
Owned TM-games: TMNF, TMUF, TM²C
Manialink(s): lolzone
Location: Germany
Contact:

Re: [Xaseco] Nouse Winning V1.0

Post by «从々.»«ॐ²³» » 30 Dec 2010 20:06

older plugin huh?
what about a <ignoredplayers>
<ignoredlogin> entry for masteradmins and millionaires?

and/or maybe with conig.xml? :)

ok, the ignoredplayers would be enough.

thx.
btw. nice plugins!
TM² [url=maniaplanet://#join=loltech]Δ!lluminati Confirmed!Δ[/url]

nouseforname
swift roadking
swift roadking
Posts: 840
Joined: 20 Apr 2008 08:58
Owned TM-games: TMUF,TMNF, TMN
Manialink(s): therookies
Location: Germany
Contact:

Re: [Xaseco] Nouse Winning V1.0

Post by nouseforname » 30 Dec 2010 20:35

«从々.»«ॐ²³» wrote:older plugin huh?
about one year
ok, the ignoredplayers would be enough.
see below, untested tho.
btw. nice plugins!
thx

check this:

Code: Select all

<?php

/* ----------------------------------------------------------------------------------
 *
 * Xaseco plugin paying coppers to first three ranked players.
 *
 * ----------------------------------------------------------------------------------
 *
 * Author: 			ML aka RookieNouse aka nouseforname @ http://www.tm-forum.com
 * Home: 			http://tmf.game-host.org
 * Date: 			30.12.2010
 * Version:			1.1a
 * Dependencies: 	none
 *
 * ----------------------------------------------------------------------------------
 *
 * LICENSE: 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 2 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, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 *
 * ----------------------------------------------------------------------------------
 */
  
Aseco::registerEvent('onEndRace', 'NouseWinning');

function NouseWinning ($aseco) {

$limit = 1; // player limit to enable winning payment
$minservercoppers = 500; // minimum amount of server coppers
$firstplace = 20; // first place coppers
$secondplace = 15; // second place coppers
$thirdplace = 10; // third place coppers

$ignores = array('LOGIN1', 'LOGIN2'); // all logins to be ignored by payment

$rocOnly = false; // set this to true if you want it only during 100k ladder state

/* ================================================================================= */

	if ($aseco->server->getGame() == 'TMF') {
		// check for TMUF server
		if ($aseco->server->rights) {	
			$active = false;
			$aseco->client->query('GetServerCoppers');
			$coppers = $aseco->client->getResponse();
			$aseco->client->query('GetLadderServerLimits');
			$ladderlimits = $aseco->client->getResponse();
			$ladder = $ladderlimits['LadderServerLimitMax'];
			if ($rocOnly == true && $ladder == 100000) {
				$active = true;
			} elseif ($rocOnly == false) {
				$active = true;
			}
			
		} else {
			$message = formatText($aseco->getChatMessage('UNITED_ONLY'), 'server');
			$this->Aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
		}
	} else {
		$message = $aseco->getChatMessage('FOREVER_ONLY');
		$aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
	}
	
	if ($active) {
		if ($coppers >= $minservercoppers) {
			$aseco->client->query('GetCurrentRanking', 50, 0);
			$ranking = $aseco->client->getResponse();
			foreach ($ranking as $key => $var) {
				if ($var[BestTime] > 0 || $var[Score] > 0) {
					$ranks[$key] = array($var[Login], $var[NickName], $var[BestTime], $var[Rank], $var[Score]);
				}
			}
			// check if enough players finished track
			if (count($ranks) >= $limit) {
				if ($ranks[0][0] && $firstplace) {
					$rightsfirst = $aseco->server->players->getPlayer($ranks[0][0])->rights;
					if ($rightsfirst && !in_array($ranks[0][0], $ignores)) {
						$message = '$ff0> '.$ranks[0][1].' $g$z$6c0$s$ifinished at first position and won '.$firstplace.' coppers !!!';
						$aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
						$message = 'You finished at first position and won '.$firstplace.' coppers!'; 
						$aseco->client->addCall('Pay', array($ranks[0][0], (int)$firstplace, $aseco->formatColors($message)));	
					} else {
						$message = '$ff0> '.$ranks[0][1].' $g$z$6c0$s$iuse a non TMU account or in ignorelist!!!';
						$aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
					}
				} 
				if ($ranks[1][0] && $secondplace) {
					$rightssecond = $aseco->server->players->getPlayer($ranks[1][0])->rights;
					if ($rightssecond  && !in_array($ranks[1][0], $ignores)) {
						$message = '$ff0> '.$ranks[1][1].' $g$z$6c0$s$ifinished at second position and won '.$secondplace.' coppers !!!';
						$aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
						$message = 'You finished at second position and won '.$secondplace.' coppers!'; 
						$aseco->client->addCall('Pay', array($ranks[1][0], (int)$secondplace, $aseco->formatColors($message)));
					} else {
						$message = '$ff0> '.$ranks[1][1].' $g$z$6c0$s$iuse a non TMU account or in ignorelist!!!';
						$aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
					}
				} 
				if ($ranks[2][0] && $thirdplace) {
					$rightsthird = $aseco->server->players->getPlayer($ranks[2][0])->rights;
					if ($rightsthird  && !in_array($ranks[2][0], $ignores)) {
						$message = '$ff0> '.$ranks[2][1].'  $g$z$6c0$s$ifinished at third position and won '.$thirdplace.' coppers !!!';
						$aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
						$message = 'You finished at third position and won '.$thirdplace.' coppers!'; 
						$aseco->client->addCall('Pay', array($ranks[2][0], (int)$thirdplace, $aseco->formatColors($message)));
					} else {
						$message = '$ff0> '.$ranks[2][1].' $g$z$6c0$s$iuse a non TMU account or in ignorelist!!!';
						$aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
					}
				}
			} else {
				$message = '$ff0> $g$z$6c0$s$i Not enough players finished track, Winning payment disabled!!!';
				$aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
			}
		} else {
			$message = '$ff0> $g$z$6c0$s$iServer coppers to low, winning payment disabled. Please donate some.';
			$aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
		}
	}
}
?>
Owner of the Rookie servers and some more. :)
Rookies HP
My Project
Rookies Manialinkcolor>

«从々.»«ॐ²³»
sunday driver
sunday driver
Posts: 58
Joined: 28 Jun 2010 16:35
Owned TM-games: TMNF, TMUF, TM²C
Manialink(s): lolzone
Location: Germany
Contact:

Re: [Xaseco] Nouse Winning V1.0

Post by «从々.»«ॐ²³» » 30 Dec 2010 23:45

thx for quick support :D

have tested it and looks like it works,
but the Players did´t got coppers.

The massage is ok,
but I reconfigured it for ignores on line 93, 105 and 117
with
'use a non TMU account or is in ignorelist or its 从々. and he wanted to save NADEO-TAX!!!'

thx
TM² [url=maniaplanet://#join=loltech]Δ!lluminati Confirmed!Δ[/url]

nouseforname
swift roadking
swift roadking
Posts: 840
Joined: 20 Apr 2008 08:58
Owned TM-games: TMUF,TMNF, TMN
Manialink(s): therookies
Location: Germany
Contact:

Re: [Xaseco] Nouse Winning V1.0

Post by nouseforname » 30 Dec 2010 23:52

sometimes it need long time to get the ingame mail with coppers, anyway, u ca nchange the message to whatever u want :)
Owner of the Rookie servers and some more. :)
Rookies HP
My Project
Rookies Manialinkcolor>

uBm
wheelbarrow operator
wheelbarrow operator
Posts: 21
Joined: 02 Aug 2010 04:26
Owned TM-games: TMUF

Re: [Xaseco] Nouse Winning V1.0

Post by uBm » 02 Aug 2011 15:26

hi,
i wanted to enable the nouse winning system on my hosters server -
but they told me without configuration file they would not support it. Reason:
The plugin is configurable via the PHP-File only. We can not allow our customers to edit those files due to security reasons.

so i wrote a config XML file and and altered nouse_winning plugin for reading the varaibles from the xml file and the extension of ignoredplayers which saves nadeotaxes.
Would be nice if you can update with my files.
Zip File:
http://covertstrike.org/tm/nouse_winning_new.zip

XML File:

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
	<settings>
		<limit>6</limit> 							<!-- player limit to enable winning payment -->
		<minservercoppers>100</minservercoppers> 	<!--minimum amount of server coppers -->
		<firstplace>15</firstplace>					<!--first place coppers-->
		<secondplace>10</secondplace>				<!--second place coppers-->
		<thirdplace>5</thirdplace>					<!--third place coppers-->
		<ignoredplayers>
		<ignoredlogin>player1</ignoredlogin>		<!--Ignored Players (admin´s OP´s etc...-->
		<ignoredlogin>player2</ignoredlogin>
		<ignoredlogin>playerx</ignoredlogin>
	</ignoredplayers>
	</settings>
Plugin:

Code: Select all

<?php

/* ----------------------------------------------------------------------------------
 *
 * Xaseco plugin paying coppers to first three ranked players.
 *
 * ----------------------------------------------------------------------------------
 *
 * Author: 			ML aka RookieNouse aka nouseforname @ http://www.tm-forum.com
 * Home: 			http://tmf.game-host.org
 * Date: 			22.11.2009
 * Version:			1.0
 * Dependencies: 	none
 *
 * ----------------------------------------------------------------------------------
 *
 * LICENSE: 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 2 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, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 *
 * ----------------------------------------------------------------------------------
 */
  
Aseco::registerEvent('onEndRace', 'NouseWinning');

function NouseWinning ($aseco) {
	// Load settings
	$count = 0;
	
	$settingsXML = simplexml_load_file('nouse_winning.xml');
	$limit = intval($settingsXML->limit);
	$minservercoppers = intval($settingsXML->minservercoppers);
	$firstplace = intval($settingsXML->firstplace);
	$secondplace = intval($settingsXML->secondplace);
	$thirdplace = intval($settingsXML->thirdplace);
	foreach ($settingsXML->ignoredplayers->ignoredlogin as $login) //Ignored players
		{
		$IgnoredPlayers[$count] = $login;
		$count++;
		}
	
/* ================================================================================= */

	if ($aseco->server->getGame() == 'TMF') {
		// check for TMUF server
		if ($aseco->server->rights) {		
			$aseco->client->query('GetServerCoppers');
			$coppers = $aseco->client->getResponse();
		} else {
			$message = formatText($aseco->getChatMessage('UNITED_ONLY'), 'server');
			$this->Aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
		}
	} else {
		$message = $aseco->getChatMessage('FOREVER_ONLY');
		$aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
	}

	
	if ($coppers >= $minservercoppers) {
		$aseco->client->query('GetCurrentRanking', 50, 0);
		$ranking = $aseco->client->getResponse();
		foreach ($ranking as $key => $var) {
			if ($var[BestTime] > 0 || $var[Score] > 0) {
				$ranks[$key] = array($var[Login], $var[NickName], $var[BestTime], $var[Rank], $var[Score]);
			}
		}
		// check if enough players finished track
		if (count($ranks) >= $limit) {
			if ($ranks[0][0] && $firstplace) {
				$rightsfirst = $aseco->server->players->getPlayer($ranks[0][0])->rights;
				if ($rightsfirst && !in_array($ranks[0][0], $IgnoredPlayers)) {
					$message = '$ff0> '.$ranks[0][1].' $g$z$6c0$s$ifinished at first position and won '.$firstplace.' coppers !!!';
					$aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
					$message = 'You finished at first position and won '.$firstplace.' coppers!'; 
					$aseco->client->addCall('Pay', array($ranks[0][0], $firstplace, $aseco->formatColors($message)));	
				} else {
					$message = '$ff0> '.$ranks[0][1].' $g$z$6c0$s$iuse a non TMU account!!!';
					$aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
				}
			} 
			if ($ranks[1][0] && $secondplace) {
				$rightssecond = $aseco->server->players->getPlayer($ranks[1][0])->rights;
				if ($rightssecond && !in_array($ranks[1][0], $IgnoredPlayers)) {
					$message = '$ff0> '.$ranks[1][1].' $g$z$6c0$s$ifinished at second position and won '.$secondplace.' coppers !!!';
					$aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
					$message = 'You finished at second position and won '.$secondplace.' coppers!'; 
					$aseco->client->addCall('Pay', array($ranks[1][0], $secondplace, $aseco->formatColors($message)));
				} else {
					$message = '$ff0> '.$ranks[1][1].' $g$z$6c0$s$iuse a non TMU account!!!';
					$aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
				}
			} 
			if ($ranks[2][0] && $thirdplace) {
				$rightsthird = $aseco->server->players->getPlayer($ranks[2][0])->rights;
				if ($rightsthird && !in_array($ranks[2][0], $IgnoredPlayers)) {
					$message = '$ff0> '.$ranks[2][1].'  $g$z$6c0$s$ifinished at third position and won '.$thirdplace.' coppers !!!';
					$aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
					$message = 'You finished at third position and won '.$thirdplace.' coppers!'; 
					$aseco->client->addCall('Pay', array($ranks[2][0], $thirdplace, $aseco->formatColors($message)));
				} else {
					$message = '$ff0> '.$ranks[2][1].' $g$z$6c0$s$iuse a non TMU account!!!';
					$aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
				}
			}
		} else {
			$message = '$ff0> $g$z$6c0$s$i Not enough players finished track, Winning payment disabled!!!';
			$aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
		}
	} else {
		$message = '$ff0> $g$z$6c0$s$iServer coppers to low, winning payment disabled. Please donate some.';
		$aseco->client->addCall('ChatSendServerMessage', array($aseco->formatColors($message)));
	}
}
?>

jamie_macdonald
TM-Patrol
TM-Patrol
Posts: 1612
Joined: 10 Jul 2008 19:48
Owned TM-games: TMUF, TMNF, TMS
Manialink(s): ET
Location: London, UK
Contact:

Re: [Xaseco] Nouse Winning V1.0

Post by jamie_macdonald » 03 Aug 2011 10:22

The configuration is done via the XML, you host is wrong or mistaken.

Hard to remember if the XML is required in the plugins folder or the Xaseco root folder though (I think the latter), but if you have this in both the root folder and the /plugins/ folder this should get you going :thumbsup:

Wish you luck persuading your not so smart host :D

HTH,

uBm
wheelbarrow operator
wheelbarrow operator
Posts: 21
Joined: 02 Aug 2010 04:26
Owned TM-games: TMUF

Re: [Xaseco] Nouse Winning V1.0

Post by uBm » 03 Aug 2011 12:21

no i am sorry, in this case the configuration is not in the xml file, its in the php file.

the winning plugin does not have an xml file
thats why i am requesting that change.
its about nouse_winning.php - which has the configuration in the php file.

jamie_macdonald
TM-Patrol
TM-Patrol
Posts: 1612
Joined: 10 Jul 2008 19:48
Owned TM-games: TMUF, TMNF, TMS
Manialink(s): ET
Location: London, UK
Contact:

Re: [Xaseco] Nouse Winning V1.0

Post by jamie_macdonald » 03 Aug 2011 12:34

Hehee ... Oh dear! ...Can we put that down as a "blonde moment" please :D

Should have read more clearly eh ...Thanks for the edit :thumbsup:

nouseforname
swift roadking
swift roadking
Posts: 840
Joined: 20 Apr 2008 08:58
Owned TM-games: TMUF,TMNF, TMN
Manialink(s): therookies
Location: Germany
Contact:

Re: [Xaseco] Nouse Winning V1.2

Post by nouseforname » 03 Aug 2011 16:59

Updated download to latest version with XML configs and all options from before.
Owner of the Rookie servers and some more. :)
Rookies HP
My Project
Rookies Manialinkcolor>

Post Reply