Open your core/common/StatsData.class.php file and find this:
public static function PilotCount($airline_code='')
{
$key = 'pilot_count';
if($airline_code != '')
{
$key .= '_'.$airline_code;
}
$total = CodonCache::read($key);
if($total === false)
{
$params = array(
'table' => TABLE_PREFIX.'pilots',
'fields' => 'COUNT(*) as `total`',
);
if(!empty($airline_code))
{
$params['where']['code'] = $airline_code;
$params['group'] = 'code';
}
$sql = DB::build_select($params);
$results = DB::get_results($sql);
if(!$results)
{
$total = 0;
}
else
{
$total = $results[0]->total;
}
CodonCache::write($key, $total, '15minute');
}
return $total;
}
after this, paste the following part of code:
public static function ActivePilotCount($airline_code='')
{
$key = 'active_pilot_count';
if($airline_code != '')
{
$key .= '_'.$airline_code;
}
$total = CodonCache::read($key);
if($total === false)
{
$params = array(
'table' => TABLE_PREFIX.'pilots',
'fields' => 'COUNT(*) as `total`',
);
if(!empty($airline_code))
{
$params['where']['code'] = $airline_code;
$params['group'] = 'code';
}
$params['where']['retired'] = 0;
$sql = DB::build_select($params);
$results = DB::get_results($sql);
if(!$results)
{
$total = 0;
}
else
{
$total = $results[0]->total;
}
CodonCache::write($key, $total, '15minute');
}
return $total;
}
After that, you will be able to show the number of the current active pilots of your virtual airline using this:
<?php echo StatsData::ActivePilotCount(); ?>