|
 | | |
| Autor | Správa |
php-game
 Užívateľ
 Založený: 05.11.2011 Príspevky: 5 Bydlisko: Michalovce Vek: 14
 |
Robim suboj medzi hracmi a potrebujem to do tyzdna, pokusal som sa pisat kody sam ale potrebujem z nimi pomoc...
| kód: | <?php
$attacker['health']=$row->health_down;
$attacker['defence']=$row->defence + $row->plus_defence;
$attacker['attack']=$row->attack + $row->plus_attack;
$attacker['damage']=$row->damage1 + $row->damage2;
$defender['health']="{$profile['health_down']}";
$defender['defence']="{$profile['defence']}" + "{$profile['plus_defence']}";
$defender['attack']="{$profile['attack']}" + "{$profile['plus_attack']}";
$defender['damage']="{$profile['damage1']}" + "{$profile['damage2']}";
while($attacker['health'] > 0 && $defender['health'] > 0 )
{
if ( $attacker['attack']>= $defender['defence']) // first attack is successful
echo "Attacker hit the defender with $damage";
elseif (( $attacker['attack']< $defender['defence'])) // first attack is miss
echo "Defender dodge the Attacker";
}
?> |
Vypisuje mi to na celu stranu furt a Attacker hit the defender with neda nic a skusal som aj dat toto
$attacker=mysql_fetch_object(mysql_query("select * from server_1 where userid='$_SESSION[userid]'"));
$defender=mysql_fetch_object(mysql_query("select * from server_1 where userid='{$profile['userid']}'"));
ale da mi to chybu... ta |
| |
  |
 |
shaggy
 Moderátor
 Založený: 21.02.2006 Príspevky: 4607 Bydlisko: Bratislava
 |
Pretože sú Vianoce, tak to nehodím do koša, ale sa ťa opýtam:
1. akú chybu to vypisuje?
2. čo má byť, že to potrebuješ do týždňa? Mám to brať ako nátlak?
3. čo potrebuješ od nás? |
_________________ Neradím a nekomunikujem cez SS, ak niečo potrebujete, máte iné možnosti: Ak vám zmizla téma, alebo sa vám niečo nepáči. Ak potrebujete nahlásiť príspevok/človeka, reportujte ho. Ak máte s niečim problém, riešte to v danej téme. | |
    |
 |
walther
 Užívateľ
 Založený: 24.01.2008 Príspevky: 10188 Bydlisko: Bratislava Vek: 24
 |
Ja ti dám inú otázku - pozri sa na ten kód, vyznáš sa v ňom na prvý pohľad? Príde ti prehľadný a dobre napísaný? Keď to zrefaktoruješ, určite sa ti budú hľadať chyby ľahšie. |
| |
  |
 |
php-game
 Užívateľ
 Založený: 05.11.2011 Príspevky: 5 Bydlisko: Michalovce Vek: 14
 | Zaslal: Ut 27.12.11 23:52 |   |
Mam tu jednu chybu neviete preco ked mam normalne vyhladavanie a najde mi uzivatela a ked kliknem na jeho odkaz profile?id=napr.1 tak mi ho automaticky prihlasi?
tu mam kod na hladanie| kód: | <?php
if(isset($_POST['submit'])){
if(isset($_GET['go'])){
if(preg_match("/^[ a-zA-Z]+/", $_POST['name'])){
$name=$_POST['name'];
//query the database table
$sql="SELECT ID, userid FROM server_1 WHERE userid LIKE '%" . $name . "%'";
//run the query against the mysql query function
$result=mysql_query($sql);
//create while loop and loop through result set
echo "<h3>Výsledky hľadania:</h3>";
while($row=mysql_fetch_array($result)){
$userid =$row['userid'];
$ID=$row['ID'];
//display the result of the array
echo "<ul>\n";
echo "<li>" . "<a href=\"../../profile/?id=$ID\" style=\"color:#000;\">" .$userid . "</a> <a href=\"insert.php?user=$userid\" title=\"pridať uživateľa\"><img src=\"../../../tmp/images/tick.gif\" border=\"0\" style=\"margin-top:2px;\" height=\"14\" width=\"14\"></a> </li>\n";
echo "</ul>";
}
}
else{
echo "<p>Zadajte hľadaný výraz</p>";
}
}
}
?> |
|
| |
  |
 |
Ďuri
 Administrátor
 Založený: 11.08.2007 Príspevky: 3757 Bydlisko: Brno
 | Zaslal: St 28.12.11 13:00 |   |
Lebo nevies programovat. Uz sme ti to v tvojej poslednej teme aspon dvaja hovorili a poviem ti to zasa, robis nieco, na co nemas znalosti ani skusenosti a potom to tak vyzera.
Mala napoveda - ked kliknes na odkaz a ten ta presmeruje na nejaky subor profile, tak chybu musis hladat presne v tom subore profile. To nebude mat s hladanim vobec nic. |
| |
    |
 |
php-game
 Užívateľ
 Založený: 05.11.2011 Príspevky: 5 Bydlisko: Michalovce Vek: 14
 | Zaslal: St 28.12.11 15:33 |   |
Ved ja som to tam hladal ale tam asi chyba nieje lebo ked kliknem z ineho suboru na profile/ tak ma automaticky neprihlasi tu mam kod z toho profile/ | kód: | $id = (int) $_GET['id'];
$pmsgs=mysql_query("SELECT * FROM server_1 WHERE id='$id'");
$members=mysql_query("SELECT * FROM server_1 WHERE id='$id'");
$member=mysql_fetch_array($members);
while($profile=mysql_fetch_array($pmsgs)){ |
|
| |
  |
 |
|
Nemôžete pridávať nové témy do tohto fóra. Nemôžete odpovedať na témy v tomto fóre. Nemôžete upravovať svoje príspevky v tomto fóre. Nemôžete mazať svoje príspevky v tomto fóre. Nemôžete hlasovať v tomto fóre.
|
| |