Pomoc - Szukaj - U¿ytkownicy - Kalendarz
Pe³na wersja: Smarty i Gamers fusion
Forum PHP.pl > Forum > Przedszkole
Vanx
Mam skrypt z gamers fusion i zmieni³em go aby dzia³a³ ze smartym i zrobi³em to :
plik php:
  1. <?
  2. global $stat;
  3. global $enemy;
  4. global $myarm;
  5. global $mywep;
  6. global $earm;
  7. global $ewep;
  8.  
  9.  
  10. ?>
  11.  
  12. <?php
  13. function attack() {
  14. global $stat;
  15. global $enemy;
  16. global $myarm;
  17. global $mywep;
  18. global $earm;
  19. global $ewep;
  20.  
  21. $repeat = ($stat[agility] / $enemy[agility]);
  22. $attackstr = ceil($repeat);
  23. if ($attackstr <= 0) {
  24. $attackstr = 1;
  25. }
  26. $mypower = ($mywep[power] + $stat[strength]);
  27. $epower = ($enemy[strength] + $earm[power]);
  28.  
  29. $attackdmg = ($mypower - $epower);
  30. if ($attackdmg <= 0) {
  31. $attackdmg = 1;
  32. }
  33. $round = 1;
  34. $rzut = rand(1,$enemy[speed]);
  35. while ($round <= $attackstr && $enemy[hp] >= 0) {
  36. if ($enemy[unik] > $rzut) {
  37. $smarty->assign('fight', '<b>$enemy[user]</b> unikno³ twojego ciosu.');
  38. $smarty->display('abattle.tpl');
  39. } else {
  40.  
  41. $smarty->assign(&#092;"fight\", \"<b>\".$stat[user].\"</b> zada³ \".atackdmg.\" <b>\".$enemy[user].\"</b>\");
  42. $smarty->display('abattle.tpl');
  43.  
  44. $enemy[hp] = ($enemy[hp] - $attackdmg);
  45. $round = ($round + 1);
  46. }
  47. }
  48.  
  49. if ($enemy[hp] <= 0) {
  50. $enemy[hp] = 0;
  51. $smarty->assign(&#092;"fight\", \"<br><b>\".$stat[user].\"</b> Wygrywa!<br>\");
  52. $smarty->display('abattle.tpl');
  53. $expgain = (rand(5,10) * $enemy[level]);
  54. $creditgain = ($enemy[credits] / 10);
  55. $smarty->assign(&#092;"fight\", \"<b>\".$stat[user].\"</b> zdobywa \".$expgain.\" do¶wiadczenia i \".$creditgain.\" sztuk z³ota.\");
  56. $smarty->display('abattle.tpl');
  57. mysql_query(&#092;"update players set hp=$stat[hp] where id=$stat[id]\");
  58. mysql_query(&#092;"update players set hp=0 where id=$enemy[id]\");
  59. mysql_query(&#092;"update players set exp=exp+$expgain where id=$stat[id]\");
  60. mysql_query(&#092;"update players set credits=credits+$creditgain where id=$stat[id]\");
  61. mysql_query(&#092;"update players set wins=wins+1 where id=$stat[id]\");
  62. mysql_query(&#092;"update players set losses=losses+1 where id=$enemy[id]\");
  63. mysql_query(&#092;"update players set lastkilled='$enemy[user]' where id=$stat[id]\");
  64. mysql_query(&#092;"update players set lastkilledby='$stat[user]' where id=$enemy[id]\");
  65. $texp = ($stat[exp] + $expgain);
  66. $expn = (($stat[level] * 50) + ($stat[level] * 15));
  67. $tlevel = $stat[level] +1;
  68. if ($texp >= $expn) {
  69. $smarty->assign(&#092;"fight\", \"<b>\".$stat[user].\"</b> awansuje na \".$tlevel.\" poziom.\");
  70. $smarty->display('abattle.tpl');
  71. mysql_query(&#092;"update players set ap=ap+4 where id=$stat[id]\");
  72. mysql_query(&#092;"update players set level=level+1 where id=$stat[id]\");
  73. mysql_query(&#092;"update players set exp=0 where id=$stat[id]\");
  74. mysql_query(&#092;"insert into log (owner, log) values($stat[id],'Pokona³e¶ <b>$enemy[user]</b> i zdoby³e¶ poziom.')\");
  75. }
  76.  
  77. mysql_query(&#092;"insert into log (owner, log) values($stat[id],'Zosta³e¶ zaatakowany przez <b>$enemy[user]</b>. zdobywasz $expgain EXP i $creditgain sztuk z³ota.')\");
  78. mysql_query(&#092;"insert into log (owner, log) values($enemy[id],'Zosta³e¶ zaatakowany i pokonany przez <b>$stat[user]</b>.')\");
  79. } else {
  80. attackback();
  81. }
  82. }
  83.  
  84.  
  85. if ($stat[hp] <= 0) {
  86. $smarty->assign(&#092;"fight\", \"<b>\".$enemy[user].\"</b> Wygrywa.\");
  87. $smarty->display('abattle.tpl');
  88. $expgain = (rand(5,10) * $stat[level]);
  89. $creditgain = ($enemy[credits] / 10);
  90. $smarty->assign(&#092;"fight\", \"<b>\".$enemy[user].\"</b> zdobywa \".$expgain.\" do¶wiadcznia i \".$creditgain.\" sztuk z³ota.\");
  91. $smarty->display('abattle.tpl');
  92. mysql_query(&#092;"update players set hp=$enemy[hp] where id=$enemy[id]\");
  93. mysql_query(&#092;"update players set hp=0 where id=$stat[id]\");
  94. mysql_query(&#092;"update players set exp=exp+$expgain where id=$enemy[id]\");
  95. mysql_query(&#092;"update players set credits=credits+$creditgain where id=$enemy[id]\");
  96. mysql_query(&#092;"update players set wins=wins+1 where id=$enemy[id]\");
  97. mysql_query(&#092;"update players set losses=losses+1 where id=$stat[id]\");
  98. mysql_query(&#092;"update players set lastkilled='$stat[user]' where id=$enemy[id]\");
  99. mysql_query(&#092;"update players set lastkilledby='$enemy[user]' where id=$stat[id]\");
  100. $texp = ($enemy[exp] + $expgain);
  101. $expn = (($enemy[level] * 50) + ($enemy[level] * 15));
  102. $tlevel = $enemy[level] + 1;
  103. if ($texp >= $expn) {
  104. $smarty->assign(&#092;"fight\", \"<b>\".$enemy[user].\"</b> awansuje na \".$tlevel.\" poziom.\");
  105. $smarty->display('abattle.tpl');
  106. mysql_query(&#092;"update players set ap=ap+4 where id=$enemy[id]\");
  107. mysql_query(&#092;"update players set level=level+1 where id=$enemy[id]\");
  108. mysql_query(&#092;"update players set exp=0 where id=$enemy[id]\");
  109. mysql_query(&#092;"insert into log (owner, log) values($enemy[id],'Pokona³e¶ <b>$stat[user]</b> i zdoby³e¶ poziom.')\");
  110. }
  111. mysql_query(&#092;"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.')\");
  112. mysql_query(&#092;"insert into log (owner, log) values($stat[id],'You were defeated by <b>$enemy[user]</b>.')\");
  113. } else {
  114. attack();
  115. }
  116.  
  117. function attackback() {
  118. global $stat;
  119. global $enemy;
  120. global $myarm;
  121. global $mywep;
  122. global $earm;
  123. global $ewep;
  124.  
  125. $repeat = ($enemy[agility] / $stat[agility]);
  126. $attackstr = ceil($repeat);
  127. if ($attackstr <= 0) {
  128. $attackstr = 1;
  129. }
  130. $mypower = ($mywep[power] + $stat[strength]);
  131. $epower = ($enemy[strength] + $ewep[power]);
  132.  
  133. $attackdmg = ($epower - $mypower);
  134. if ($attackdmg <= 0) {
  135. $attackdmg = 1;
  136. }
  137.  
  138. $round = 1;
  139. $rzut = rand(1,$stat[speed]);
  140. while ($round <= $attackstr && $stat[hp] >= 0) {
  141. if ($stat[unik] > $rzut) {
  142. $smarty->assign(&#092;"fight\", \"<b>\".$enemy[user].\"</b> unikno³ ciosu.\");
  143. $smarty->display('abattle.tpl');
  144. $stat[hp] = ($stat[hp] - $attackdmg);
  145. $round = ($round + 1);
  146. }
  147. }
  148. ?>
  149.  
  150. <?php
  151. if ($battle) {
  152. global $stat;
  153. global $enemy;
  154. global $myarm;
  155. global $mywep;
  156. global $earm;
  157. global $ewep;
  158.  
  159. $enemy = mysql_fetch_array(mysql_query(&#092;"select * from players where id=$battle\"));
  160. $mywep = mysql_fetch_array(mysql_query(&#092;"select * from equipment where owner=$stat[id] and type='W' and status='E'\"));
  161. $myarm = mysql_fetch_array(mysql_query(&#092;"select * from equipment where owner=$stat[id] and type='A' and status='E'\"));
  162. $ewep = mysql_fetch_array(mysql_query(&#092;"select * from equipment where owner=$enemy[id] and type='W' and status='E'\"));
  163. $earm = mysql_fetch_array(mysql_query(&#092;"select * from equipment where owner=$enemy[id] and type='A' and status='E'\"));
  164.  
  165. if (!$enemy[id]) {
  166. $smarty->assign('Error', 'Nie ma takiego gracza <a href=battle.php>Wróæ</a>');
  167. $smarty->display('failed3.tpl');
  168. }
  169. if ($enemy[id] == $stat[id]) {
  170. $smarty->assign('Error', 'Nie mo¿esz atakowaæ samego siebie <a href=battle.php>Wróæ</a>');
  171. $smarty->display('failed3.tpl');
  172. }
  173. if ($enemy[hp] <= 0) {
  174. $smarty->assign('Error', '$enemy[user] aktualnie jest martwy <a href=battle.php>Wróæ</a>');
  175. $smarty->display('failed3.tpl');
  176. }
  177. if ($stat[energy] < 1) {
  178. $smarty->assign('Error', 'Masz zbyt ma³o energi aby walczyæ <a href=battle.php>Wróæ</a>');
  179. $smarty->display('failed3.tpl');
  180. }
  181. if ($stat[hp] <= 0) {
  182. $smarty->assign('Error', 'Jeste¶ martwy <a href=battle.php>Wróæ</a>');
  183. $smarty->display('failed3.tpl');
  184. }
  185.  
  186. if ($enemy[tribe] == $stat[tribe] && $enemy[tribe] > 0) {
  187. $smarty->assign('Error', 'Nie mo¿esz atakowaæ cz³onka swojego klanu <a href=battle.php>Wróæ</a>');
  188. $smarty->display('failed3.tpl');
  189. }
  190. $span = ($stat['level'] > $enemy['level']);
  191. if ($span > 2) {
  192. $smarty->assign('Error', 'Nie mo¿esz atakowac s³abszych od siebie <a href=battle.php>Wróæ</a>');
  193. $smarty->display('failed3.tpl');
  194. }
  195. mysql_query(&#092;"update players set energy=energy-1 where id=$stat[id]\");
  196. if ($stat[agility] >= $enemy[agility]) {
  197. attack();
  198. } else {
  199. attackback();
  200. }
  201. }
  202. }
  203. ?>
  204.  
  205. <?php
  206. $smarty->assign('fight', '$fight');
  207. $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:
  1. <?php
  2.  
  3. {include file=&#092;"header.php\"}
  4. <table width=&#092;"100%\">
  5. <tr>
  6. <td><center><u><b>TURA: {$round}</b></u></center></td></tr>
  7. <br>
  8. <tr><td><center>{$who}</center></td></tr>
  9. <tr>
  10. <td>
  11. <br><br>
  12. {$fight}
  13. </td>
  14. </tr>
  15. <tr>
  16. <td>
  17. <br><br>
  18. <b><u>{$stat.user}:<br> </u></b>
  19. HP: {$stat.hp}<br>
  20. MP: {$stat.mana}<br>
  21. <b><u>{$enemy.user}: </u></b>
  22. HP: {$enemy.hp}<br>
  23. MP: {$enemy.mana}<br>
  24. </td>
  25. </tr>
  26. <tr>
  27. <td>
  28. <br><br><br>
  29. {$atack}<br>
  30. {if $stat.klasa == &#092;"barbarzyñca\"}
  31. {$aatack}<br>
  32. {/if}
  33. {$potion}
  34. {$losthim}
  35.  
  36. </td>
  37. </tr>
  38. </table>
  39.  
  40. ?>

b³±d wystêpuje tutaj
  1. <?php
  2. $smarty->assign(&#092;"fight\", \"<b>\".$stat[user].\"</b> zada³ \".atackdmg.\" <b>\".$enemy[user].\"</b>\");
  3. ?>
Wiele razy nad tym siedzia³em i nic nie zrobi³em angrysmiley.gif jesli kto¶ znajdzie gdzie zrobi³em b³±d to bede wdziêczny biggrin.gif
MrMag
moze powinno byc

  1. <?php
  2. $smarty->assign(&#092;"fight\", \"<b>\".$stat[user].\"</b> zada³ \".$atackdmg.\" <b>\".$enemy[user].\"</b>\");
  3. ?>


czyli byc moze zjadles $ przy atackdmg
aleksander
  1. <?php
  2.  $enemy = mysql_fetch_array(mysql_query(&#092;"select * from players where id=$battle\"));
  3. $mywep = mysql_fetch_array(mysql_query(&#092;"select * from equipment where owner=$stat[id] and type='W' and status='E'\"));
  4. $myarm = mysql_fetch_array(mysql_query(&#092;"select * from equipment where owner=$stat[id] and type='A' and status='E'\"));
  5. $ewep = mysql_fetch_array(mysql_query(&#092;"select * from equipment where owner=$enemy[id] and type='W' and status='E'\"));
  6. $earm = mysql_fetch_array(mysql_query(&#092;"select * from equipment where owner=$enemy[id] and type='A' and status='E'\"));
  7. ?>
Biedna baza danych biggrin.gif

Przeciez to sie da zrobic jednym zapytaniem!!
Vanx
Cytat("aleksander")
czyli byc moze zjadles $ przy atackdmg

Mylisz siê nawet próbowa³em skróciæ to do tego
Kod
$smarty->assign("fight", atakujesz"</b>");
Nawet takie co¶ nie dzia³a sad.gif i niewiem oco chodzi biggrin.gif
Cytat("MrMag")
Przeciez to sie da zrobic jednym zapytaniem!!

Wiem, ale gdymym u¿y³ jednego zaptania to szybko bym sie zgubi³ biggrin.gif Wole mieæ kilka smile.gif
nospor
a gdzie masz co¶ takiego: $smarty= new Smarty()? Bo ty teraz probujesz uzyæ obietku, który nigdzie nie jest zainicjalizowany

Cytat
Biedna baza danych
Oj biedna, biedna ... biggrin.gif
Vanx
W czym biedna??
a jak da³em te $smarty= new Smarty(); to te¿ niedzia³a³o sad.gif
nospor
Cytat
W czym biedna??
W tym ¿e j± zaje¼dzisz niepotrzebnymi zapytaniami

Cytat
a jak da³em te $smarty= new Smarty(); to te¿ niedzia³a³o
A gdzie ty to da³e¶? W funkcji attack()? Bo komunikat jaki dostajesz mówi, ¿e starasz siê wywo³aæ metodê obiektu na zmiennej, która nie jest obiektem. W lini, w której wywala ci b³±d jedynie mo¿e to siê odnosiæ do: $smarty->assign.....
Czyli wywo³ujesz metodê assign, ale zmienna $smarty nie jest obiektem. Wiêc albo ty j± inicjujesz poza funkcj± a w funkcji nie jest widziana, albo .... w ka¿dym b±dz± razie $smarty nie jest obiektem. Tu le¿y problem
Vanx
Zadzia³a³o smile.gif da³em w funkcji attacj(); i ju¿ niewy¶wietla mi tego b³edu ale mam kolejny otó¿ wszystkie tabele zaczynaj± mi siê mieszaæ i w ka¿dej jest co¶ innego. np.
w jedenj jest $stat[user] zada³ $atackdmg $enemy[user] w drugiej (gdzie¶ obok)
$stat[user] Wygrywa!
a ja chcia³bym aby wszystko mi wy¶wietla³o w jednej tabeli. jak mam to zrobiæ?
Go¶æ
no coz...
robie MMORPG na Gamers Fusion 2.5 biggrin.gif

I teraz ponoc zeby dodawac potworki trzeba jakos zmodyfikowac battle.php biggrin.gif

Mój kod php to :

  1. <?php $title = "Battle Arena"; include("header.php"); ?>
  2.  
  3. <?
  4. global $stat;
  5. global $enemy;
  6. global $myarm;
  7. global $mywep;
  8. global $earm;
  9. global $ewep;
  10. ?>
  11.  
  12. <?php
  13. function attack() {
  14. global $stat;
  15. global $enemy;
  16. global $myarm;
  17. global $mywep;
  18. global $earm;
  19. global $ewep;
  20.  
  21. $repeat = ($stat[agility] / $enemy[agility]);
  22. $attackstr = ceil($repeat);
  23. if ($attackstr <= 0) {
  24. $attackstr = 1;
  25. }
  26. $mypower = ($mywep[power] + $stat[strength]);
  27. $epower = ($enemy[strength] + $earm[power]);
  28.  
  29. $attackdmg = ($mypower - $epower);
  30. if ($attackdmg <= 0) {
  31. $attackdmg = 1;
  32. }
  33.  
  34. $round = 1;
  35. while ($round <= $attackstr && $enemy[hp] >= 0) {
  36. $enemy[hp] = ($enemy[hp] - $attackdmg);
  37. print "<b>$stat[user]</b> attacks <b>$enemy[user]</b> for <b>$attackdmg</b> damage! ($enemy[hp] left)<br>";
  38. $round = ($round + 1);
  39. }
  40.  
  41. if ($enemy[hp] <= 0) {
  42. $enemy[hp] = 0;
  43. print "<br><b>$stat[user]</b> is the winner!<br>";
  44. $expgain = (rand(5,10) * $enemy[level]);
  45. $creditgain = ($enemy[credits] / 10);
  46. print "<b>$stat[user]</b> have gained <b>$expgain</b> EXP and <b>$creditgain</b> cash.<br>";
  47. mysql_query("update players set hp=$stat[hp] where id=$stat[id]");
  48. mysql_query("update players set hp=0 where id=$enemy[id]");
  49. mysql_query("update players set exp=exp+$expgain where id=$stat[id]");
  50. mysql_query("update players set credits=credits+$creditgain where id=$stat[id]");
  51. mysql_query("update players set wins=wins+1 where id=$stat[id]");
  52. mysql_query("update players set losses=losses+1 where id=$enemy[id]");
  53. mysql_query("update players set lastkilled='$enemy[user]' where id=$stat[id]");
  54. mysql_query("update players set lastkilledby='$stat[user]' where id=$enemy[id]");
  55. $texp = ($stat[exp] + $expgain);
  56. $expn = (($stat[level] * 50) + ($stat[level] * 15));
  57. if ($texp >= $expn) {
  58. print "<b>$stat[user]</b> gained a level! +3 AP and +1 Level.";
  59. mysql_query("update players set ap=ap+3 where id=$stat[id]");
  60. mysql_query("update players set level=level+1 where id=$stat[id]");
  61. mysql_query("update players set exp=0 where id=$stat[id]");
  62. mysql_query("insert into log (owner, log) values($stat[id],'During a fight with <b>$enemy[user]</b>, you gained a level.')");
  63. }
  64. mysql_query("insert into log (owner, log) values($stat[id],'You have defeated <b>$enemy[user]</b>. Gained <b>$expgain</b> EXP and <b>$creditgain</b> credits.')");
  65. mysql_query("insert into log (owner, log) values($enemy[id],'You were defeated by <b>$stat[user]</b>.')");
  66.  
  67. include("footer.php");
  68. } else {
  69. attackback();
  70. }
  71. }
  72.  
  73. function attackback() {
  74. global $stat;
  75. global $enemy;
  76. global $myarm;
  77. global $mywep;
  78. global $earm;
  79. global $ewep;
  80.  
  81. $repeat = ($enemy[agility] / $stat[agility]);
  82. $attackstr = ceil($repeat);
  83. if ($attackstr <= 0) {
  84. $attackstr = 1;
  85. }
  86. $mypower = ($mywep[power] + $stat[strength]);
  87. $epower = ($enemy[strength] + $earm[power]);
  88.  
  89. $attackdmg = ($epower - $mypower);
  90. if ($attackdmg <= 0) {
  91. $attackdmg = 1;
  92. }
  93.  
  94. $round = 1;
  95. while ($round <= $attackstr && $stat[hp] >= 0) {
  96. $stat[hp] = ($stat[hp] - $attackdmg);
  97. print "<b>$enemy[user]</b> attacks <b>$stat[user]</b> for <b>$attackdmg</b> damage! ($stat[hp] left)<br>";
  98. $round = ($round + 1);
  99. }
  100.  
  101. if ($stat[hp] <= 0) {
  102. print "<br><b>$enemy[user]</b> is the winner!<br>";
  103. $expgain = (rand(5,10) * $stat[level]);
  104. $creditgain = ($enemy[credits] / 10);
  105. print "<b>$enemy[user]</b> have gained <b>$expgain</b> EXP and <b>$creditgain</b> cash.<br>";
  106. mysql_query("update players set hp=$enemy[hp] where id=$enemy[id]");
  107. mysql_query("update players set hp=0 where id=$stat[id]");
  108. mysql_query("update players set exp=exp+$expgain where id=$enemy[id]");
  109. mysql_query("update players set credits=credits+$creditgain where id=$enemy[id]");
  110. mysql_query("update players set wins=wins+1 where id=$enemy[id]");
  111. mysql_query("update players set losses=losses+1 where id=$stat[id]");
  112. mysql_query("update players set lastkilled='$stat[user]' where id=$enemy[id]");
  113. mysql_query("update players set lastkilledby='$enemy[user]' where id=$stat[id]");
  114. $texp = ($enemy[exp] + $expgain);
  115. $expn = (($enemy[level] * 50) + ($enemy[level] * 15));
  116. if ($texp >= $expn) {
  117. print "<b>$enemy[user]</b> gained a level! +3 AP and +1 Level.";
  118. mysql_query("update players set ap=ap+3 where id=$enemy[id]");
  119. mysql_query("update players set level=level+1 where id=$enemy[id]");
  120. mysql_query("update players set exp=0 where id=$enemy[id]");
  121. mysql_query("insert into log (owner, log) values($enemy[id],'During a fight with <b>$stat[user]</b>, you gained a level.')");
  122. }
  123. 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.')");
  124. mysql_query("insert into log (owner, log) values($stat[id],'You were defeated by <b>$enemy[user]</b>.')");
  125.  
  126. include("footer.php");
  127. } else {
  128. attack();
  129. }
  130. }
  131. ?>
  132.  
  133. <?php
  134. if (!$action && !$battle) {
  135. print "Welcome to the battle arena.<br><br>
  136. - <a href=battle.php?action=levellist>List by level</a>.<br>
  137. - <a href=battle.php?action=showalive>Show alive players</a>.<br>";
  138. }
  139.  
  140. if ($action == showalive) {
  141. print "Showing all alive at level $stat[level]...<br><br>";
  142. print "<table><tr><td width=20><b><u>ID</td><td width=100><b><u>Name</td><td width=100><b><u>Rank</td><td width=20><b><u>Tribe</td><td width=60><b><u>Options</td></tr>";
  143. $esel = mysql_query("select * from players where level=$stat[level] and hp>0 limit 50 ");
  144. while ($elist = mysql_fetch_array($esel)) {
  145. print "<tr><td>$elist[id]</td><td><a href=view.php?view=$elist[id]>$elist[user]</a><td>$elist[rank]</td><td>$elist[tribe]</td></td><td>- <A href=battle.php?battle=$elist[id]>Attack</a></td></tr>";
  146. }
  147. print "</table><br>";
  148. print "Or you can always... <a href=battle.php>go back</a>.";
  149. }
  150.  
  151. if ($action == levellist) {
  152. print "<form method=post action=battle.php?action=levellist&step=go>";
  153. print "Show me all alive at... <select name=slevel>";
  154. for ($i = 1; $i < 100; ++$i) {
  155. print "<option value=$i>Level $i</option>";
  156. }
  157. print "</select> <input type=submit value=Go></form>";
  158.  
  159. if ($step == go) {
  160. print "<table><tr><td width=20><b><u>ID</td><td width=100><b><u>Name</td><td width=100><b><u>Rank</td><td width=20><b><u>Tribe</td><td width=60><b><u>Options</td></tr>";
  161. $esel = mysql_query("select * from players where level=$slevel and hp>0 limit 50");
  162. while ($elist = mysql_fetch_array($esel)) {
  163. print "<tr><td>$elist[id]</td><td><a href=view.php?view=$elist[id]>$elist[user]</a></td><td>$elist[rank]</td><td>$elist[tribe]</td<td>- <A href=battle.php?battle=$elist[id]>Attack</a></td></tr>";
  164. }
  165. print "</table><br>";
  166. print "Or you can always... <a href=battle.php>go back</a>.";
  167. }
  168. }
  169.  
  170. if ($battle) {
  171. global $stat;
  172. global $enemy;
  173. global $myarm;
  174. global $mywep;
  175. global $earm;
  176. global $ewep;
  177.  
  178. $enemy = mysql_fetch_array(mysql_query("select * from players where id=$battle"));
  179. $mywep = mysql_fetch_array(mysql_query("select * from equipment where owner=$stat[id] and type='W' and status='E'"));
  180. $myarm = mysql_fetch_array(mysql_query("select * from equipment where owner=$stat[id] and type='A' and status='E'"));
  181. $ewep = mysql_fetch_array(mysql_query("select * from equipment where owner=$enemy[id] and type='W' and status='E'"));
  182. $earm = mysql_fetch_array(mysql_query("select * from equipment where owner=$enemy[id] and type='A' and status='E'"));
  183.  
  184. if (!$enemy[id]) {
  185. print "No such player.";
  186. include("footer.php");
  187. }
  188. if ($enemy[id] == $stat[id]) {
  189. print "You cannot attack yourself.";
  190. include("footer.php");
  191. }
  192. if ($enemy[hp] <= 0) {
  193. print "$enemy[user] is already dead.";
  194. include("footer.php");
  195. }
  196. if ($stat[energy] < 1) {
  197. print "You do not have enough energy.";
  198. include("footer.php");
  199. }
  200. if ($stat[hp] <= 0) {
  201. print "You're dead.";
  202. include("footer.php");
  203. }
  204. if ($enemy[tribe] == $stat[tribe] && $enemy[tribe] > 0) {
  205. print "Dont attack your own tribe you fool!";
  206. include("footer.php");
  207. }
  208. $span = ($stat[level] - $enemy[level]);
  209. if ($span > 2) {
  210. print "You cannot attack people 2 levels lower/higher then you.";
  211. include("footer.php");
  212. }
  213. print "<b><u>$stat[user] vs. $enemy[user]</b></u><br>";
  214. mysql_query("update players set energy=energy-1 where id=$stat[id]");
  215. if ($stat[agility] >= $enemy[agility]) {
  216. attack();
  217. } else {
  218. attackback();
  219. }
  220. }
  221.  
  222. ?>
  223.  
  224. <?php include("footer.php"); ?>

Nie wiem co zmienic :/

O ile trzeba

Gre stawaiam na boo.pl <-- na poczatek ponoc wystarczy a fundusze sie koncza haha.gifD

No i jakas mala pomoc co do ry sie przydala

(mam PHPmyAdmina wiec o zainstalowaniu gierki problema nie bedzie biggrin.gif)
aarambo.gif
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.