Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]co jest tu zle?!
Forum PHP.pl > Forum > Przedszkole
d0min
  1. <?php
  2.  
  3. /**
  4.  * StatFunctions.php
  5.  *
  6.  * @version 1
  7.  * @copyright 2008 by Chlorel for XNova
  8.  */
  9.  
  10. function GetTechnoPoints ( $CurrentUser ) {
  11.    global $resource, $pricelist, $reslist;
  12.  
  13.    $TechCounts = 0;
  14.    $TechPoints = 0;
  15.    foreach ( $reslist['tech'] as $n => $Techno ) {
  16.        if ( $CurrentUser[ $resource[ $Techno ] ] > 0 ) {
  17.            for ( $Level = 0; $Level < $CurrentUser[ $resource[ $Techno ] ]; $Level++ ) {
  18.                $Units       = $pricelist[ $Techno ]['metal'] + $pricelist[ $Techno ]['crystal'] + $pricelist[ $Techno ]['deuterium'];
  19.                $LevelMul    = pow( $pricelist[ $Techno ]['factor'], $Level );
  20.                $TechPoints += ($Units * $LevelMul);
  21.                $TechCounts += 1;
  22.            }
  23.        }
  24.    }
  25.    $RetValue['TechCount'] = $TechCounts;
  26.    $RetValue['TechPoint'] = $TechPoints;
  27.  
  28.    return $RetValue;
  29. }
  30.  
  31. function GetBuildPoints ( $CurrentPlanet ) {
  32.    global $resource, $pricelist, $reslist;
  33.  
  34.    $BuildCounts = 0;
  35.    $BuildPoints = 0;
  36.    foreach($reslist['build'] as $n => $Building) {
  37.        if ( $CurrentPlanet[ $resource[ $Building ] ] > 0 ) {
  38.            for ( $Level = 0; $Level < $CurrentPlanet[ $resource[ $Building ] ]; $Level++ ) {
  39.                $Units        = $pricelist[ $Building ]['metal'] + $pricelist[ $Building ]['crystal'] + $pricelist[ $Building ]['deuterium'];
  40.                $LevelMul     = pow( $pricelist[ $Building ]['factor'], $Level );
  41.                $BuildPoints += ($Units * $LevelMul);
  42.                $BuildCounts += 1;
  43.            }
  44.        }
  45.    }
  46.    $RetValue['BuildCount'] = $BuildCounts;
  47.    $RetValue['BuildPoint'] = $BuildPoints;
  48.  
  49.    return $RetValue;
  50. }
  51.  
  52. function GetDefensePoints ( $CurrentPlanet ) {
  53.    global $resource, $pricelist, $reslist;
  54.  
  55.    $DefenseCounts = 0;
  56.    $DefensePoints = 0;
  57.    foreach($reslist['defense'] as $n => $Defense) {
  58.        if ($CurrentPlanet[ $resource[ $Defense ] ] > 0) {
  59.            $Units          = $pricelist[ $Defense ]['metal'] + $pricelist[ $Defense ]['crystal'] + $pricelist[ $Defense ]['deuterium'];
  60.            $DefensePoints += ($Units * $CurrentPlanet[ $resource[ $Defense ] ]);
  61.            $DefenseCounts += $CurrentPlanet[ $resource[ $Defense ] ];
  62.        }
  63.    }
  64.    $RetValue['DefenseCount'] = $DefenseCounts;
  65.    $RetValue['DefensePoint'] = $DefensePoints;
  66.  
  67.    return $RetValue;
  68. }
  69.  
  70. function GetFleetPoints ( $CurrentPlanet ) {
  71.    global $resource, $pricelist, $reslist;
  72.  
  73.    $FleetCounts = 0;
  74.    $FleetPoints = 0;
  75.    foreach($reslist['fleet'] as $n => $Fleet) {
  76.        if ($CurrentPlanet[ $resource[ $Fleet ] ] > 0) {
  77.            $Units          = $pricelist[ $Fleet ]['metal'] + $pricelist[ $Fleet ]['crystal'] + $pricelist[ $Fleet ]['deuterium'];
  78.            $FleetPoints   += ($Units * $CurrentPlanet[ $resource[ $Fleet ] ]);
  79.            $FleetCounts   += $CurrentPlanet[ $resource[ $Fleet ] ];
  80.        }
  81.    }
  82.    $RetValue['FleetCount'] = $FleetCounts;
  83.    $RetValue['FleetPoint'] = $FleetPoints;
  84.  
  85.    return $RetValue;
  86. }
  87.  
  88. function GetFleetPointsOnTour ( $CurrentFleet ) {
  89.    global $resource, $pricelist, $reslist;
  90.  
  91.    $FleetCounts = 0;
  92.    $FleetPoints = 0;
  93.    
  94.    $split = trim(str_replace(';',' ',$CurrentFleet));
  95.    $split = explode(' ',$split);
  96.    
  97.    foreach($split as $ship) {
  98.        list($typ,$amount) = explode(',',$ship);
  99.        $Units             = $pricelist[ $typ ]['metal'] + $pricelist[ $typ ]['crystal'] + $pricelist[ $typ ]['deuterium'];
  100.        $FleetPoints   += ($Units * $amount);
  101.        $FleetCounts   += $amount;
  102.    }
  103.  
  104.    $RetValue['FleetCount'] = $FleetCounts;
  105.    $RetValue['FleetPoint'] = $FleetPoints;
  106.  
  107.    return $RetValue;
  108. }
  109. function GetFleetPointsOnTour ( $CurrentFleet ) {
  110.    global $resource, $pricelist, $reslist;
  111.  
  112.    $FleetCounts = 0;
  113.    $FleetPoints = 0;
  114.    
  115.    $split = trim(str_replace(';',' ',$CurrentFleet));
  116.    $split = explode(' ',$split);
  117.    
  118.    foreach($split as $ship) {
  119.        list($typ,$amount) = explode(',',$ship);
  120.        $Units             = $pricelist[ $typ ]['metal'] + $pricelist[ $typ ]['crystal'] + $pricelist[ $typ ]['deuterium'];
  121.        $FleetPoints   += ($Units * $amount);
  122.        $FleetCounts   += $amount;
  123.    }
  124.  
  125.    $RetValue['FleetCount'] = $FleetCounts;
  126.    $RetValue['FleetPoint'] = $FleetPoints;
  127.  
  128.    return $RetValue;
  129. }
  130. ?>


pokazuje mi sie error
Kod
<b>Fatal error</b>: Cannot redeclare getfleetpointsontour() (previously
declared in
/home/andrux/domains/seekdestroy.pl/public_html/uni2/admin/statfunctions.php:88)
in <b>/home/andrux/domains/seekdestroy.pl/public_html/uni2/admin/statfunctions.php</b> on line <b>129</b>
piotrooo89
2 razy deklarujesz tą samą nazwę chyba Ci się przez omyłke skopiowało jeszcze raz. zmaż jedną funkcję i powinno śmigać.
tomsi
Podobny bład był tutaj:
http://forum.php.pl/index.php?showtopic=39218
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.