TM-FORUM

The TrackMania universal forum ^_^
It is currently 25 Apr 2017 05:41

All times are UTC + 1 hour




Post new topic Reply to topic  [ 53 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: [XASECO] Plugin: Personal Best Checkpoints 1.0 (UPDATE)
PostPosted: 31 Aug 2010 19:23 
Offline
Pit Crew
Pit Crew
User avatar

Joined: 31 Aug 2009 19:38
Posts: 1304
Location: Germany
Owned TM-games: TMF, TM2C/S/V, SM
Manialink(s): undef, tmkarma
New Bugfix version 1.0 released, see release notes for details.

_________________
Developer of various plugins for XAseco/XAseco2 and MPAseco,
like Records-Eyepiece, TM-Karma, Alternate Scoretable...
Visit my Lab: www.undef.name

Get it now:
» TM2 Valley
» TM2 Canyon
» TM2 Stadium
» SM Storm


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: Personal Best Checkpoints 1.1 (UPDATE)
PostPosted: 05 Sep 2010 12:10 
Offline
Pit Crew
Pit Crew
User avatar

Joined: 31 Aug 2009 19:38
Posts: 1304
Location: Germany
Owned TM-games: TMF, TM2C/S/V, SM
Manialink(s): undef, tmkarma
Just wanna say: There is an update out there... see my first post.

_________________
Developer of various plugins for XAseco/XAseco2 and MPAseco,
like Records-Eyepiece, TM-Karma, Alternate Scoretable...
Visit my Lab: www.undef.name

Get it now:
» TM2 Valley
» TM2 Canyon
» TM2 Stadium
» SM Storm


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: Personal Best Checkpoints 1.1 (UPDATE)
PostPosted: 06 Sep 2010 07:26 
Offline
road tourist
road tourist

Joined: 24 Jul 2008 10:49
Posts: 82
Owned TM-games: TMU
HI undef.de :D
Personal Best Checkpoints 1.0 works perfect
so with v1.1 I have this error when I start xaseco 1.11
Have you a idear why ?
see printscreen here:

http://img269.imageshack.us/img269/2937 ... tcheck.jpg

Thx a lot
and GG to your plugin :thumbsup:


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: Personal Best Checkpoints 1.1 (UPDATE)
PostPosted: 12 Sep 2010 13:01 
Offline
happy cruiser
happy cruiser

Joined: 13 May 2009 19:40
Posts: 144
Owned TM-games: TMN
very good :thumbsup:


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: Personal Best Checkpoints 1.1 (UPDATE)
PostPosted: 14 Sep 2010 18:21 
Offline
Pit Crew
Pit Crew
User avatar

Joined: 31 Aug 2009 19:38
Posts: 1304
Location: Germany
Owned TM-games: TMF, TM2C/S/V, SM
Manialink(s): undef, tmkarma
biloudeprovence wrote:
HI undef.de :D
Personal Best Checkpoints 1.0 works perfect
so with v1.1 I have this error when I start xaseco 1.11
Have you a idear why ?
see printscreen here:

http://img269.imageshack.us/img269/2937 ... tcheck.jpg


Yes, found the bug... i have not tested this plugin without Players connected. The next release are fixed, but not yet released. Maybe next week. :?

_________________
Developer of various plugins for XAseco/XAseco2 and MPAseco,
like Records-Eyepiece, TM-Karma, Alternate Scoretable...
Visit my Lab: www.undef.name

Get it now:
» TM2 Valley
» TM2 Canyon
» TM2 Stadium
» SM Storm


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: Personal Best Checkpoints 1.1 (UPDATE)
PostPosted: 18 Sep 2010 23:35 
Offline
road tourist
road tourist

Joined: 24 Jul 2008 10:49
Posts: 82
Owned TM-games: TMU
Hi undef.de
ok I wait for
thx a lot


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: Personal Best Checkpoints 1.2 (UPDATE)
PostPosted: 17 Oct 2010 16:22 
Offline
Pit Crew
Pit Crew
User avatar

Joined: 31 Aug 2009 19:38
Posts: 1304
Location: Germany
Owned TM-games: TMF, TM2C/S/V, SM
Manialink(s): undef, tmkarma
Just wanna say: There is an update out there... see my first post.

_________________
Developer of various plugins for XAseco/XAseco2 and MPAseco,
like Records-Eyepiece, TM-Karma, Alternate Scoretable...
Visit my Lab: www.undef.name

Get it now:
» TM2 Valley
» TM2 Canyon
» TM2 Stadium
» SM Storm


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: Personal Best Checkpoints 1.2 (UPDATE)
PostPosted: 26 Oct 2010 09:22 
Offline
cyclist
cyclist

Joined: 19 Oct 2010 16:11
Posts: 31
Owned TM-games: TMU
yo all
I would like to add a column or the results displayed but no way to find the line has changed in the plugin (is to adapt the maps rpg)
I have changed : Traduction by google I'm french sorry

Code:
<?php

/*
* Plugin Personal Best Checkpoints
* This Plugin is useful on Train-Servers and maybe RPG-Servers. It displays the
* differences between your own Checkpoint-Times for each run.
*
* The first run on a Challenge are now preset with a local driven record, so you can
* compare from the first run your Checkpoint times. This feature is only active if
* less then 32 Players connected to the Server to prevent long loads on Database access.
*
* Currently it supports the Gamemodes: Rounds, TimeAttack, Team, Laps, Stunts, Cup
* This Plugin works only with TMF!
* ----------------------------------------------------------------------------------
* Author:   undef.de
* Version:   1.2
* Date:   2010-10-17
* Copyright:   2009 - 2010 by undef.de
* Home:   http://www.undef.de/Trackmania/Plugins/
* System:   xaseco/1.06 and up
* ----------------------------------------------------------------------------------
*
* 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
*
* ----------------------------------------------------------------------------------
*
* Dependencies:   plugins/plugin.localdatabase.php
*/

/* The following manialink id's are used in this plugin (the 915 part of id can be changed on trouble):
* 91500      id for manialinks
* 91501      id for manialink for the Widget itself
* 91502      id for manialink Checkpoint-Times and Differences
* 91503      id for manialink for the Help
* 91504      id for action to display Help
* 91505      id for action to close Help
*/

Aseco::registerEvent('onStartup',         'pbcps_onStartup');
Aseco::registerEvent('onCheckpoint',         'pbcps_onCheckpoint');
Aseco::registerEvent('onNewChallenge2',         'pbcps_onNewChallenge2');
Aseco::registerEvent('onPlayerConnect',         'pbcps_onPlayerConnect');
Aseco::registerEvent('onPlayerInfoChanged',      'pbcps_onPlayerInfoChanged');
Aseco::registerEvent('onPlayerManialinkPageAnswer',   'pbcps_onPlayerManialinkPageAnswer');
Aseco::registerEvent('onPlayerFinish',         'pbcps_onPlayerFinish');
Aseco::registerEvent('onEndRace',         'pbcps_onEndRace');         // throw main 'end challenge' event
Aseco::registerEvent('onRestartChallenge',      'pbcps_onRestartChallenge');      // throw 'restarted challenge' event

global $pbcps_config;

/* Just a note for my editor -> utf-8 äöüß */

/*
#///////////////////////////////////////////////////////////////////////#
#                           #
#///////////////////////////////////////////////////////////////////////#
*/

function pbcps_onStartup ($aseco) {
   global $pbcps_config;


   // Check for the right XASECO-Version
   if ( defined('XASECO_VERSION') ) {
      if ( version_compare(XASECO_VERSION, 1.06, '<') ) {
         trigger_error('[plugin.personal_best_checkpoints.php] Not supported xaseco version ('. XASECO_VERSION .')! Please update to min. version 1.11!', E_USER_ERROR);
      }
   }
   else {
      trigger_error('[plugin.personal_best_checkpoints.php] Can not identify the System, "XASECO_VERSION" is unset! This plugin runs only with XASECO/1.11 and up.', E_USER_ERROR);
   }

   // Check for dependencies
   if ( !function_exists('ldb_loadSettings') ) {
      trigger_error('[plugin.personal_best_checkpoints.php] Missing dependent plugin, please activate "plugin.localdatabase.php" in "plugins.xml" and restart.', E_USER_ERROR);
   }

   if ($aseco->server->getGame() != 'TMF') {
      trigger_error('[plugin.personal_best_checkpoints.php] This plugin supports only TMF, can not start with a '. $aseco->server->getGame() .' Dedicated-Server!', E_USER_ERROR);
   }

   // Set 'checkpoint_list' off, this place we need
   setCustomUIField('checkpoint_list', false);

   $pbcps_config['MANIALINK_ID'] = '915';
   $pbcps_config['VERSION'] = '1.2';

   $pbcps_config['WIDGET']['POSITION_X'] = 13;
   $pbcps_config['WIDGET']['POSITION_Y'] = -32.5;
   $pbcps_config['WIDGET']['TEXTSIZE'] = 1;
   $pbcps_config['WIDGET']['TEXTSCALE'] = 0.9;

   $pbcps_config['SHOW_MAX_CHECKPOINTS'] = 27;         // 30 is max.

   // Set current state
   $pbcps_config['CURRENT_STATE'] = 1;
   $pbcps_config['CHALLENGE'] = array();
}

/*
#///////////////////////////////////////////////////////////////////////#
#                           #
#///////////////////////////////////////////////////////////////////////#
*/

function pbcps_onPlayerConnect ($aseco, $player) {
   global $pbcps_config;


   // Clean complete
   $player->data['BPCPS_TIMES'] = array();

   // Set PlayerId (from Database), cache the Id here for later use
   $player->data['BPCPS_DBPLAYERID'] = $aseco->getPlayerId( $player->login );

   // Need to do a trick, because on XASECO StartUp, there is no Challenge loaded
   // and XASECO can not give the number of Checkpoints. So just fill the maximum.
   // When the Challenge is loaded, then this get fixed to the correct number of
   // Checkpoints.
   // If a Player joins when XASECO runs a longer time, then there is the correct
   // number of Checkpoints, because the Challenge is already loaded.
   $pbcps_config['CHALLENGE']['NUM_CPS'] = (isset($pbcps_config['CHALLENGE']['NUM_CPS']) ? $pbcps_config['CHALLENGE']['NUM_CPS'] : $pbcps_config['SHOW_MAX_CHECKPOINTS']);

   // Preset the PBC-Array for current Player
   pbcps_resetPlayerArray($player);

   // Display the empty Widget
   pbcps_displayWidget($player->login);
}

/*
#///////////////////////////////////////////////////////////////////////#
#                           #
#///////////////////////////////////////////////////////////////////////#
*/

// called @ onPlayerInfoChanged
function pbcps_onPlayerInfoChanged ($aseco, $info) {
   global $pbcps_config;


   // Nothing todo at Score
   if ($pbcps_config['CURRENT_STATE'] != 6) {

      // Get Player
      $player = $aseco->server->players->getPlayer($info['Login']);

      if ($player->isspectator == 1) {
         $xml =  '<?xml version="1.0" encoding="UTF-8"?>';
         $xml .= '<manialinks id="'. $pbcps_config['MANIALINK_ID'] .'00">';
         $xml .= '<manialink id="'. $pbcps_config['MANIALINK_ID'] .'01"></manialink>';
         $xml .= '<manialink id="'. $pbcps_config['MANIALINK_ID'] .'02"></manialink>';
         $xml .= '</manialinks>';

         // Hide at Scoretable
         $aseco->client->addCall("SendDisplayManialinkPageToLogin", array($player->login, $xml, 0, false));
      }
      else {
         // Display the empty Widget
         pbcps_displayWidget($player->login);

         // Display the personal checkpoints time for Player
         pbcps_displayPersonalCheckpointsTime($player, -1);
      }
   }
}

/*
#///////////////////////////////////////////////////////////////////////#
#                           #
#///////////////////////////////////////////////////////////////////////#
*/

// called @ onPlayerManialinkPageAnswer


/*
#///////////////////////////////////////////////////////////////////////#
#                           #
#///////////////////////////////////////////////////////////////////////#
*/

// called @ onPlayerFinish
function pbcps_onPlayerFinish ($aseco, $finish_item) {
   global $pbcps_config;


   // Refresh the times without any highlite Checkpoint
   if ($finish_item->score == 0) {
      // Display the personal checkpoint time for Player
      pbcps_displayPersonalCheckpointsTime($finish_item->player, -1);
   }

}

/*
#///////////////////////////////////////////////////////////////////////#
#                           #
#///////////////////////////////////////////////////////////////////////#
*/

function pbcps_onNewChallenge2 ($aseco, $challenge_item) {
   global $pbcps_config;


   // Set current state
   $pbcps_config['CURRENT_STATE'] = 1;

   // Display the empty Widget
   pbcps_displayWidget(false);

   // Returns a struct containing the infos for the current challenge.
   // The struct contains the following fields:
   // Name, UId, FileName, Author, Environnement, Mood, BronzeTime, SilverTime, GoldTime, AuthorTime, CopperPrice, LapRace, NbLaps and NbCheckpoints.
   $aseco->client->query('GetCurrentChallengeInfo');
   $challenge = $aseco->client->getResponse();

   // Save the number of Checkpoints of this Map and if this Map is a Multilap
   $pbcps_config['CHALLENGE']['NUM_CPS'] = $challenge['NbCheckpoints'];
   $pbcps_config['CHALLENGE']['MULTILAP'] = $challenge['LapRace'];
   $pbcps_config['CHALLENGE']['DBID'] = $aseco->server->challenge->id;

   // Reset the PBC-Array for all connected Players
   pbcps_resetPlayerArray(false);
}

/*
#///////////////////////////////////////////////////////////////////////#
#                           #
#///////////////////////////////////////////////////////////////////////#
*/

function pbcps_onRestartChallenge ($aseco, $challenge_item) {
   global $pbcps_config;


   // Set current state
   $pbcps_config['CURRENT_STATE'] = 1;

   // Returns a struct containing the infos for the current challenge.
   // The struct contains the following fields:
   // Name, UId, FileName, Author, Environnement, Mood, BronzeTime, SilverTime, GoldTime, AuthorTime, CopperPrice, LapRace, NbLaps and NbCheckpoints.
   $aseco->client->query('GetCurrentChallengeInfo');
   $challenge = $aseco->client->getResponse();

   // Save the number of Checkpoints of this Map
   $pbcps_config['CHALLENGE']['NUM_CPS'] = $challenge['NbCheckpoints'];

   // Preset the PBC-Array for all Players
   pbcps_resetPlayerArray(false);
}

/*
#///////////////////////////////////////////////////////////////////////#
#                           #
#///////////////////////////////////////////////////////////////////////#
*/

// TMN: [0]=PlayerUid, [1]=Login, [2]=Time, [3]=Score, [4]=CheckpointIndex
// TMF: [0]=PlayerUid, [1]=Login, [2]=TimeScore, [3]=CurLap, [4]=CheckpointIndex
function pbcps_onCheckpoint ($aseco, $checkpt) {
   global $pbcps_config;


   // Set the author of this action
   $player = $aseco->server->players->getPlayer($checkpt[1]);
   $time = $checkpt[2];
   $round = $checkpt[3];
   $CheckpointId = $checkpt[4];


//   $aseco->console('***B CP:'. sprintf("%02d", $CheckpointId) .' RND:'. $round .' TIME:'. $time);

   // Special work for Multilaps Maps in Gamemode 'Laps'
   if ( ($aseco->server->gameinfo->mode == 3) && ($pbcps_config['CHALLENGE']['MULTILAP'] == true) ) {

      // Correct CheckpointId in Multilaps Maps
      $finish = false;
      if ( ($CheckpointId+1) == ($pbcps_config['CHALLENGE']['NUM_CPS'] * $round) ) {
         $round -= 1;

         // Was a finish "Checkpoint"
         $finish = $player->data['BPCPS_LAST_LAP_TIME'];

         // Store the total time for this lap
         $player->data['BPCPS_LAST_LAP_TIME'] = $time;
      }
      if ($round > 0) {
         // The Checkpoints counts up, but i need the Id of the Checkpoint
         $cp = ($CheckpointId - ($pbcps_config['CHALLENGE']['NUM_CPS'] * $round));
         if ($cp >= 0) {
            $CheckpointId = $cp;
         }

         // Calculate the right time for this Checkpoint only if it is not the finish "Checkpoint" for this lap
         if ($finish == false) {
            $time -= $player->data['BPCPS_LAST_LAP_TIME'];
         }
         else {
            $time -= $finish;
         }
      }
   }

//   $aseco->console('***A CP:'. sprintf("%02d", $CheckpointId) .' RND:'. $round .' TIME:'. $time .LF);


   // Calculate the difference between personal Checkpoint time and personal best Checkpoint time
   if ( (!isset($player->data['BPCPS_TIMES'][$CheckpointId]->best_time)) || ($player->data['BPCPS_TIMES'][$CheckpointId]->best_time == -1) ) {
      $differences = 0;
   }
   else {
      $differences = ($time - $player->data['BPCPS_TIMES'][$CheckpointId]->best_time);
   }


   // Prepare the times and style for this Checkpoint
   if ($differences < 0) {

      $differences = abs($differences);
      if ($aseco->server->gameinfo->mode == 4) {
         // Player has a lower Score at this Checkpoint
         $player->data['BPCPS_TIMES'][$CheckpointId]->diff_styled = '$F00-' . $differences;

      }
      else {
         // Player has a better time at this Checkpoint
         $player->data['BPCPS_TIMES'][$CheckpointId]->diff_styled = '$0F0-' . sprintf('%d.%02d', floor($differences/1000), (($differences - (floor($differences/1000) * 1000)) / 10));

         $player->data['BPCPS_TIMES'][$CheckpointId]->best_time = $time;
      }

   }
   elseif ($differences == 0) {

      if ($player->data['BPCPS_TIMES'][$CheckpointId]->best_time == -1) {
         // Player has not driven this Checkpoint before
         if ($aseco->server->gameinfo->mode == 4) {
            $player->data['BPCPS_TIMES'][$CheckpointId]->diff_styled = '$FFF---';
         }
         else {
            $player->data['BPCPS_TIMES'][$CheckpointId]->diff_styled = '$FFF-.--';
         }
         $player->data['BPCPS_TIMES'][$CheckpointId]->best_time = $time;

      }
      else {
         if ($aseco->server->gameinfo->mode == 4) {
            // Player has same Score at this Checkpoint
            $player->data['BPCPS_TIMES'][$CheckpointId]->diff_styled = '$0DF±' . $differences;
         }
         else {
            // Player has same time at this Checkpoint
            $player->data['BPCPS_TIMES'][$CheckpointId]->diff_styled = '$0DF±' . sprintf('%d.%02d', floor($differences/1000), (($differences - (floor($differences/1000) * 1000)) / 10));
         }

      }

   }
   else { // $differences > 0

      if ($aseco->server->gameinfo->mode == 4) {
         // Player has higher Score at this Checkpoint
         $player->data['BPCPS_TIMES'][$CheckpointId]->diff_styled = '$0F0+' . $differences;

         $player->data['BPCPS_TIMES'][$CheckpointId]->best_time = $time;
      }
      else {
         // Player has slower time at this Checkpoint
         $player->data['BPCPS_TIMES'][$CheckpointId]->diff_styled = '$F00+' . sprintf('%d.%02d', floor($differences/1000), (($differences - (floor($differences/1000) * 1000)) / 10));

      }

   }


   // Display the personal checkpoint time for Player
   pbcps_displayPersonalCheckpointsTime($player, $CheckpointId);

}

/*
#///////////////////////////////////////////////////////////////////////#
#                           #
#///////////////////////////////////////////////////////////////////////#
*/

// called @ onEndRace
function pbcps_onEndRace ($aseco, $race) {
   global $pbcps_config;


   // Set current state
   $pbcps_config['CURRENT_STATE'] = 6;

   $xml =  '<?xml version="1.0" encoding="UTF-8"?>';
   $xml .= '<manialinks id="'. $pbcps_config['MANIALINK_ID'] .'00">';
   $xml .= '<manialink id="'. $pbcps_config['MANIALINK_ID'] .'01"></manialink>';
   $xml .= '<manialink id="'. $pbcps_config['MANIALINK_ID'] .'02"></manialink>';
   $xml .= '</manialinks>';

   // Hide at Scoretable
   $aseco->client->addCall("SendDisplayManialinkPage", array($xml, 0, false));
}

/*
#///////////////////////////////////////////////////////////////////////#
#                           #
#///////////////////////////////////////////////////////////////////////#
*/

function pbcps_resetPlayerArray ($player = false) {
   global $aseco, $pbcps_config;


   // bail out immediately if no Player is connected
   if (count($aseco->server->players->player_list) == 0) {
      return;
   }

   if ( ($player == false) && (count($aseco->server->players->player_list) <= 32) ) {
      pbcps_playerArrayPersonal(false);
   }
   else if ( ($player != false) && (count($aseco->server->players->player_list) <= 32) ) {
      pbcps_playerArrayPersonal($player);
   }
   else {
      pbcps_playerArrayNice();
   }
}

/*
#///////////////////////////////////////////////////////////////////////#
#                           #
#///////////////////////////////////////////////////////////////////////#
*/

function pbcps_playerArrayNice () {
   global $aseco, $pbcps_config;


   // Clean Players CP list (Nice-Mode)
   foreach ($aseco->server->players->player_list as $player) {

      // Clean complete
      $player->data['BPCPS_TIMES'] = array();

      // Preset all CPs with -1
      for ($i = 0 ; $i <= $pbcps_config['CHALLENGE']['NUM_CPS'] ; $i ++) {
         $player->data['BPCPS_TIMES'][$i]->best_time = -1;
         $player->data['BPCPS_TIMES'][$i]->diff_styled = '';

      }
      $player->data['BPCPS_LAST_LAP_TIME'] = 0;

      // Display the personal checkpoints time for Player (except Spectators)
      if ($player->isspectator != 1) {
         pbcps_displayPersonalCheckpointsTime($player, -1);
      }
   }
}

/*
#///////////////////////////////////////////////////////////////////////#
#                           #
#///////////////////////////////////////////////////////////////////////#
*/

function pbcps_playerArrayPersonal ($player = false) {
   global $aseco, $pbcps_config;


   // bail out immediately if no Challenge Database Id was set
   if ( !isset($pbcps_config['CHALLENGE']['DBID']) ) {
      return;
   }

   // Preset with local saved Checkpoint times (if any)
   if ($player != false) {
      $query = "SELECT `PlayerId`,`Checkpoints` FROM `records` WHERE `ChallengeId`='". $pbcps_config['CHALLENGE']['DBID'] ."' AND `PlayerId`='". $player->data['BPCPS_DBPLAYERID'] ."' LIMIT 1;";
   }
   else {
      $query = "SELECT `PlayerId`,`Checkpoints` FROM `records` WHERE `ChallengeId`='". $pbcps_config['CHALLENGE']['DBID'] ."' AND `PlayerId` IN (";
      foreach ($aseco->server->players->player_list as $ply) {
         $query .= "'". $ply->data['BPCPS_DBPLAYERID'] ."',";

      }
      $query = substr($query, 0, strlen($query)-1);      // remove the last ,
      $query .= ');';
   }

   $res = mysql_query($query);
   if ($res != false) {

      // Clean complete
      foreach ($aseco->server->players->player_list as $player) {
            $player->data['BPCPS_TIMES'] = array();
      }

      // Fill with local record
      while ($row = mysql_fetch_object($res)) {
         foreach ($aseco->server->players->player_list as $player) {
            if ($player->data['BPCPS_DBPLAYERID'] == $row->PlayerId) {

               $cps = explode(',', $row->Checkpoints);
               for ($i = 0 ; $i <= $pbcps_config['CHALLENGE']['NUM_CPS'] ; $i ++) {
                  $player->data['BPCPS_TIMES'][$i]->best_time = ((isset($cps[$i]) && $cps[$i]!='') ? $cps[$i] : -1);
                  $player->data['BPCPS_TIMES'][$i]->diff_styled = '';

               }
               $player->data['BPCPS_LAST_LAP_TIME'] = 0;

               // Display the personal checkpoints time for Player (except Spectators)
               if ($player->isspectator != 1) {
                  pbcps_displayPersonalCheckpointsTime($player, -1);
               }
            }
         }
      }

      // Find Players without a local record and preset with empty time
      foreach ($aseco->server->players->player_list as $player) {
         if (count($player->data['BPCPS_TIMES']) == 0) {
            // Preset all CPs with -1
            for ($i = 0 ; $i <= $pbcps_config['CHALLENGE']['NUM_CPS'] ; $i ++) {
               $player->data['BPCPS_TIMES'][$i]->best_time = -1;
               $player->data['BPCPS_TIMES'][$i]->diff_styled = '';

            }
            $player->data['BPCPS_LAST_LAP_TIME'] = 0;
         }
      }

   }
   else {
      $aseco->console('[plugin.personal_best_checkpoints.php] SQL error: '. mysql_error() .' [for statement "'. $query .'"]');
      pbcps_playerArrayNice();
   }
   mysql_free_result($res);
}

/*
#///////////////////////////////////////////////////////////////////////#
#                           #
#///////////////////////////////////////////////////////////////////////#
*/

function pbcps_displayWidget ($login = false) {
   global $aseco, $pbcps_config;




   $xml .= '</frame>';
   $xml .= '</manialink>';
   $xml .= '</manialinks>';

   if ($login != false) {
      // Send to $login
      $aseco->client->addCall("SendDisplayManialinkPageToLogin", array($login, $xml, 0, false));
   }
   else {
      // Send to all Players
      $aseco->client->addCall("SendDisplayManialinkPage", array($xml, 0, false));
   }
}

/*
#///////////////////////////////////////////////////////////////////////#
#                           #
#///////////////////////////////////////////////////////////////////////#
*/

function pbcps_displayHelp ($aseco, $login, $display = true) {
   global $pbcps_config;


   // Set the message
   $message = array(
      'With this Widget you can see the differences between your driven times for each Checkpoint.',
      '',
      'Detailed description of the times:',
      '  $F00+0.28 $FF0 You was slower as the run before',
      '  $0DF±0.00 $FF0 You was exact same fast as the run before',
      '  $0F0-0.32  $FF0 You was faster as the run before',
      '   $FFF---     $FF0 Checkpoint was first time reached',
      '',
      'The last reached Checkpoints blinks, so you can find quickly the last reached Checkpoint.',
      '',
      'The Bar at the right of this Widget changes the color in exact the same behavior as the Checkpoint-Times, so you does not need',
      'to look at every Checkpoint to this Widget, you can see your differences just out of the corners of your eyes.'
   );


   $xml =  '<?xml version="1.0" encoding="UTF-8"?>';
   $xml .= '<manialinks id="'. $pbcps_config['MANIALINK_ID'] .'00">';
   $xml .= '<manialink id="'. $pbcps_config['MANIALINK_ID'] .'03">';

   if ($display == true) {
      // Window

      // Header Line

      // Close Button


      // Set the width of MessageWindow
      $width = 75;
      $line_height = 1.65;
      $position = 0;

      $xml .= '<frame posn="3 -6 0">';
      foreach ($message as $msg) {
         if ($msg) {
            $xml .= '<label posn="0 '. $position .' 0.05" sizen="'. ($width-2.6) .' 0" halign="left" textsize="1" textcolor="FFFF" text="'. $msg .'"/>';
         }
         $position -= $line_height;
      }
      $xml .= '</frame>';


      $xml .= '</frame>';   // Window
   }

   $xml .= '</manialink>';
   $xml .= '</manialinks>';

   // Send Help to given Player
   $aseco->client->addCall('SendDisplayManialinkPageToLogin', array($login, $xml, 0, false));
}

/*
#///////////////////////////////////////////////////////////////////////#
#                           #
#///////////////////////////////////////////////////////////////////////#
*/

function pbcps_displayPersonalCheckpointsTime ($player, $cpid = -1) {
   global $aseco, $pbcps_config;


   $CheckpointId = (($cpid != -1) ? $cpid : 0);

   $xml =  '<?xml version="1.0" encoding="UTF-8"?>';
   $xml .= '<manialinks id="'. $pbcps_config['MANIALINK_ID'] .'00">';
   $xml .= '<manialink id="'. $pbcps_config['MANIALINK_ID'] .'02">';
   $xml .= '<frame posn="'. $pbcps_config['WIDGET']['POSITION_X'] .' '. $pbcps_config['WIDGET']['POSITION_Y'] .' 3">';


   $lines = 1;
   $posx = 0;
   $posy = 0;
   $offsety = 1.37;
   $CheckpointCount = 0;
   foreach ($player->data['BPCPS_TIMES'] as $struct) {

      // Show max. $pbcps_config['SHOW_MAX_CHECKPOINTS'] Checkpoints
      if (($CheckpointCount+1) > $pbcps_config['SHOW_MAX_CHECKPOINTS']) {
         break;
      }

//      // Hide not passed Checkpoints
//      if ($CheckpointCount > $CheckpointId) {
//         break;
//      }

      // Do not show Finish
      if (($CheckpointCount+1) == $pbcps_config['CHALLENGE']['NUM_CPS']) {
         break;
      }


      // Check for max. line count
      if ($lines == 10) {
         $lines = 1;
      }
      $posy = -($offsety * $lines);

      // Check for next block
      if ( ($CheckpointCount == 9) || ($CheckpointCount == 18) ) {
         $posx += 12;
      }


      if ( ($CheckpointCount == $CheckpointId) && ($cpid != -1) ) {
         // Highlight current Checkpoint
         $xml .= '<format style="TextTitle2Blink"/>';
      }
      else {
         // No Highlight
         $xml .= '<format style="TextStaticMedium"/>';
      }

      $xml .= '<label posn="'. ($posx + 1.85) .' '. $posy .' 0.14" sizen="1.5 0" halign="right" textsize="'. $pbcps_config['WIDGET']['TEXTSIZE'] .'" scale="'. $pbcps_config['WIDGET']['TEXTSCALE'] .'" textcolor="FFFF" text="'. ($CheckpointCount+1) .'."/>';
      $xml .= '<label posn="'. ($posx + 6.3) .' '. $posy .' 0.14" sizen="4.3 0" halign="right" textsize="'. $pbcps_config['WIDGET']['TEXTSIZE'] .'" scale="'. $pbcps_config['WIDGET']['TEXTSCALE'] .'" textcolor="FFFF" text="'. (($aseco->server->gameinfo->mode == 4) ? $player->data['BPCPS_TIMES'][$CheckpointCount]->best_time : formatTime($player->data['BPCPS_TIMES'][$CheckpointCount]->best_time)) .'"/>';
      $xml .= '<label posn="'. ($posx + 10.6) .' '. $posy .' 0.14" sizen="4.3 0" halign="right" textsize="'. $pbcps_config['WIDGET']['TEXTSIZE'] .'" scale="'. $pbcps_config['WIDGET']['TEXTSCALE'] .'" text="'. $player->data['BPCPS_TIMES'][$CheckpointCount]->diff_styled .'"/>';

      $CheckpointCount++;
      $lines++;
   }

   $xml .= '</frame>';
   $xml .= '</manialink>';
   $xml .= '</manialinks>';

   $aseco->client->addCall("SendDisplayManialinkPageToLogin", array($player->login, $xml, 0, false));
}

?>


thank you for your help


Last edited by pro_info on 28 Oct 2010 13:15, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: Personal Best Checkpoints 1.2 (UPDATE)
PostPosted: 26 Oct 2010 10:03 
Offline
Pit Crew
Pit Crew
User avatar

Joined: 25 Feb 2009 17:43
Posts: 286
Location: Brabant, Netherlands
Owned TM-games: TMU(F), TMN(F), TM2
Please use the [ code ] tag when posting codes!

_________________
Dutch ManiaPlanet Moderator
Founder and developer of the MLEPP Project
Image
Image


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: Personal Best Checkpoints 1.2 (UPDATE)
PostPosted: 26 Oct 2010 18:19 
Offline
Pit Crew
Pit Crew
User avatar

Joined: 31 Aug 2009 19:38
Posts: 1304
Location: Germany
Owned TM-games: TMF, TM2C/S/V, SM
Manialink(s): undef, tmkarma
pro_info wrote:
yo all
I would like to add a column or the results displayed but no way to find the line has changed in the plugin (is to adapt the maps rpg)
I have changed : Traduction by google I'm french sorry

thank you for your help


Sorry here again, i realy did you understand what you want here. :( Maybe a screenshot with your wanted extention could help.

_________________
Developer of various plugins for XAseco/XAseco2 and MPAseco,
like Records-Eyepiece, TM-Karma, Alternate Scoretable...
Visit my Lab: www.undef.name

Get it now:
» TM2 Valley
» TM2 Canyon
» TM2 Stadium
» SM Storm


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: Personal Best Checkpoints 1.2 (UPDATE)
PostPosted: 28 Oct 2010 13:18 
Offline
cyclist
cyclist

Joined: 19 Oct 2010 16:11
Posts: 31
Owned TM-games: TMU
I try to modify the plugin to display 4 columns instead of 3 to have the opportunity to make them appear more checkpoints (for server RPG)
Image + Image + Image

I want to add columns
I hope you understand


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: Personal Best Checkpoints 1.2 (UPDATE)
PostPosted: 28 Oct 2010 17:49 
Offline
Pit Crew
Pit Crew
User avatar

Joined: 31 Aug 2009 19:38
Posts: 1304
Location: Germany
Owned TM-games: TMF, TM2C/S/V, SM
Manialink(s): undef, tmkarma
pro_info wrote:
I try to modify the plugin to display 4 columns instead of 3 to have the opportunity to make them appear more checkpoints (for server RPG)
Image + Image + Image

I want to add columns
I hope you understand


You can see at my Screenshots, that there is no space left to add one column to this plugin. So i can´t do it into this Plugin.

But i see at your Screenshots, that you have removed one "time column", i could build an new plugin that display the checkpoint counts and the driven time, when that is what you want to have for your RPG server.

_________________
Developer of various plugins for XAseco/XAseco2 and MPAseco,
like Records-Eyepiece, TM-Karma, Alternate Scoretable...
Visit my Lab: www.undef.name

Get it now:
» TM2 Valley
» TM2 Canyon
» TM2 Stadium
» SM Storm


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: Personal Best Checkpoints 1.2 (UPDATE)
PostPosted: 28 Oct 2010 18:13 
Offline
cyclist
cyclist

Joined: 19 Oct 2010 16:11
Posts: 31
Owned TM-games: TMU
my capture screenshot is a montage of several images so I did not delete but can we add a column?

I just simply remove the bar and the gray background


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: Personal Best Checkpoints 1.2 (UPDATE)
PostPosted: 28 Oct 2010 21:02 
Offline
Pit Crew
Pit Crew
User avatar

Joined: 31 Aug 2009 19:38
Posts: 1304
Location: Germany
Owned TM-games: TMF, TM2C/S/V, SM
Manialink(s): undef, tmkarma
pro_info wrote:
my capture screenshot is a montage of several images so I did not delete but can we add a column?

I just simply remove the bar and the gray background


If you are a programmer, then it should be a problem to add one column there. If not, then it´s too hard. But i could build a extra plugin which displays only the checkpoint count and the time... maybe the current place can have then maybe 4-5 columns (e.g. 40-50 checkpoints).

_________________
Developer of various plugins for XAseco/XAseco2 and MPAseco,
like Records-Eyepiece, TM-Karma, Alternate Scoretable...
Visit my Lab: www.undef.name

Get it now:
» TM2 Valley
» TM2 Canyon
» TM2 Stadium
» SM Storm


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: Personal Best Checkpoints 1.2 (UPDATE)
PostPosted: 28 Oct 2010 22:07 
Offline
cyclist
cyclist

Joined: 19 Oct 2010 16:11
Posts: 31
Owned TM-games: TMU
I always say as can add a column that is already well


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 53 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group