[XASECO2] Plugin Checkpoint-Records Widget

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

Moderators: Xymph, TM-Patrol

weasel
speedy pilot
speedy pilot
Posts: 335
Joined: 11 Mar 2011 23:44
Owned TM-games: TMN, TMU, TMF,TM2all

Re: [XASECO2] Plugin Checkpoint-Records Widget

Post by weasel » 13 May 2016 10:50

A few posts above :

mikro wrote:
Cp's on last update Maniaplanet 3 not show ???

Simple Bug in Script.

Show on line 126 in plugin.cprecords.php

Code: Select all

$xml='<?xml version="1.0" encoding="UTF-8"? >';
and change to:

Code: Select all

$xml='<?xml version="1.0" encoding="UTF-8" ?>';
I think the plugin was not updated or so , hope this was youre problem.
Last edited by Xymph on 13 May 2016 10:55, edited 1 time in total.
Reason: Use code tags for code/configs/logs...

KaaMeLoTT
pedestrian
pedestrian
Posts: 10
Joined: 05 Apr 2016 11:07
Owned TM-games: TMUF/TM2Stadium/TMT

Re: [XASECO2] Plugin Checkpoint-Records Widget

Post by KaaMeLoTT » 13 May 2016 22:24

Thanks man, I will try this tomorrow and come Back to say you if it work !

Thanks and sorry to dont see that :/

KaaMeLoTT
pedestrian
pedestrian
Posts: 10
Joined: 05 Apr 2016 11:07
Owned TM-games: TMUF/TM2Stadium/TMT

Re: [XASECO2] Plugin Checkpoint-Records Widget

Post by KaaMeLoTT » 14 May 2016 08:30

That's work omg !!! thank you very much man ! ;)

weasel
speedy pilot
speedy pilot
Posts: 335
Joined: 11 Mar 2011 23:44
Owned TM-games: TMN, TMU, TMF,TM2all

Re: [XASECO2] Plugin Checkpoint-Records Widget

Post by weasel » 14 May 2016 08:58

No problem , glad I could help.

KaaMeLoTT
pedestrian
pedestrian
Posts: 10
Joined: 05 Apr 2016 11:07
Owned TM-games: TMUF/TM2Stadium/TMT

Re: [XASECO2] Plugin Checkpoint-Records Widget

Post by KaaMeLoTT » 24 Dec 2016 12:23

Hello everybody !

I'm here because I have an issue with the plugin, I would like that the cp has been showed in vertical/column. So I changed the "h" by a "v" in the line 11.
But it doesn't work, the cp are in line on my server :/

Need help please, I searched on the PHP files but didn't find anything.

Thanks.

And merry christmas to everyone and happy new year ! ;)

KaaMeLoTT
pedestrian
pedestrian
Posts: 10
Joined: 05 Apr 2016 11:07
Owned TM-games: TMUF/TM2Stadium/TMT

Re: [XASECO2] Plugin Checkpoint-Records Widget

Post by KaaMeLoTT » 11 Jan 2017 19:05

I rly need help

weasel
speedy pilot
speedy pilot
Posts: 335
Joined: 11 Mar 2011 23:44
Owned TM-games: TMN, TMU, TMF,TM2all

Re: [XASECO2] Plugin Checkpoint-Records Widget

Post by weasel » 14 Jan 2017 15:26

Gonna look at this.

Well , it works fine here.

Line 11 of the cprecords.xml file :

<orientation>v</orientation>


You have to restart xaseco after that change ofcourse , otherwise it won't work.

weasel
speedy pilot
speedy pilot
Posts: 335
Joined: 11 Mar 2011 23:44
Owned TM-games: TMN, TMU, TMF,TM2all

Re: [XASECO2] Plugin Checkpoint-Records Widget

Post by weasel » 15 Jan 2017 15:27

So , did it work for you also ?

KaaMeLoTT
pedestrian
pedestrian
Posts: 10
Joined: 05 Apr 2016 11:07
Owned TM-games: TMUF/TM2Stadium/TMT

Re: [XASECO2] Plugin Checkpoint-Records Widget

Post by KaaMeLoTT » 15 Jan 2017 17:07

I did it ofc, and doesn't work, cp appears horizontally

weasel
speedy pilot
speedy pilot
Posts: 335
Joined: 11 Mar 2011 23:44
Owned TM-games: TMN, TMU, TMF,TM2all

Re: [XASECO2] Plugin Checkpoint-Records Widget

Post by weasel » 02 Apr 2017 00:23

Code: Select all

<?php
/*****************************************************************************************
******************************************************************************************
**  Description : Displays the checkpoint-records of the current track in a widget      **
**                                                                                      **
**  Version: 0.94                                                                       **  
**  Author: junglehero                                                                  **
******************************************************************************************
*****************************************************************************************/                                                          

Aseco::registerEvent('onPlayerConnect', 'playerConnection');
Aseco::registerEvent("onCheckpoint", "get_cp_data");
Aseco::registerEvent("onEndMap", "update_display");
Aseco::registerEvent("onBeginMap", "init_cprecords");

$widget_data = array();
$cpdata = array();
$settings = array();

class tab{
    var $time;
	var $nickname;
	
	function tab($time, $nickname){
		$this->time = $time;
		$this->nickname = $nickname;
	}
}

function update_display($aseco, $end) {
    global $widget_data, $settings;
    if(strtoupper($settings->podium) =='FALSE') {
	   $xml='<manialink id="987123654"></manialink>';
	   $aseco->client->addCall("SendDisplayManialinkPage", array($xml, 0, false));
	}
	else {
	   $xml = get_manialink($widget_data, true);
	   $aseco->client->query("SendDisplayManialinkPage", $xml, 0, false);
	}
}

function init_cprecords($aseco, $challenge) {
    global $numcps, $widget_data, $settings;
    $settings = simplexml_load_file('cprecords.xml');
    $numcps = $challenge->nbchecks;
    $widget_data = array();
    $xml='<manialink id="987123654"></manialink>';
    $aseco->client->addCall("SendDisplayManialinkPage", array($xml, 1, false));
}

function playerConnection($aseco, $player) {
    global $widget_data;
    $xml = '';
    if($widget_data) {
        $xml = get_manialink($widget_data);
        $aseco->client->addCall("SendDisplayManialinkPageToLogin", array($player->login, $xml, 0, false));
    }
}

function get_cp_data($aseco, $param){
	global  $widget_data, $nickname, $time, $cp, $numcps;
	$xml = '';
	$cp_update = false;
	$nickname = $aseco->server->players->player_list[$param[1]]->nickname;
	$time = $param[2];
	$cp = $param[4];
	
	
	if(isset($widget_data[$cp])) {
        if($time < $widget_data[$cp]->time && $cp < ($numcps-1)) {
    	   $widget_data[$cp] = new tab($time, $nickname);
    	   $cp_update = true;
    	}
	}
	else if($cp < ($numcps-1)) {
        $widget_data[$cp] = new tab($time, $nickname);
        $cp_update = true;
	}
	if($cp_update) {
    	$xml = get_manialink($widget_data);
    	$aseco->client->query("SendDisplayManialinkPage", $xml, 0, false);
	}
 }
	
function get_manialink($cpdata, $end=false) {
    global $numcps, $settings,$aseco;
    $startX = $settings->pos->posX;
    $startY = $settings->pos->posY;
    $width = 14.5;
    $height = 3;
    $heightcount = 0;
	$count = 0;
	$cpnr = 1;
	$cpdisp = '';
	$max_disp_cps = $settings->numtabs;
	$orientation = strtoupper($settings->orientation);
	$line = 0;
	$newLine = 1;
	$number_of_lines = 1;
	$player = '';
	$zeit = 0;
	$disp_cpnum = 0;
	$has_value = false;
    
	if($end == true && strtoupper($settings->switchPos) == 'TRUE') {
	   $startX = $settings->end->pos->posX;
	   $startY = $settings->end->pos->posY;
	   $max_disp_cps = $settings->end->numtabs;
	   $orientation = 'H';
	   if(strtoupper($settings->end->center) == 'TRUE') {
	       $leftX = $settings->end->range->posXleft;
	       $rightX = $settings->end->range->posXright;
	       $number_of_lines = ceil(count($cpdata) / $max_disp_cps);
	       		
	       if(count($cpdata) < $max_disp_cps) {
	           $number_of_tabs = count($cpdata);
	       }
	       else {
	           $number_of_tabs = $max_disp_cps;
	       }
	       $startX = round((($leftX + $rightX) /2 - $number_of_tabs * 14.5 / 2), 1);
	   }
	}
	
	$xml='<?xml version="1.0" encoding="UTF-8"? >';
	$xml.='<manialink id="987123654">';
	$xml.='<frame posn="'.$startX.' '.$startY.' 0">';
	$xml.='<format textsize="1"/>';
	
	
	for($i=0; $i<($numcps-1); $i++) {
	   if(isset($cpdata[$i])) {
            $zeit = $cpdata[$i]->time;
            $player = $cpdata[$i]->nickname;
            $disp_cpnum = $i+1;
            $has_value = true;
        }
        if($has_value) {
        $min = (int) (($zeit) / 60000);
		$sec = (int) ((($zeit) - $min * 60000) / 1000);
		$mil = (($zeit - $min*60000 - $sec*1000));
		if($sec < 10) {
		  $sec = '0'.$sec;
		}
		if($mil < 100 && $mil >= 10) {
		  $mil = '0'.$mil;
		}
		if($mil < 10) {
		  $mil = '00'.$mil;
		}
        
        if(($cpnr-1) % $max_disp_cps == 0 && ($cpnr-1) != 0) {
            $newLine++;
            if($orientation == 'H') {
                $Y_Pos = -3;
                $X_Pos = 0;
            }
            if($orientation == 'V') {
                $Y_Pos = 0;
                $X_Pos = 14.5;
            }
            
            if($orientation == 'H' && $number_of_lines == $newLine && (strtoupper($settings->end->center)) == 'TRUE' && $end == true) {
                $tabs_in_last_line = count($cpdata) - ($newLine-1)  * $max_disp_cps;
                if($tabs_in_last_line < $max_disp_cps) {
                    $X_Pos = round(($max_disp_cps * 14.5 /2 - $tabs_in_last_line * 14.5 / 2), 1);
                }
                else {
                    $X_Pos = 0;
                }
            }
            
            $count = 0;
            $heightcount = 0; 
            $line++;
            $xml.='<frame posn="'.$X_Pos.' '.$Y_Pos.' 0">';
        }
        
        
        if($orientation == 'V') {
            $pos_y = -3*$heightcount;
            $pos_y1 = -3*$heightcount-0.9;
            $pos_x = 0;
            $pos_x1 = 2;
            $pos_x2 = 9;
            $heightcount++; 
        }
        if($orientation == 'H') {
            $pos_y = '0';
            $pos_y1 = '-0.9';
            $pos_x = $width * $count;
            $pos_x1 = $width * $count + 2;
            $pos_x2 = $width * $count + 9;
            $count++; 
        }
        $xml.='<quad sizen="14 3" posn="'.$pos_x.' '.$pos_y.' 0" style="BgsPlayerCard" substyle="BgCard"/>';
        $xml.='<label sizen="2 1" halign="left" posn="'.$pos_x.' '.$pos_y1.' 0.1" textcolor="0FFA" text="$nCP'.$disp_cpnum.'"/>';
        $xml.='<label sizen="4 1" halign="left" posn="'.$pos_x1.' '.$pos_y1.' 0.1" text="$n'.$min.':'.$sec.'.'.$mil.'"/>';
        $xml.='<label sizen="8 1" halign="center" posn="'.$pos_x2.' '.$pos_y1.' 0.1" text="'.$player.'"/>';
             
        $cpnr++;
        $has_value = false;
	}
	}
	
	for($i=0; $i<$line; $i++) {
        $xml.='</frame>';
    }
    
	$xml.='</frame></manialink>'; 
	return $xml;
	

}


?>
How can I change the space between the widgets , using them horizontal ?

weasel
speedy pilot
speedy pilot
Posts: 335
Joined: 11 Mar 2011 23:44
Owned TM-games: TMN, TMU, TMF,TM2all

Re: [XASECO2] Plugin Checkpoint-Records Widget

Post by weasel » 04 Apr 2017 15:42

Found it , changed every 14.5 into 14.

Post Reply