plik php:
<? ?> <?php function attack() { $repeat = ($stat[agility] / $enemy[agility]); if ($attackstr <= 0) { $attackstr = 1; } $mypower = ($mywep[power] + $stat[strength]); $epower = ($enemy[strength] + $earm[power]); $attackdmg = ($mypower - $epower); if ($attackdmg <= 0) { $attackdmg = 1; } $round = 1; while ($round <= $attackstr && $enemy[hp] >= 0) { if ($enemy[unik] > $rzut) { $smarty->assign('fight', '<b>$enemy[user]</b> unikno³ twojego ciosu.'); $smarty->display('abattle.tpl'); } else { $smarty->assign(\"fight\", \"<b>\".$stat[user].\"</b> zada³ \".atackdmg.\" <b>\".$enemy[user].\"</b>\"); $smarty->display('abattle.tpl'); $enemy[hp] = ($enemy[hp] - $attackdmg); $round = ($round + 1); } } if ($enemy[hp] <= 0) { $enemy[hp] = 0; $smarty->assign(\"fight\", \"<br><b>\".$stat[user].\"</b> Wygrywa!<br>\"); $smarty->display('abattle.tpl'); $creditgain = ($enemy[credits] / 10); $smarty->assign(\"fight\", \"<b>\".$stat[user].\"</b> zdobywa \".$expgain.\" do¶wiadczenia i \".$creditgain.\" sztuk z³ota.\"); $smarty->display('abattle.tpl'); $texp = ($stat[exp] + $expgain); $expn = (($stat[level] * 50) + ($stat[level] * 15)); $tlevel = $stat[level] +1; if ($texp >= $expn) { $smarty->assign(\"fight\", \"<b>\".$stat[user].\"</b> awansuje na \".$tlevel.\" poziom.\"); $smarty->display('abattle.tpl'); mysql_query(\"insert into log (owner, log) values($stat[id],'Pokona³e¶ <b>$enemy[user]</b> i zdoby³e¶ poziom.')\"); } mysql_query(\"insert into log (owner, log) values($stat[id],'Zosta³e¶ zaatakowany przez <b>$enemy[user]</b>. zdobywasz $expgain EXP i $creditgain sztuk z³ota.')\"); mysql_query(\"insert into log (owner, log) values($enemy[id],'Zosta³e¶ zaatakowany i pokonany przez <b>$stat[user]</b>.')\"); exit; } else { attackback(); } } if ($stat[hp] <= 0) { $smarty->assign(\"fight\", \"<b>\".$enemy[user].\"</b> Wygrywa.\"); $smarty->display('abattle.tpl'); $creditgain = ($enemy[credits] / 10); $smarty->assign(\"fight\", \"<b>\".$enemy[user].\"</b> zdobywa \".$expgain.\" do¶wiadcznia i \".$creditgain.\" sztuk z³ota.\"); $smarty->display('abattle.tpl'); $texp = ($enemy[exp] + $expgain); $expn = (($enemy[level] * 50) + ($enemy[level] * 15)); $tlevel = $enemy[level] + 1; if ($texp >= $expn) { $smarty->assign(\"fight\", \"<b>\".$enemy[user].\"</b> awansuje na \".$tlevel.\" poziom.\"); $smarty->display('abattle.tpl'); mysql_query(\"insert into log (owner, log) values($enemy[id],'Pokona³e¶ <b>$stat[user]</b> i zdoby³e¶ poziom.')\"); } mysql_query(\"insert into log (owner, log) values($enemy[id],'You have defeated <b>$stat[user]</b>. Gained <b>$expgain</b> EXP and <b>$creditgain</b> credits.')\"); mysql_query(\"insert into log (owner, log) values($stat[id],'You were defeated by <b>$enemy[user]</b>.')\"); exit; } else { attack(); } function attackback() { $repeat = ($enemy[agility] / $stat[agility]); if ($attackstr <= 0) { $attackstr = 1; } $mypower = ($mywep[power] + $stat[strength]); $epower = ($enemy[strength] + $ewep[power]); $attackdmg = ($epower - $mypower); if ($attackdmg <= 0) { $attackdmg = 1; } $round = 1; while ($round <= $attackstr && $stat[hp] >= 0) { if ($stat[unik] > $rzut) { $smarty->assign(\"fight\", \"<b>\".$enemy[user].\"</b> unikno³ ciosu.\"); $smarty->display('abattle.tpl'); $stat[hp] = ($stat[hp] - $attackdmg); $round = ($round + 1); } } ?> <?php if ($battle) { $mywep = mysql_fetch_array(mysql_query(\"select * from equipment where owner=$stat[id] and type='W' and status='E'\")); $myarm = mysql_fetch_array(mysql_query(\"select * from equipment where owner=$stat[id] and type='A' and status='E'\")); $ewep = mysql_fetch_array(mysql_query(\"select * from equipment where owner=$enemy[id] and type='W' and status='E'\")); $earm = mysql_fetch_array(mysql_query(\"select * from equipment where owner=$enemy[id] and type='A' and status='E'\")); if (!$enemy[id]) { $smarty->assign('Error', 'Nie ma takiego gracza <a href=battle.php>Wróæ</a>'); $smarty->display('failed3.tpl'); exit; } if ($enemy[id] == $stat[id]) { $smarty->assign('Error', 'Nie mo¿esz atakowaæ samego siebie <a href=battle.php>Wróæ</a>'); $smarty->display('failed3.tpl'); exit; } if ($enemy[hp] <= 0) { $smarty->assign('Error', '$enemy[user] aktualnie jest martwy <a href=battle.php>Wróæ</a>'); $smarty->display('failed3.tpl'); exit; } if ($stat[energy] < 1) { $smarty->assign('Error', 'Masz zbyt ma³o energi aby walczyæ <a href=battle.php>Wróæ</a>'); $smarty->display('failed3.tpl'); exit; } if ($stat[hp] <= 0) { $smarty->assign('Error', 'Jeste¶ martwy <a href=battle.php>Wróæ</a>'); $smarty->display('failed3.tpl'); exit; } if ($enemy[tribe] == $stat[tribe] && $enemy[tribe] > 0) { $smarty->assign('Error', 'Nie mo¿esz atakowaæ cz³onka swojego klanu <a href=battle.php>Wróæ</a>'); $smarty->display('failed3.tpl'); exit; } $span = ($stat['level'] > $enemy['level']); if ($span > 2) { $smarty->assign('Error', 'Nie mo¿esz atakowac s³abszych od siebie <a href=battle.php>Wróæ</a>'); $smarty->display('failed3.tpl'); exit; } if ($stat[agility] >= $enemy[agility]) { attack(); } else { attackback(); } } } ?> <?php $smarty->assign('fight', '$fight'); $smarty->display('abattle.tpl'); ?>
jest to skypt walki i jak klikam na kogo¶ aby walczyæ wyskakuje mi to:
Fatal error: Call to a member function on a non-object in /home/vanx/domains/public_html/gamersfusion/abattle.php on line 43
i plik tpl wygl±da tak:
<?php <table width=\"100%\"> <tr> <td><center><u><b>TURA: {$round}</b></u></center></td></tr> <br> <tr><td><center>{$who}</center></td></tr> <tr> <td> <br><br> {$fight} </td> </tr> <tr> <td> <br><br> <b><u>{$stat.user}:<br> </u></b> HP: {$stat.hp}<br> MP: {$stat.mana}<br> <b><u>{$enemy.user}: </u></b> HP: {$enemy.hp}<br> MP: {$enemy.mana}<br> </td> </tr> <tr> <td> <br><br><br> {$atack}<br> {if $stat.klasa == \"barbarzyñca\"} {$aatack}<br> {/if} {$potion} {$losthim} </td> </tr> </table> ?>
b³±d wystêpuje tutaj
Wiele razy nad tym siedzia³em i nic nie zrobi³em
<?php $smarty->assign(\"fight\", \"<b>\".$stat[user].\"</b> zada³ \".atackdmg.\" <b>\".$enemy[user].\"</b>\"); ?>

