User Tools

Site Tools


dev:plugin:localrecords

LocalRecords

Provides localrecords for Trackmania2 server.

Depends on : Core and Database plugin

Plugin info

Plugin keeps a track of all players map times. Since a map uid is unique it will be used along with the players login and the number of laps as primary key. Using number of laps as primary key allows the plugin not just to save best laps times but also best overall time. This way the plugin can be used both ways. (At the moment we can only use it to do only 1. It is planned to save both, best lap and overall best time)

We will use the exp_players table created by the Database plugin to get more information about a player, even if this player is offline.

The plugin will also calculate an overall rank for each players connected to the server, and the best ranked 100 players. It will use the rank of players on each track on the servers. Ranks for players connected to the server are only calculated onBegin map to decrease server load that players that pop up in the servers cause.

Top100 are refreshed if necessary by default every 5 maps only.

appendix: dbPlayer

class Record {
 
    public $isNew = false;
    public $isUpdated = false;
 
    public $place;
    public $login;
    public $nickName;
    public $time;
    public $nbFinish;
    public $nbWins;
    public $avgScore;
    public $ScoreCheckpoints = array();
    public $date;
    public $nation;
}

appendix: Database Structure

exp_players

# Name Type Null Other
1 login varchar(255) No unique, index
2 nickname text No

exp_records

# Name Type Null Other
1 record_id INT No PRIMARY KEY
2 record_challengeuid VARCHAR No KEY
3 record_playerlogin VARCHAR No KEY
5 record_nbLaps INT No KEY
6 record_score INT No
7 record_nbFinish INT No
8 record_avgScore INT No
9 record_checkpoints TEXT No
10 record_date INT No
dev/plugin/localrecords.txt · Last modified: 2013/07/17 10:08 (external edit)