i have this in profile main it works
function getTotalScore()
{
$query = "SELECT SUM(`final_score`) AS score FROM ".TABLE_PREFIX."pireps WHERE pilotid = ".Auth::$userinfo->pilotid." AND accepted = 1";
$result = DB::get_row($query);
if (!$result) return 0;
return ($result->score == '') ? 0 : $result->score;
}