Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Pomocy!
Forum PHP.pl > Forum > Gotowe rozwiązania
punkers
mam skromny problem, prosze pomóc w rozwiązaniu. Otóż przeabiam skrypt gamers-fusions na język polki i zgodnie do moich potrzebb gry.
Tak więc niewiem gdzi epopełniłem błąd:
Kod
<?php
/***************************************************************************
*
*       This program is free software; you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation; either version 2 of the License, or
*   (at your option) any later version.
*
*   This program is distributed in the hope that it will be useful,
*   but WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*   GNU General Public License for more details.
*
*   You should have received a copy of the GNU General Public License
*   along with this program; if not, write to the Free Software
*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
***************************************************************************/

$title = "Dystrybucja AP";
require_once("header.php"); ?>

<?php
if (!isset($_GET['statp'])) {
        $_GET['statp'] = '';
}
$arrmenu = array('ap','clas','race');
$arrap = $player -> stats($arrmenu);
if (!$_GET['statp']) {
    print "Tutaj możesz uzyć AP do zwiększenia swoich statystyk. Po prostu kliknij w odpowiedni link. Posiadasz <b>$arrap[ap]</b> AP.<br><br>";
}
if (!$_GET['statp'] && $arrap['race'] == 'Człowiek' && $arrap['ap'] > 0) {

    print "- <a href=ap.php?statp=strength>+4 Siła za 1 ap</a><br>
    - <a href=ap.php?statp=agility>+4 Zręczno&para;ć za 1 ap</a><br>
    - <a href=ap.php?statp=szyb>+4 Szybko&para;ć za 1 ap</a><br>
    - <a href=ap.php?statp=wytrz>+4 Wytrzymało&para;ć za 1 ap</a><br>";
}
if (!$_GET['statp'] && $arrap['race'] == 'Changeling' && $arrap['ap'] > 0) {

    print "- <a href=ap.php?statp=strength>+5 Siła za 1 ap</a><br>
    - <a href=ap.php?statp=agility>+7 Zręczno&para;ć za 1 ap</a><br>
    - <a href=ap.php?statp=szyb>+7 Szybko&para;ć za 1 ap</a><br>
    - <a href=ap.php?statp=wytrz>+6 Wytrzymało&para;ć za 1 ap</a><br>";
}
if (!$_GET['statp'] && $arrap['race'] == 'Saiya-jin' && $arrap['ap'] > 0) {

    print "- <a href=ap.php?statp=strength>+7 Siła za 1 ap</a><br>
    - <a href=ap.php?statp=agility>+3 Zręczno&para;ć za 1 ap</a><br>
    - <a href=ap.php?statp=szyb>+4 Szybko&para;ć za 1 ap</a><br>
    - <a href=ap.php?statp=wytrz>+7 Wytrzymało&para;ć za 1 ap</a><br>";
}
if (!$_GET['statp'] && $arrap['race'] == 'Nameck-jin' && $arrap['ap'] > 0) {

    print "- <a href=ap.php?statp=strength>+5 Siła za 1 ap</a><br>
    - <a href=ap.php?statp=agility>+4 Zręczno&para;ć za 1 ap</a><br>
    - <a href=ap.php?statp=szyb>+5 Szybko&para;ć za 1 ap</a><br>
    - <a href=ap.php?statp=wytrz>+7 Wytrzymało&para;ć za 1 ap</a><br>";
}
if (!$_GET['statp'] && $arrap['clas'] == 'Wojownik' && $arrap['ap'] > 0) {
    print "- <a href=ap.php?statp=inteli>+4 Inteligencja za 1 ap</a><br>";
    print "- <a href=ap.php?statp=wisdom>+4 Siły Woli za 1 ap</a><br><br>";
}
if (!$_GET['statp'] && $arrap['clas'] == 'Myśliciel' && $arrap['ap'] > 0) {
    print "- <a href=ap.php?statp=inteli>+5 Inteligencja za 1 ap</a><br>";
    print "- <a href=ap.php?statp=wisdom>+5 Siły Woli za 1 ap</a><br><br>";
}
if ($_GET['statp'] != 'szyb' && $_GET['statp'] != 'wytrz' && $_GET['statp'] != 'strength' && $_GET['statp'] != 'agility' && $_GET['statp'] != 'inteli' && $_GET['statp'] != 'wisdom' && $_GET['statp'] != '') {
    print "Zapomnij o tym";
    require_once("footer.php");
    exit;
}
if ($arrap['race'] == 'Człowiek' && $_GET['statp']) {
  $gain = 4;
}
if ($arrap['race'] == 'Changeling' && $_GET['statp']) {
    if ($_GET['statp'] == 'wytrz' || $_GET['statp'] == 'strength') {
  $gain = 5;
    } else {
  $gain = 6;
    }
}
if ($arrap['race'] == 'Saiya-jin' && $_GET['statp']) {
    if ($_GET['statp'] == 'strength') {
  $gain = 7;
    } elseif ($_GET['statp'] == 'wytrz') {
  $gain = 7;
    } elseif ($_GET['statp'] == 'agility') {
  $gain = 3;
    } elseif ($_GET['statp'] == 'szyb') {
     $gain = 4;
    }
if ($arrap['race'] == 'Nameck-jin' && $_GET['statp']) {
    if ($_GET['statp'] == 'strength') {
  $gain = 5;
    } elseif ($_GET['statp'] == 'wytrz') {
  $gain = 7;
    } elseif ($_GET['statp'] == 'agility') {
  $gain = 4;
    } elseif ($_GET['statp'] == 'szyb') {
     $gain = 5;
    }

}    if ($arrap['clas'] == 'Wojownik' && $_GET['statp']) {
        if ($_GET['statp'] == 'inteli' || $_GET['statp'] == 'wisdom') {
            $gain = 6;
        }
}
if ($arrap['clas'] == 'Mysliciel' && $_GET['statp']) {
        if ($_GET['statp'] == 'inteli' || $_GET['statp'] == 'wisdom') {
            $gain = 5;
        }
}
if ($_GET['statp'] && $arrap['ap'] < 1) {
    print "Nie masz tylu AP!";
    require_once ("footer.php");
    exit;
}
if ($_GET['statp'] && $arrap['ap'] > 0) {
    if ($_GET['statp'] == 'strength') {
  $cecha='Siły';
    }
    if ($_GET['statp'] == 'agility') {
  $cecha='Zręczno&para;ci';
    }
    if ($_GET['statp'] == 'szyb') {
  $cecha='Szybko&para;ci';
    }
    if ($_GET['statp'] == 'wytrz') {
     $cecha='Wytrzymało&para;ci';
            mysql_query("update players set hp=hp+".$gain." where id=".$arrstats['id']);
            mysql_query("update players set max_hp=max_hp+".$gain." where id=".$arrstats['id']);
    }
    if ($_GET['statp'] == 'inteli') {
  $cecha = 'Inteligencji';
    }
    if ($_GET['statp'] == 'wisdom') {
         $cecha = 'Siły Woli';
    }
    mysql_query("update players set $_GET[statp]=$_GET[statp]+$gain where id=$arrstats[id]");
    mysql_query("update players set ap=ap-1 where id=$arrstats[id]");
    print "Zdobywasz <b>$gain $cecha</b>. Kliknij <a href=ap.php>tutaj</a> aby to rozdysponować więcej AP.";
}
?>

<?php require_once("footer.php"); ?>

+są zabezpeiczenia GET
+niewiem gdzie popełniłem błąd (dodałem:
++rase: Nameck-jin;
++klase: Myśliciel;
a usunełem pole Mag).
Tak wygląda kod w oryginale:
Kod
<?php
/***************************************************************************
*                               ap.php
*                            -------------------
*   copyright            : (C) 2004 Vallheru Team based on Gamers-Fusion ver 2.5
*   email                : webmaster@uc.h4c.pl
*
***************************************************************************/

/***************************************************************************
*
*       This program is free software; you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation; either version 2 of the License, or
*   (at your option) any later version.
*
*   This program is distributed in the hope that it will be useful,
*   but WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*   GNU General Public License for more details.
*
*   You should have received a copy of the GNU General Public License
*   along with this program; if not, write to the Free Software
*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
***************************************************************************/

$title = "Dystrybucja AP";
require_once("header.php"); ?>

<?php
if (!isset($_GET['statp'])) {
        $_GET['statp'] = '';
}
$arrmenu = array('ap','clas','race');
$arrap = $player -> stats($arrmenu);
if (!$_GET['statp']) {
    print "Tutaj możesz uzyć AP do zwiększenia swoich statystyk. Po prostu kliknij w odpowiedni link. Posiadasz <b>$arrap[ap]</b> AP.<br><br>";
}
if (!$_GET['statp'] && $arrap['race'] == 'Człowiek' && $arrap['ap'] > 0) {

    print "- <a href=ap.php?statp=strength>+4 Siła za 1 ap</a><br>
    - <a href=ap.php?statp=agility>+4 Zręczno&para;ć za 1 ap</a><br>
    - <a href=ap.php?statp=szyb>+4 Szybko&para;ć za 1 ap</a><br>
    - <a href=ap.php?statp=wytrz>+4 Wytrzymało&para;ć za 1 ap</a><br>";
}
if (!$_GET['statp'] && $arrap['race'] == 'Elf' && $arrap['ap'] > 0) {

    print "- <a href=ap.php?statp=strength>+3 Siła za 1 ap</a><br>
    - <a href=ap.php?statp=agility>+7 Zręczno&para;ć za 1 ap</a><br>
    - <a href=ap.php?statp=szyb>+7 Szybko&para;ć za 1 ap</a><br>
    - <a href=ap.php?statp=wytrz>+3 Wytrzymało&para;ć za 1 ap</a><br>";
}
if (!$_GET['statp'] && $arrap['race'] == 'Krasnolud' && $arrap['ap'] > 0) {

    print "- <a href=ap.php?statp=strength>+8 Siła za 1 ap</a><br>
    - <a href=ap.php?statp=agility>+3 Zręczno&para;ć za 1 ap</a><br>
    - <a href=ap.php?statp=szyb>+2 Szybko&para;ć za 1 ap</a><br>
    - <a href=ap.php?statp=wytrz>+7 Wytrzymało&para;ć za 1 ap</a><br>";
}
if (!$_GET['statp'] && $arrap['clas'] == 'Wojownik' && $arrap['ap'] > 0) {
    print "- <a href=ap.php?statp=inteli>+4 Inteligencja za 1 ap</a><br>";
    print "- <a href=ap.php?statp=wisdom>+4 Siły Woli za 1 ap</a><br><br>";
}
if (!$_GET['statp'] && $arrap['clas'] == 'Mag' && $arrap['ap'] > 0) {
    print "- <a href=ap.php?statp=inteli>+6 Inteligencja za 1 ap</a><br>";
    print "- <a href=ap.php?statp=wisdom>+6 Siły Woli za 1 ap</a><br><br>";
}
if (!$_GET['statp'] && $arrap['clas'] == 'Obywatel' && $arrap['ap'] > 0) {
    print "- <a href=ap.php?statp=inteli>+5 Inteligencja za 1 ap</a><br>";
    print "- <a href=ap.php?statp=wisdom>+5 Siły Woli za 1 ap</a><br><br>";
}
if ($_GET['statp'] != 'szyb' && $_GET['statp'] != 'wytrz' && $_GET['statp'] != 'strength' && $_GET['statp'] != 'agility' && $_GET['statp'] != 'inteli' && $_GET['statp'] != 'wisdom' && $_GET['statp'] != '') {
    print "Zapomnij o tym";
    require_once("footer.php");
    exit;
}
if ($arrap['race'] == 'Człowiek' && $_GET['statp']) {
  $gain = 4;
}
if ($arrap['race'] == 'Elf' && $_GET['statp']) {
    if ($_GET['statp'] == 'wytrz' || $_GET['statp'] == 'strength') {
  $gain = 3;
    } else {
  $gain = 7;
    }
}
if ($arrap['race'] == 'Krasnolud' && $_GET['statp']) {
    if ($_GET['statp'] == 'strength') {
  $gain = 8;
    } elseif ($_GET['statp'] == 'wytrz') {
  $gain = 7;
    } elseif ($_GET['statp'] == 'agility') {
  $gain = 3;
    } elseif ($_GET['statp'] == 'szyb') {
     $gain = 2;
    }
}
if ($arrap['clas'] == 'Wojownik' && $_GET['statp']) {
        if ($_GET['statp'] == 'inteli' || $_GET['statp'] == 'wisdom') {
            $gain = 4;
        }
}
if ($arrap['clas'] == 'Mag' && $_GET['statp']) {
        if ($_GET['statp'] == 'inteli' || $_GET['statp'] == 'wisdom') {
            $gain = 6;
        }
}
if ($arrap['clas'] == 'Obywatel' && $_GET['statp']) {
        if ($_GET['statp'] == 'inteli' || $_GET['statp'] == 'wisdom') {
            $gain = 5;
        }
}
if ($_GET['statp'] && $arrap['ap'] < 1) {
    print "Nie masz tylu AP!";
    require_once ("footer.php");
    exit;
}
if ($_GET['statp'] && $arrap['ap'] > 0) {
    if ($_GET['statp'] == 'strength') {
  $cecha='Siły';
    }
    if ($_GET['statp'] == 'agility') {
  $cecha='Zręczno&para;ci';
    }
    if ($_GET['statp'] == 'szyb') {
  $cecha='Szybko&para;ci';
    }
    if ($_GET['statp'] == 'wytrz') {
     $cecha='Wytrzymało&para;ci';
            mysql_query("update players set hp=hp+".$gain." where id=".$arrstats['id']);
            mysql_query("update players set max_hp=max_hp+".$gain." where id=".$arrstats['id']);
    }
    if ($_GET['statp'] == 'inteli') {
  $cecha = 'Inteligencji';
    }
    if ($_GET['statp'] == 'wisdom') {
         $cecha = 'Siły Woli';
    }
    mysql_query("update players set $_GET[statp]=$_GET[statp]+$gain where id=$arrstats[id]");
    mysql_query("update players set ap=ap-1 where id=$arrstats[id]");
    print "Zdobywasz <b>$gain $cecha</b>. Kliknij <a href=ap.php>tutaj</a> aby to rozdysponować więcej AP.";
}
?>

<?php require_once("footer.php"); ?>


Barzo bym prosił aby ktoś podał gotowy kod do wstawienia, głowie sie nad tym juz dwa dni i niewiem co robić.
aarambo.gif
Dabroz
Nazwij dobrze temat i używaj taga [php]

I podaj jaki jest błąd.
Seth
Do czasu, az autor nie wysle mi prawidlowego tematu na PW, bedzie on zamkniety.
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.