Page 2 of 3

Re: [Xaseco 1+2] Pay2Play plugin

Posted: 14 Dec 2012 21:37
by Leigham
Ah, I entirely forgot to test that bit in other gamemodes, I'll go and do that.

In the meantime, you might be able to work around it by setting the delay to a large negative number (i.e larger than your track timelimit). I'll get a proper fix out when I have one.

Re: [Xaseco 1+2] Pay2Play plugin

Posted: 14 Dec 2012 22:48
by peugeot405
Leigham wrote:In the meantime, you might be able to work around it by setting the delay to a large negative number (i.e larger than your track timelimit).
ok i'ts working now. :thumbsup:
Leigham wrote:I'll get a proper fix out when I have one.
I'm looking forward to it.

Thanks Leigham :thumbsup:

Re: [Xaseco 1+2] Pay2Play plugin

Posted: 16 Mar 2013 14:18
by niZe1996
Please help, I always get this error when somebody skips :s
Fatal error: Undefined class constant 'CUP' in C:\Users\Gebruiker\Documents\TrackMania\Servers\RoadCrushers Fun World\TrackmaniaServer_2011-02-21\xaseco\plugins
\plugin.pay2play.php on line 419

The lines look like:

Code: Select all

 		if ($time >= $p2p['time']['skip']) {
			// load the next track
			// don't clear scores if in Cup mode
			if ($aseco->server->gameinfo->mode == Gameinfo::CUP)
				$aseco->client->query('NextChallenge', true);
			else
				$aseco->client->query('NextChallenge');
			unset($p2p['time']['skip']);
		}
EDIT: Updated the types.inc.php file to the file of aseco1.15b and works now!

Re: [Xaseco 1+2] Pay2Play plugin

Posted: 16 Mar 2013 18:02
by undef.de
niZe1996 wrote:Please help, I always get this error when somebody skips :s

Code: Select all

Fatal error: Undefined class constant 'CUP' in C:\Users\Gebruiker\Documents\TrackMania\Servers\RoadCrushers Fun World\TrackmaniaServer_2011-02-21\xaseco\plugins
\plugin.pay2play.php on line 419
The lines look like:

Code: Select all

 		if ($time >= $p2p['time']['skip']) {
			// load the next track
			// don't clear scores if in Cup mode
			if ($aseco->server->gameinfo->mode == Gameinfo::CUP)
				$aseco->client->query('NextChallenge', true);
			else
				$aseco->client->query('NextChallenge');
			unset($p2p['time']['skip']);
		}
It seems you did not have the actual XAseco installed or your update was not clean (not updated includes/types.inc.php).

PS: Code blocks are better then Quote blocks for code parts. :wink:

Re: [Xaseco 1+2] Pay2Play plugin

Posted: 26 Mar 2013 23:47
by Ash Lambert
Very nice plugin, thx a lot!
Is it possible to disable the Buttons after the first Player paid for restart or skip?

Re: [Xaseco 1+2] Pay2Play plugin

Posted: 06 Apr 2013 11:38
by whazzaa
pay to add a tmx track would be a sweet option, is this even possible ?

Re: [Xaseco 1+2] Pay2Play plugin

Posted: 06 Apr 2013 16:36
by Leigham
Not in this plugin, no. See my other reply.

Re: [Xaseco 1+2] Pay2Play plugin

Posted: 11 Sep 2013 19:40
by sterretje22
Nice plug-in Leigham :D

Re: [Xaseco 1+2] Pay2Play plugin

Posted: 27 Nov 2013 12:05
by soluto
First i have to say: Very nice plug-in.

Now i have a question
Is it possible to edit this plug-in like this:
A Player Pay for Replay, after Replay Starts hide the SKIP-Button or deactivate it?

Thanks for the hell and sorry for Vers Bad english :-)

Re: [Xaseco 1+2] Pay2Play plugin

Posted: 27 Nov 2013 18:36
by Leigham
soluto wrote:First i have to say: Very nice plug-in.

Now i have a question
Is it possible to edit this plug-in like this:
A Player Pay for Replay, after Replay Starts hide the SKIP-Button or deactivate it?

Thanks for the hell and sorry for Vers Bad english :-)
Yes, that's something I should really have thought of. I'll take a proper look at it soon, although that is the Blizzard standard definition I'm afraid.

In the meantime, here's a completely untested hotfix. You can just replace the whole function.

Code: Select all

function p2p_check($aseco) { //Check map and load widgets
	global $p2p;
	
	$p2p['score'] = false;
	
	if ($p2p['replay']['active']) {
		$aseco->client->query('GetCurrentMapInfo');
		$thismap = $aseco->client->getResponse();

		if (isset($p2p['thismap']['FileName']) && $p2p['thismap']['FileName'] == $thismap['FileName']) {
			
			if ($p2p['replay']['total'] >= $p2p['replay']['max_val'] && $p2p['replay']['max_val'] != 0) {
				$p2p['replay']['max'] = true;
				p2p_buildReplay($aseco, 'max'); 
			} else {
				p2p_buildReplay($aseco);
				$p2p['replay']['max'] = false;
			}
		} else {
			$p2p['replay']['total'] = 0;
			$p2p['replay']['max'] = false;
			p2p_buildReplay($aseco);
		}
		$p2p['thismap'] = $thismap;
	}
	if ($p2p['skip']['active'] == true && $p2p['replay']['total'] == 0) {
		p2p_buildSkip($aseco);
	}
	$p2p['timelimit'] = time() + ($aseco->server->gameinfo->timelimit / 1000);
}
Let me know if it works

Re: [Xaseco 1+2] Pay2Play plugin

Posted: 28 Nov 2013 07:12
by soluto
after copy and paste, i restart aseco and it come:

fatal error in xxxxx.plugin.pay2play on line 14

Re: [Xaseco 1+2] Pay2Play plugin

Posted: 28 Nov 2013 10:34
by Leigham
soluto wrote:after copy and paste, i restart aseco and it come:

fatal error in xxxxx.plugin.pay2play on line 14
Strange, I did a syntax check so I wasn't expecting it to error out straight away. You've only altered the p2p_check function? I'll have a proper look when I get home.

Re: [Xaseco 1+2] Pay2Play plugin

Posted: 28 Nov 2013 11:56
by soluto
i've only copy and past this part, because the other is same :)

&& $p2p['replay']['total'] == 0)

than i test it and:
fatal error on line 14


after this i think: hmm maybe i've do a mistake
so i've copy the whole code and in past it in the p2p_check function

restart aseco again and:
fatale error on line 14

Re: [Xaseco 1+2] Pay2Play plugin

Posted: 28 Nov 2013 18:01
by Leigham
So I tested it, doesn't error for me. Even works as advertised which is an unexpected bonus. Can you post your full error for me?

Re: [Xaseco 1+2] Pay2Play plugin

Posted: 28 Nov 2013 19:15
by soluto
i'm not at home sry. i post it later.

here i post the code of this file, is that right? or have i change something wrong?

Code: Select all

<?php

/* Pay2Play v1.01
 *
 * Plugin by Leigham.
 *
 * Important: This plugin will only work on a TM2 server. 
 * The server must have at least a small amount of planets for
 * the plugin to work.
 *
 * All settings are configurable in the pay2play.xml file.
 */

Aseco::registerEvent('onStartup',                   'p2p_setup');
Aseco::registerEvent('onSync',                      'p2p_maintain');
Aseco::registerEvent('onPlayerConnect',             'p2p_connect');
Aseco::registerEvent('onBeginMap',                  'p2p_check');
Aseco::registerEvent('onBeginRound',                'p2p_check');
Aseco::registerEvent('onEndRound',									'p2p_off');
Aseco::registerEvent('onPlayerManialinkPageAnswer', 'p2p_click');
Aseco::registerEvent('onBillUpdated',               'p2p_bill');
Aseco::registerEvent('onEverySecond',               'p2p_time');
Aseco::registerEvent('onShutdown',									'p2p_apocalypse');


function p2p_setup($aseco) { //Read pay2play.xml and load settings
	global $p2p;
	
	$p2p = array();
	$votes = array();
	
	if ($config = $aseco->xml_parser->parseXml('pay2play.xml', true)) {
    $config = $config['SETTINGS'];
    
    if (strtolower($config['REPLAY'][0]['ENABLED'][0]) == 'true') {
    	$p2p['replay']['active'] = true;
    	$p2p['replay']['position'] = floatval($config['REPLAY'][0]['POSX'][0]).' '.floatval($config['REPLAY'][0]['POSY'][0]).' 1';
    	$p2p['replay']['cost'] = intval($config['REPLAY'][0]['COST'][0]);
    	$p2p['replay']['max_val'] = intval($config['REPLAY'][0]['MAX_REPLAYS'][0]);
    	$p2p['replay']['blink'] = ((strtolower($config['REPLAY'][0]['BLINK'][0]) == 'true') ? true : false);
			if ($config['REPLAY'][0]['CVOTE_OFF'][0] == 'true') $votes[] = array('Command'	=> 'RestartMap', 'Ratio' => (float)-1);
    	$p2p['replay']['total'] = 0;
    	$p2p['replay']['success'] = false;
    	$p2p['replay']['max'] = false;
    } else {
    	$p2p['replay']['active'] = false;
    } 
    
    if (strtolower($config['SKIP'][0]['ENABLED'][0]) == 'true') {
    	$p2p['skip']['active'] = true;
    	$p2p['skip']['position'] =floatval($config['SKIP'][0]['POSX'][0]).' '.floatval($config['SKIP'][0]['POSY'][0]).' 1';
    	$p2p['skip']['cost'] = intval($config['SKIP'][0]['COST'][0]);
    	$p2p['skip']['delay'] = intval($config['SKIP'][0]['DELAY'][0]);
    	$p2p['skip']['blink'] = ((strtolower($config['SKIP'][0]['BLINK'][0]) == 'true') ? true : false);
    	if ($config['REPLAY'][0]['CVOTE_OFF'][0] == 'true') $votes[] = array('Command'	=> 'NextMap', 'Ratio' => (float)-1);
    	$p2p['skip']['success'] = false;
    } else {
    	$p2p['skip']['active'] = false;
    }
    
    $p2p['score'] = false;
    $p2p['manialink'] = '12891';
    $p2p['thismap'] = array();
    $p2p['bills'] = array();
    $p2p['timelimit'] = -1;
    
    if (isset($votes[0])) {
    	$aseco->client->query('GetCallVoteRatios');
			$p2p['oldvotes'] = $aseco->client->getResponse();
			$aseco->client->query('SetCallVoteRatios', $votes);
		}
  
	} else {
		trigger_error('[Pay2Play] Could not read/parse settings file pay2play.xml!', E_USER_ERROR);
		return false;
	}
}

function p2p_maintain($aseco) { 	// Do maintenance checks
	global $p2p;
	
  $aseco->plugin_versions[] = array(
     'plugin'   => 'plugin.pay2play.php',
     'author'   => 'Leigham',
     'version'   => '1.01'
  );
  
  if (!in_array('plugin.rasp_jukebox.php', $aseco->plugins)) {
  	trigger_error('[Pay2Play] This plugin requires the rasp jukebox. Please activate "plugin.rasp_jukebox.php" in your plugins.xml file!', E_USER_ERROR);
  }
}

function p2p_connect($aseco) { //Deal with new player
	global $p2p;
	
	if (!$p2p['score']) {
		if ($p2p['replay']['active']) {
			if (!$p2p['replay']['success']){
				if (!$p2p['replay']['max']) {
					p2p_buildReplay($aseco);
				} else {
					p2p_buildReplay($aseco, 'max');
				}
			} else {
				p2p_buildReplay($aseco, 'success');
			}
		}
		if ($p2p['skip']['active']) {
			if (!$p2p['skip']['success']) {	
				p2p_buildSkip($aseco);
			} else {
				p2p_buildSkip($aseco, 'success');
			}
		}
	}
}

function p2p_check($aseco) { //Check map and load widgets
	global $p2p;
	
	$p2p['score'] = false;
	
	if ($p2p['replay']['active']) {
		$aseco->client->query('GetCurrentMapInfo');
		$thismap = $aseco->client->getResponse();

		if (isset($p2p['thismap']['FileName']) && $p2p['thismap']['FileName'] == $thismap['FileName']) {
			
			if ($p2p['replay']['total'] >= $p2p['replay']['max_val'] && $p2p['replay']['max_val'] != 0) {
				$p2p['replay']['max'] = true;
				p2p_buildReplay($aseco, 'max'); 
			} else {
				p2p_buildReplay($aseco);
				$p2p['replay']['max'] = false;
			}
		} else {
			$p2p['replay']['total'] = 0;
			$p2p['replay']['max'] = false;
			p2p_buildReplay($aseco);
		}
		$p2p['thismap'] = $thismap;
	}
	if ($p2p['skip']['active']) == true && $p2p['replay']['total'] == 0) {
		p2p_buildSkip($aseco);
	}
	$p2p['timelimit'] = time() + ($aseco->server->gameinfo->timelimit / 1000);
}

function p2p_off($aseco) { //Close widgets and reset variables
	global $p2p;
	
	$p2p['replay']['success'] = false;
	$p2p['skip']['success'] = false;
	$p2p['score'] = true;
	
	$xml = '<manialink id="'.$p2p['manialink'].'00">
	</manialink> <manialink id="'.$p2p['manialink'].'01">
	</manialink>';
		
	$aseco->client->addCall('SendDisplayManialinkPage', array($xml, 0, false));
}

function p2p_buildReplay($aseco, $state = false) { //Build replay widget
	global $p2p;
	
	if ($state == 'success') {
		
		if ($p2p['replay']['blink']) {
			$a = array('style="TextTitle2Blink"', 0.5, 0.35, '$ccc', '$c90', 7);
		} else {
			$a = array('', 0.9, 0.55, '', '', 4.5);
		}
		
		$xml = '<manialink id="'.$p2p['manialink'].'00">
   	 <frame posn="'.$p2p['replay']['position'].'">
   	    <quad posn="0 0 0" sizen="4.6 6.5" style="BgsPlayerCard" substyle="BgCardSystem"/>
   	    <label posn="2.25 -0.75 0.1" sizen="'.$a[5].' 2" halign="center" '.$a[0].' textsize="1" scale="'.$a[1].'" textcolor="FFFF" text="'.$a[3].'MAP"/>
   	    <label posn="2.25 -2.3 0.1" sizen="8.4 2" halign="center" '.$a[0].' textsize="1" scale="'.$a[2].'" textcolor="FC0F" text="'.$a[4].'WILL BE"/>
   	    <label posn="2.25 -3.55 0.1" sizen="'.$a[5].' 2" halign="center" '.$a[0].' textsize="1" scale="'.$a[1].'" textcolor="FFFF" text="'.$a[3].'REPLAYED"/>
   	    <label posn="2.25 -5 0.1" sizen="8.4 2" halign="center" '.$a[0].' textsize="1" scale="'.$a[2].'" textcolor="FC0F" text="'.$a[4].'NEXT!"/>
   		</frame>
		</manialink>';
		
	} elseif ($state == 'max') {
		
		$xml = '<manialink id="'.$p2p['manialink'].'00">
   	 	<frame posn="'.$p2p['replay']['position'].'">
        <quad posn="0 0 0" sizen="4.6 6.5" style="BgsPlayerCard" substyle="BgCardSystem"/>
        <label posn="2.25 -0.75 0.1" sizen="5 2" halign="center"  textsize="1" scale="0.9" textcolor="FFFF" text="MAXIMUM"/>
        <label posn="2.25 -2.3 0.1" sizen="8.4 2" halign="center"  textsize="1" scale="0.6" textcolor="FC0F" text="REPLAY"/>
        <label posn="2.25 -3.55 0.1" sizen="5 2" halign="center"  textsize="1" scale="0.9" textcolor="FFFF" text="LIMIT"/>
        <label posn="2.25 -5 0.1" sizen="8.4 2" halign="center"  textsize="1" scale="0.6" textcolor="FC0F" text="REACHED!"/>
    	</frame>
		</manialink>';
			
	} else {
	
		$xml = '<manialink id="'.$p2p['manialink'].'00">
  	  <frame posn="'.$p2p['replay']['position'].'">
  	    <quad posn="0 0 0" sizen="4.6 6.5" style="BgsPlayerCard" substyle="BgCardSystem" action="'.$p2p['manialink'].'|replay"/>
  	    <label posn="2.25 -0.75 0.1" sizen="5 2" halign="center"  textsize="1" scale="0.9" textcolor="FFFF" text="PAY '.$p2p['replay']['cost'].'"/>
   	    <label posn="2.25 -2.3 0.1" sizen="8.4 2" halign="center"  textsize="1" scale="0.6" textcolor="FC0F" text="PLANETS"/>
   	    <label posn="2.25 -3.55 0.1" sizen="5 2" halign="center"  textsize="1" scale="0.9" textcolor="FFFF" text="FOR"/>
   	    <label posn="2.25 -5 0.1" sizen="8.4 2" halign="center"  textsize="1" scale="0.6" textcolor="FC0F" text="REPLAY"/>
   	 </frame>
		</manialink>';
	}
	$aseco->client->addCall('SendDisplayManialinkPage', array($xml, 0, false));
}

function p2p_buildSkip($aseco, $state = false) { //Build skip widget
	global $p2p;
	
	if ($state == 'success') {
		
		if ($p2p['skip']['blink']) {
			$a = array('style="TextTitle2Blink"', 0.5, 0.35, '$ccc', '$c90', 7);
		} else {
			$a = array('', 0.9, 0.6, '', '', 5);
		}
		
		$xml = '<manialink id="'.$p2p['manialink'].'01">
 		  <frame posn="'.$p2p['skip']['position'].'">
				<quad posn="0 0 0" sizen="4.6 6.5" style="BgsPlayerCard" substyle="BgCardSystem"/>
	      <label posn="2.25 -0.75 0.1" sizen="'.$a[5].' 2" halign="center" '.$a[0].' textsize="1" textcolor="FFFF" scale="'.$a[1].'" text="'.$a[3].'MAP"/>
				<label posn="2.25 -2.3 0.1" sizen="8.4 2" halign="center" '.$a[0].' textsize="1" textcolor="FCOF" scale="'.$a[2].'" text="'.$a[4].'WILL BE"/>
				<label posn="2.25 -3.55 0.1" sizen="'.$a[5].' 2" halign="center" '.$a[0].' textsize="1" textcolor="FFFF" scale="'.$a[1].'" text="'.$a[3].'SKIPPED"/>
 	 	    <label posn="2.25 -5 0.1" sizen="8.4 2" halign="center" '.$a[0].' textsize="1" textcolor="FCOF" scale="'.$a[2].'" text="'.$a[4].'SHORTLY!"/>
 			</frame>
		</manialink>';
		
	} else {
	
		$xml = '<manialink id="'.$p2p['manialink'].'01">
 		  <frame posn="'.$p2p['skip']['position'].'">
	      <quad posn="0 0 0" sizen="4.6 6.5" style="BgsPlayerCard" substyle="BgCardSystem" action="'.$p2p['manialink'].'|skip"/>
	      <label posn="2.25 -0.75 0.1" sizen="5 2" halign="center"  textsize="1" scale="0.9" textcolor="FFFF" text="PAY '.$p2p['skip']['cost'].'"/>
 	 	    <label posn="2.25 -2.3 0.1" sizen="8.4 2" halign="center"  textsize="1" scale="0.6" textcolor="FC0F" text="PLANETS"/>
 	 	    <label posn="2.25 -3.55 0.1" sizen="5 2" halign="center"  textsize="1" scale="0.9" textcolor="FFFF" text="FOR"/>
 	 	    <label posn="2.25 -5 0.1" sizen="8.4 2" halign="center"  textsize="1" scale="0.6" textcolor="FC0F" text="SKIP"/>
 	 		</frame>
		</manialink>';
	}
	$aseco->client->addCall('SendDisplayManialinkPage', array($xml, 0, false));
}

function p2p_click($aseco, $command) {  //Deal with button clicks
	global $p2p;
	
	$login = $command[1];
	$answer = $command[2];
	$aseco->client->query('GetDetailedPlayerInfo', $login);
	$player = $aseco->client->getResponse();
	$nickname = $player['NickName'];
	
	if ($answer == $p2p['manialink'].'|replay') {
		$aseco->client->query('GetNextMapInfo');
		$nextmap = $aseco->client->getResponse();
		if ($p2p['thismap']['FileName'] != $nextmap['FileName']) {
			$message = 'You need to pay '.$p2p['replay']['cost'].' planets to replay this map';
			$aseco->client->query('SendBill', $login, $p2p['replay']['cost'], $message, '');
			$id = $aseco->client->getResponse();
			$p2p['bills'][$id] = array($login, $nickname, 'replay');
		} else {
			$message = '>$f00 This track is already being replayed';
			$aseco->client->query('ChatSendServerMessageToLogin', $message, $login);
		}
	} elseif ($answer == $p2p['manialink'].'|skip') {
		if ($p2p['timelimit'] >= $p2p['skip']['delay'] + time() + 10) {
			$message = 'You need to pay '.$p2p['skip']['cost'].' planets to skip this map';
			$aseco->client->query('SendBill', $login, $p2p['skip']['cost'], $message, '');
			$id = $aseco->client->getResponse();
			$p2p['bills'][$id] = array($login, $nickname, 'skip');
		} else {
			$message = '>$f00 This track will end before your action can be completed, please be patient.';
			$aseco->client->query('ChatSendServerMessageToLogin', $message, $login);
		}
	}
}

function p2p_bill($aseco, $bill) {  //Deal with bill payments
	global $p2p, $jukebox, $atl_restart;
	$id = $bill[0];
	// check for known bill ID
	if (array_key_exists($id, $p2p['bills'])) {
		// get bill info
		$login = $p2p['bills'][$id][0];
		$nickname = $p2p['bills'][$id][1];
		$state = $p2p['bills'][$id][2];
		$planets = $p2p[$state]['cost'];
		
		if ($state == 'replay') {
				// check bill state
			switch($bill[1]) {
			case 4:  // Payed (Paid)
				if (!$p2p['score']) {
					$uid = $aseco->server->map->uid;
					$jukebox = array_reverse($jukebox, true);
					$jukebox[$uid]['FileName'] = $aseco->server->map->filename;
					$jukebox[$uid]['Name'] = $aseco->server->map->name;
					$jukebox[$uid]['Env'] = $aseco->server->map->environment;
					$jukebox[$uid]['Login'] = $login;
					$jukebox[$uid]['Nick'] = $nickname;
					$jukebox[$uid]['source'] = 'Pay2Play';
					$jukebox[$uid]['mx'] = false;
					$jukebox[$uid]['uid'] = $uid;
					$jukebox = array_reverse($jukebox, true);
					$aseco->releaseEvent('onJukeboxChanged', array('replay', $jukebox[$uid]));
				} else {
					if (isset($atl_restart)) $atl_restart = true;
					$aseco->client->query('RestartMap');
				}				
				$message = '$s$f90Player $z$s'.$nickname.'$z$s$f90  pays '.$planets.' planets and queues map for replay!';
				$aseco->client->query('ChatSendServerMessage', $message);
				$aseco->console('Player {1} paid {2} planets to replay the current track', $login, $planets);
				unset($p2p['bills'][$id]);
				$p2p['replay']['success'] = true;
				$p2p['replay']['total']++;
				if (!$p2p['score']) {
					p2p_buildReplay($aseco, 'success');
				}
				break;
			case 5:  // Refused
				$message = '{#server}> {#error}Transaction refused!';
				$aseco->client->query('ChatSendServerMessageToLogin', $aseco->formatColors($message), $login);
				unset($p2p['bills'][$id]);
				break;
			case 6:  // Error
				$message = '{#server}> {#error}Transaction failed: {#highlite}$i ' . $bill[2];
				if ($login != '')
					$aseco->client->query('ChatSendServerMessageToLogin', $aseco->formatColors($message), $login);
				else
					$aseco->client->query('ChatSendServerMessage', $aseco->formatColors($message));
				unset($p2p['bills'][$id]);
				break;
			default:  // CreatingTransaction/Issued/ValidatingPay(e)ment
				break;
			}
		} elseif ($state == 'skip') {
				// check bill state
			switch($bill[1]) {
			case 4:  // Payed (Paid)
				$time = time() + $p2p['skip']['delay'];
				$p2p['time']['skip'] = $time;
				$message = '$s$f90Player $z$s'.$nickname.'$z$s$f90  pays '.$planets.' planets. Map will be skipped shortly!';
				$aseco->client->query('ChatSendServerMessage', $message);
				$aseco->console('Player {1} paid {2} planets to skip the current track', $login, $planets);
				unset($p2p['bills'][$id]);
				$p2p['skip']['success'] = true;
				p2p_buildSkip($aseco, 'success');
				break;
			case 5:  // Refused
				$message = '{#server}> {#error}Transaction refused!';
				$aseco->client->query('ChatSendServerMessageToLogin', $aseco->formatColors($message), $login);
				unset($p2p['bills'][$id]);
				break;
			case 6:  // Error
				$message = '{#server}> {#error}Transaction failed: {#highlite}$i ' . $bill[2];
				if ($login != '')
					$aseco->client->query('ChatSendServerMessageToLogin', $aseco->formatColors($message), $login);
				else
					$aseco->client->query('ChatSendServerMessage', $aseco->formatColors($message));
				unset($p2p['bills'][$id]);
				break;
			default:  // CreatingTransaction/Issued/ValidatingPay(e)ment
				break;
			}
		}		
	}
}

function p2p_time($aseco) { //Deal with time functions
	global $p2p;
	
	if (isset($p2p['time']['skip'])) {
		$time = time();
		
		if ($time >= $p2p['time']['skip']) {
			// load the next map
			// don't clear scores if in Cup mode
			if ($aseco->server->gameinfo->mode == 5)
				$aseco->client->query('NextMap', true);
			else
				$aseco->client->query('NextMap');
			unset($p2p['time']['skip']);
		}
	}
}

function p2p_apocalypse($aseco) { //Restore altered callvotes
	global $p2p;
	
	$aseco->client->query('SetCallVoteRatios', $p2p['oldvotes']);
}
		
?>
Very big thanks for the help leigham :)