vue erreur de recyclage
Kommunauty
Connexion
Inscription

erreur de recyclage


caroline Messages : 209

bonjour je voulais rajouter dans le fichier mission case recycling.php il m'affiche ca "Parse error: syntax error, unexpected T_ELSE in /customers/6/0/e/hunterspace.be/httpd.www/includes/classes/missions/MissionCaseRecycling.php on line 64"

pouvez vous m aider merci

class MissionCaseRecycling extends MissionFunctions
{
function __construct($Fleet)
{
$this->_fleet = $Fleet;
}

function TargetEvent()
{
global $db, $pricelist, $LANG;
$Target = $db->uniquequery("SELECT der_metal, der_crystal, der_norio, (der_metal + der_crystal + der_norio) as der_total FROM ".PLANETS." WHERE `id` = '".$this->_fleet['fleet_end_id']."';");
$FleetRecord         = explode(";", $this->_fleet['fleet_array']);
$RecyclerCapacity    = 0;
$OtherFleetCapacity  = 0;
foreach ($FleetRecord as $Item => $Group)
{
if (empty($Group))
continue;

$Class        = explode (",", $Group);
if ($Class[0] == 209 || $Class[0] == 219)
$RecyclerCapacity   += $pricelist[$Class[0]]['capacity'] * $Class[1];
else
$OtherFleetCapacity += $pricelist[$Class[0]]['capacity'] * $Class[1];
}
$RecycledGoods = array('metal' => 0, 'crystal' => 0, 'norio' => 0);
$IncomingFleetGoods = $FleetRow['fleet_resource_metal'] + $FleetRow['fleet_resource_crystal'] + $FleetRow['fleet_resource_deuterium'] + $FleetRow['fleet_resource_norio'];
if ($IncomingFleetGoods > $OtherFleetCapacity)
$RecyclerCapacity -= ($IncomingFleetGoods - $OtherFleetCapacity);

if ($Target['der_total'] <= $RecyclerCapacity) {
$RecycledGoods['metal']   = $Target['der_metal'];
$RecycledGoods['crystal'] = $Target['der_crystal'];
$RecycledGoods['norio'] = $Target['der_norio'];
} elseif (($Target['der_metal'] > $RecyclerCapacity / 2) && ($Target['der_crystal'] > $RecyclerCapacity / 2) && ($Target['der_norio'] > $RecyclerCapacity / 2)) {
$RecycledGoods['metal']   = $RecyclerCapacity / 2;
$RecycledGoods['crystal'] = $RecyclerCapacity / 2;
$RecycledGoods['norio'] = $RecyclerCapacity / 2;
} elseif (($Target['der_metal'] > $Target['der_crystal']) or ($Target['der_metal'] > $Target['der_norio'])) {
$RecycledGoods['crystal'] = $Target['der_crystal'];
$RecycledGoods['norio'] = $Target['der_norio'];
if ($Target['der_metal'] > ($RecyclerCapacity - $RecycledGoods['crystal']) or ($RecyclerCapacity - $RecycledGoods['norio']))
$RecycledGoods['metal'] = $RecyclerCapacity - $RecycledGoods['crystal'];
$RecycledGoods['metal'] = $RecyclerCapacity - $RecycledGoods['norio'];
else
$RecycledGoods['metal'] = $Target['der_metal'];
}  elseif (($Target['der_crystal'] > $Target['der_metal']) or ($Target['der_crystal'] > $Target['der_norio'])) {
$RecycledGoods['metal'] = $Target['der_metal'];
$RecycledGoods['norio'] = $Target['der_norio'];
if ($Target['der_crystal'] > ($RecyclerCapacity - $RecycledGoods['metal']) or ($RecyclerCapacity - $RecycledGoods['norio']))
$RecycledGoods['crystal'] = $RecyclerCapacity - $RecycledGoods['metal'];
$RecycledGoods['crystal'] = $RecyclerCapacity - $RecycledGoods['norio'];
else
$RecycledGoods['crystal'] = $Target['der_crystal'];
}  elseif (($Target['der_norio'] > $Target['der_metal']) or ($Target['der_norio'] > $Target['der_crystal'])) {
$RecycledGoods['metal'] = $Target['der_metal'];
$RecycledGoods['crystal'] = $Target['der_crystal'];
if ($Target['der_norio'] > ($RecyclerCapacity - $RecycledGoods['metal']) or ($RecyclerCapacity - $RecycledGoods['crystal']))
$RecycledGoods['norio'] = $RecyclerCapacity - $RecycledGoods['metal'];
$RecycledGoods['norio'] = $RecyclerCapacity - $RecycledGoods['crystal'];
else
$RecycledGoods['norio'] = $Target['der_norio'];
}

$db->query("UPDATE ".PLANETS." SET `der_metal` = `der_metal` - ".$RecycledGoods['metal'].", `der_crystal` = `der_crystal` - ".$RecycledGoods['crystal'].", `der_norio` = `der_norio` - ".$RecycledGoods['norio']." WHERE `id` = '".$this->_fleet['fleet_end_id']."';");

$LNG = $LANG->GetUserLang($this->_fleet['fleet_owner']);
$Message = sprintf($LNG['sys_recy_gotten'], pretty_number($RecycledGoods['metal']), $LNG['Metal'], pretty_number($RecycledGoods['crystal']), $LNG['Crystal'], pretty_number($RecycledGoods['norio']), $LNG['Norio']);
SendSimpleMessage($this->_fleet['fleet_owner'], '', $this->_fleet['fleet_start_time'], 4, $LNG['sys_mess_tower'], $LNG['sys_recy_report'], $Message);

$this->UpdateFleet('fleet_resource_metal', bcadd($this->_fleet['fleet_resource_metal'], $RecycledGoods['metal']));
$this->UpdateFleet('fleet_resource_crystal', bcadd($this->_fleet['fleet_resource_crystal'], $RecycledGoods['crystal']));
$this->UpdateFleet('fleet_resource_norio', bcadd($this->_fleet['fleet_resource_norio'], $RecycledGoods['norio']));
$this->UpdateFleet('fleet_mess', 1);
$this->SaveFleet();
}

function EndStayEvent()
{
return;
}

function ReturnEvent()
{
global $LANG;
$LNG = $LANG->GetUserLang($this->_fleet['fleet_owner']);

$Message         = sprintf( $LNG['sys_tran_mess_owner'], $TargetName, GetStartAdressLink($this->_fleet, ''), pretty_number($this->_fleet['fleet_resource_metal']), $LNG['Metal'], pretty_number($this->_fleet['fleet_resource_crystal']), $LNG['Crystal'], pretty_number($this->_fleet['fleet_resource_deuterium']), $LNG['Deuterium'], pretty_number($this->_fleet['fleet_resource_norio']), $LNG['Norio'] );
SendSimpleMessage($this->_fleet['fleet_owner'], '', $this->_fleet['fleet_end_time'], 4, $LNG['sys_mess_tower'], $LNG['sys_mess_fleetback'], $Message);

$this->RestoreFleet();
}
}
mardi 19 février 2013

Homer Messages : 1925

tu as rajouter des if else ?

essai ce code :

class MissionCaseRecycling extends MissionFunctions
{
    function __construct($Fleet)
    {
        $this->_fleet    = $Fleet;
    }
    
    function TargetEvent()
    {    
        global $db, $pricelist, $LANG;
        $Target                 = $db->uniquequery("SELECT der_metal, der_crystal, der_norio, (der_metal + der_crystal + der_norio) as der_total FROM ".PLANETS." WHERE `id` = '".$this->_fleet['fleet_end_id']."';");
        $FleetRecord         = explode(";", $this->_fleet['fleet_array']);
        $RecyclerCapacity    = 0;
        $OtherFleetCapacity  = 0;
        foreach ($FleetRecord as $Item => $Group)
        {
            if (empty($Group))
                continue;
                
            $Class        = explode (",", $Group);
            if ($Class[0] == 209 || $Class[0] == 219)
                $RecyclerCapacity   += $pricelist[$Class[0]]['capacity'] * $Class[1];
            else
                $OtherFleetCapacity += $pricelist[$Class[0]]['capacity'] * $Class[1];
        }
        $RecycledGoods    = array('metal' => 0, 'crystal' => 0, 'norio' => 0);
        $IncomingFleetGoods = $FleetRow['fleet_resource_metal'] + $FleetRow['fleet_resource_crystal'] + $FleetRow['fleet_resource_deuterium'] + $FleetRow['fleet_resource_norio'];
        if ($IncomingFleetGoods > $OtherFleetCapacity)
            $RecyclerCapacity -= ($IncomingFleetGoods - $OtherFleetCapacity);

        if ($Target['der_total'] <= $RecyclerCapacity) {
            $RecycledGoods['metal']   = $Target['der_metal'];
            $RecycledGoods['crystal'] = $Target['der_crystal'];
            $RecycledGoods['norio'] = $Target['der_norio'];
        } elseif (($Target['der_metal'] > $RecyclerCapacity / 2) && ($Target['der_crystal'] > $RecyclerCapacity / 2) && ($Target['der_norio'] > $RecyclerCapacity / 2)) {
            $RecycledGoods['metal']   = $RecyclerCapacity / 2;
            $RecycledGoods['crystal'] = $RecyclerCapacity / 2;
            $RecycledGoods['norio'] = $RecyclerCapacity / 2;
        } elseif (($Target['der_metal'] > $Target['der_crystal']) or ($Target['der_metal'] > $Target['der_norio'])) {
            $RecycledGoods['crystal'] = $Target['der_crystal'];
            $RecycledGoods['norio'] = $Target['der_norio'];
            if ($Target['der_metal'] > ($RecyclerCapacity - $RecycledGoods['crystal']) or ($RecyclerCapacity - $RecycledGoods['norio']))(
                $RecycledGoods['metal'] = $RecyclerCapacity - $RecycledGoods['crystal'];
                $RecycledGoods['metal'] = $RecyclerCapacity - $RecycledGoods['norio'];
)
            else
                $RecycledGoods['metal'] = $Target['der_metal'];
        }  elseif (($Target['der_crystal'] > $Target['der_metal']) or ($Target['der_crystal'] > $Target['der_norio'])) {
            $RecycledGoods['metal'] = $Target['der_metal'];
            $RecycledGoods['norio'] = $Target['der_norio'];
            if ($Target['der_crystal'] > ($RecyclerCapacity - $RecycledGoods['metal']) or ($RecyclerCapacity - $RecycledGoods['norio']))(
                $RecycledGoods['crystal'] = $RecyclerCapacity - $RecycledGoods['metal'];
                $RecycledGoods['crystal'] = $RecyclerCapacity - $RecycledGoods['norio'];
)
            else
                $RecycledGoods['crystal'] = $Target['der_crystal'];
        }  elseif (($Target['der_norio'] > $Target['der_metal']) or ($Target['der_norio'] > $Target['der_crystal'])) {
            $RecycledGoods['metal'] = $Target['der_metal'];
            $RecycledGoods['crystal'] = $Target['der_crystal'];
            if ($Target['der_norio'] > ($RecyclerCapacity - $RecycledGoods['metal']) or ($RecyclerCapacity - $RecycledGoods['crystal']))(
                $RecycledGoods['norio'] = $RecyclerCapacity - $RecycledGoods['metal'];
                $RecycledGoods['norio'] = $RecyclerCapacity - $RecycledGoods['crystal'];
)
            else
                $RecycledGoods['norio'] = $Target['der_norio'];
        }
        
        $db->query("UPDATE ".PLANETS." SET `der_metal` = `der_metal` - ".$RecycledGoods['metal'].", `der_crystal` = `der_crystal` - ".$RecycledGoods['crystal'].", `der_norio` = `der_norio` - ".$RecycledGoods['norio']." WHERE `id` = '".$this->_fleet['fleet_end_id']."';");

        $LNG            = $LANG->GetUserLang($this->_fleet['fleet_owner']);
        $Message         = sprintf($LNG['sys_recy_gotten'], pretty_number($RecycledGoods['metal']), $LNG['Metal'], pretty_number($RecycledGoods['crystal']), $LNG['Crystal'], pretty_number($RecycledGoods['norio']), $LNG['Norio']);
        SendSimpleMessage($this->_fleet['fleet_owner'], '', $this->_fleet['fleet_start_time'], 4, $LNG['sys_mess_tower'], $LNG['sys_recy_report'], $Message);
        
        $this->UpdateFleet('fleet_resource_metal', bcadd($this->_fleet['fleet_resource_metal'], $RecycledGoods['metal']));
        $this->UpdateFleet('fleet_resource_crystal', bcadd($this->_fleet['fleet_resource_crystal'], $RecycledGoods['crystal']));
        $this->UpdateFleet('fleet_resource_norio', bcadd($this->_fleet['fleet_resource_norio'], $RecycledGoods['norio']));
        $this->UpdateFleet('fleet_mess', 1);
        $this->SaveFleet();
    }
    
    function EndStayEvent()
    {
        return;
    }
    
    function ReturnEvent()
    {
        global $LANG;
        $LNG                = $LANG->GetUserLang($this->_fleet['fleet_owner']);
    
        $Message         = sprintf( $LNG['sys_tran_mess_owner'], $TargetName, GetStartAdressLink($this->_fleet, ''), pretty_number($this->_fleet['fleet_resource_metal']), $LNG['Metal'], pretty_number($this->_fleet['fleet_resource_crystal']), $LNG['Crystal'], pretty_number($this->_fleet['fleet_resource_deuterium']), $LNG['Deuterium'], pretty_number($this->_fleet['fleet_resource_norio']), $LNG['Norio'] );
        SendSimpleMessage($this->_fleet['fleet_owner'], '', $this->_fleet['fleet_end_time'], 4, $LNG['sys_mess_tower'], $LNG['sys_mess_fleetback'], $Message);

        $this->RestoreFleet();
    }
}
mercredi 20 février 2013 (Dernière édition mercredi 20 février 2013)

stryker Messages : 367

faut juste remplacer ton else par " elseif " ou tout simplement " if "

mercredi 20 février 2013

Homer Messages : 1925

elle a oublié des parenthèse dans ses if aussi

mercredi 20 février 2013

caroline Messages : 209

ok merci je merci je vais essayer

mercredi 20 février 2013

caroline Messages : 209

bo goss ton ftp c bon XD

mercredi 20 février 2013

caroline Messages : 209

sa vien du serveur? ou de mon jeux?

Error: Connection to database failed: Too many connections_

File: /customers/6/0/e/hunterspace.be/httpd.www/includes/classes/class.MySQLi.php_

Line: 51_

PHP-Version: 5.3.21_

PHP-API: cgi-fcgi_

XNOVA Version: Redesign_

Debug Backtrace:

#0 ./includes/common.php(65): DB_mysqli->__construct()

#1 ./admin.php(26): require('/customers/6/0/...')

#2 {main}_

mercredi 20 février 2013

caroline Messages : 209

pour le recyclage le noruim saffiche pas et quand 1 recycle il ne prend pas le champ de ruine dans la galaxy et dans la flotte il m affiche

-1d 0-21h 0-15m 0-24s

--Flotte sur Planète--

mercredi 20 février 2013

caroline Messages : 209

voila erreur Parse error: syntax error, unexpected ';' in /customers/6/0/e/hunterspace.be/httpd.www/includes/classes/missions/MissionCaseRecycling.php on line 52

mercredi 20 février 2013

Homer Messages : 1925

La 1er erreur viens de ton serveur

Pour le recyclage, pense à modifier le fichier de langue et le texte pour le recyclage afin d'y inclure le deut et norium.

Montre ton code en entier là comme ça je vois pas ou ça merde

jeudi 21 février 2013

Page suivante »