1-)You are Buying too times same spell.
2-)When Player's Damage=8 Hit at battle 2-3 and when Player's Damage=150 hit at battle 2-3 again to same monster.
3-)I want to add different monster for every map.And you will choose monster in map.How i will do this ?
4-)And lastly i need to make Guild System.. is this possible ? or who can share guild.php here ?
I'm asking too much i know. But really im beginner's of php
A few problem [SOLVED]
A few problem [SOLVED]
Last edited by 19871986 on Mon Jul 11, 2011 10:16 am, edited 1 time in total.
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: A few problem
you are going to need to explain your problems better and add the code to the question.
Re: A few problem
1-)You are Buying too times same spell.( in skill Shop when i try to buy skill second time.its Buying.it must write '' You are already have this skill "
this is my spelltrainer.php
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
include_once 'statpanel.php';
?>
</div>
<div id="table">
<?php
$counter = 0;
echo "<small>";
print "<center>";
print "<table border='0' width='70%' cellspacing='20'>";
print "<tr><td width='25%' valign='top'>";
print "</td>";
print "<td valign='top' width='75%'>";
$spellinfo="SELECT * from spells where sclass = '$playerinfo3[pclass]' AND level <= '$playerinfo3[level]'";
$spellinfo2=mysql_query($spellinfo) or die("No spells available");
print "<table border='1' bordercolor='white' bgcolor='#ffffff'>";
print "<tr><td>Name<font color='ffffff'>________________</td><td>Spell Level<font color='ffffff'>______</td><td>Type<font color='ffffff'>______</td><td>Price<font color='ffffff'>______</td><td><font color='ffffff'>________________</td></tr>";
while($spellinfo3=mysql_fetch_array($spellinfo2))
{
$counter = 1;
print "<tr><td>$spellinfo3[name]</td><td>$spellinfo3[level]</td><td>$spellinfo3[type]</td><td>$spellinfo3[price]</td><td><A href='trainspell.php?id=$spellinfo3[id]'>Train Spell</td></tr>";
}
print "</table>";
print "</td></tr></table>";
print "</center>";
echo "</small>";
if ($counter == 0)
{
echo "<center>There are no Spells for you to train in at this time.<br>";
echo "<a href='index.php'>Go Back</center>";
exit;
}
echo "<center><a href='index.php'>NeverMind</center></a>";
?>
</div>
--------------------------------------------------------------------------------
2-)When Player's Damage=8 Hit at battle 2-3 to enemy and when Player's Damage=150 hit at battle 2-3 again to same monster.My attack.php at down
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<div id="login2" div align="center">
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
?>
</div>
<?php
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
include_once 'statpanel.php';
$pid = $playerinfo3['id'];
$name = $playerinfo3['name'];
$playerhp = $playerinfo3['hpoints'];
$playerattack = $playerinfo3['attack'];
$playerdefense = $playerinfo3['defense'];
?>
<div id="table">
<?php
if (isset($_GET['randid']))
{
$randid=$_GET['randid'];
$iteminfo="SELECT * from inventory where randid='$randid' AND id ='$pid'";
$iteminfo2=mysql_query($iteminfo) or die("could not get item stats!");
$iteminfo3=mysql_fetch_array($iteminfo2);
if (!$iteminfo3['name'])
{
}
else
{
$iname = $iteminfo3['name'];
$stats = $iteminfo3['stats'];
$statadd = $iteminfo3['statadd'];
$type = $iteminfo3['type'];
if ($type == "healing")
{
$newhp = $statadd + $playerhp;
if ($newhp > $playerinfo3['maxhp'])
{
$newhp = $playerinfo3['maxhp'];
}
$updateplayer="update players set hpoints='$newhp' where id='$pid'";
mysql_query($updateplayer) or die("Could not update player");
$updateitem="DELETE from inventory where id='$pid' AND randid='$randid' limit 1";
mysql_query($updateitem) or die("Could not delete item");
$playerhp = $newhp;
echo "Used " . $iname . " and recovered " . $statadd . ".<br>";
}
}}
$creature = $playerinfo3['creature'];
if ($creature != 0)
{
$creatureinfo="SELECT * from creatures where id='$creature'";
$creatureinfo2=mysql_query($creatureinfo) or die("could not get the creature you were fighting!");
$creatureinfo3=mysql_fetch_array($creatureinfo2);
}
else
{
////////////////////new for video 20
$areaninfo="SELECT * from locations where location='$pllocation' AND type='arena'";
$areaninfo2=mysql_query($areaninfo) or die("could not get arena");
$areaninfo3=mysql_fetch_array($areaninfo2);
$arenalevel = $areaninfo3['level'];
$creatureinfo="SELECT * from creatures where level <= '$playerinfo3[level]' order by rand() limit 1";
$creatureinfo2=mysql_query($creatureinfo) or die("could get a creature!");
$creatureinfo3=mysql_fetch_array($creatureinfo2);
$cid = $creatureinfo3['id'];
$updateplayer="update players set creature='$cid' where name='$name'";
mysql_query($updateplayer) or die("Could not update player");
}
$creature = $creatureinfo3['name'];
$creaturehp = $creatureinfo3['hpoints'];
$creatureattack = $creatureinfo3['attack'];
$creaturedefense = $creatureinfo3['defense'];
?>
</div>
<div id="player">
<?php
/////player info
echo "<u> " . $playerinfo3['name'] . "</u><br>";
echo "Heal = " . $playerhp . "<br>";
echo "Attack = " . $playerattack . "<br>";
echo "Defense = " . $playerdefense . "<br><br><br>";
?>
</div>
<div id="creature">
<?php
///////creature info
echo "<u> " . $creatureinfo3['name'] . "</u><br>";
echo "Heal = " . $creaturehp . "<br>";
echo "Attack = " . $creatureattack . "<br>";
echo "Defense = " . $creaturedefense . "<br><br><br>";
echo "<a href='attack.php'>Attack</a>";
echo "<br><a href='usemagic.php'>Use Magic</a>";
echo "<br><a href='useitem.php'>Use Item</a>";
echo "<br><a href='index.php'>Exit Arena</a>";
?>
</div>
<div id="logout">
<?php
echo "<br><a href='logout.php'><img src='images/logout.gif'>";
?>
</div>
-------------------------------------------------------------------------------------------
3-)I want to add different monster for every map.And you will choose monster in map.How i will do this ?
for example first map have orc and goblin monsters second map have wolf and darkwolf ...
4-)And lastly i need to make Guild System.. is this possible ? or who can share guild.php here ?
for this i think i need new .php for guild system
this is my spelltrainer.php
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
include_once 'statpanel.php';
?>
</div>
<div id="table">
<?php
$counter = 0;
echo "<small>";
print "<center>";
print "<table border='0' width='70%' cellspacing='20'>";
print "<tr><td width='25%' valign='top'>";
print "</td>";
print "<td valign='top' width='75%'>";
$spellinfo="SELECT * from spells where sclass = '$playerinfo3[pclass]' AND level <= '$playerinfo3[level]'";
$spellinfo2=mysql_query($spellinfo) or die("No spells available");
print "<table border='1' bordercolor='white' bgcolor='#ffffff'>";
print "<tr><td>Name<font color='ffffff'>________________</td><td>Spell Level<font color='ffffff'>______</td><td>Type<font color='ffffff'>______</td><td>Price<font color='ffffff'>______</td><td><font color='ffffff'>________________</td></tr>";
while($spellinfo3=mysql_fetch_array($spellinfo2))
{
$counter = 1;
print "<tr><td>$spellinfo3[name]</td><td>$spellinfo3[level]</td><td>$spellinfo3[type]</td><td>$spellinfo3[price]</td><td><A href='trainspell.php?id=$spellinfo3[id]'>Train Spell</td></tr>";
}
print "</table>";
print "</td></tr></table>";
print "</center>";
echo "</small>";
if ($counter == 0)
{
echo "<center>There are no Spells for you to train in at this time.<br>";
echo "<a href='index.php'>Go Back</center>";
exit;
}
echo "<center><a href='index.php'>NeverMind</center></a>";
?>
</div>
--------------------------------------------------------------------------------
2-)When Player's Damage=8 Hit at battle 2-3 to enemy and when Player's Damage=150 hit at battle 2-3 again to same monster.My attack.php at down
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<div id="login2" div align="center">
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
?>
</div>
<?php
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
include_once 'statpanel.php';
$pid = $playerinfo3['id'];
$name = $playerinfo3['name'];
$playerhp = $playerinfo3['hpoints'];
$playerattack = $playerinfo3['attack'];
$playerdefense = $playerinfo3['defense'];
?>
<div id="table">
<?php
if (isset($_GET['randid']))
{
$randid=$_GET['randid'];
$iteminfo="SELECT * from inventory where randid='$randid' AND id ='$pid'";
$iteminfo2=mysql_query($iteminfo) or die("could not get item stats!");
$iteminfo3=mysql_fetch_array($iteminfo2);
if (!$iteminfo3['name'])
{
}
else
{
$iname = $iteminfo3['name'];
$stats = $iteminfo3['stats'];
$statadd = $iteminfo3['statadd'];
$type = $iteminfo3['type'];
if ($type == "healing")
{
$newhp = $statadd + $playerhp;
if ($newhp > $playerinfo3['maxhp'])
{
$newhp = $playerinfo3['maxhp'];
}
$updateplayer="update players set hpoints='$newhp' where id='$pid'";
mysql_query($updateplayer) or die("Could not update player");
$updateitem="DELETE from inventory where id='$pid' AND randid='$randid' limit 1";
mysql_query($updateitem) or die("Could not delete item");
$playerhp = $newhp;
echo "Used " . $iname . " and recovered " . $statadd . ".<br>";
}
}}
$creature = $playerinfo3['creature'];
if ($creature != 0)
{
$creatureinfo="SELECT * from creatures where id='$creature'";
$creatureinfo2=mysql_query($creatureinfo) or die("could not get the creature you were fighting!");
$creatureinfo3=mysql_fetch_array($creatureinfo2);
}
else
{
////////////////////new for video 20
$areaninfo="SELECT * from locations where location='$pllocation' AND type='arena'";
$areaninfo2=mysql_query($areaninfo) or die("could not get arena");
$areaninfo3=mysql_fetch_array($areaninfo2);
$arenalevel = $areaninfo3['level'];
$creatureinfo="SELECT * from creatures where level <= '$playerinfo3[level]' order by rand() limit 1";
$creatureinfo2=mysql_query($creatureinfo) or die("could get a creature!");
$creatureinfo3=mysql_fetch_array($creatureinfo2);
$cid = $creatureinfo3['id'];
$updateplayer="update players set creature='$cid' where name='$name'";
mysql_query($updateplayer) or die("Could not update player");
}
$creature = $creatureinfo3['name'];
$creaturehp = $creatureinfo3['hpoints'];
$creatureattack = $creatureinfo3['attack'];
$creaturedefense = $creatureinfo3['defense'];
?>
</div>
<div id="player">
<?php
/////player info
echo "<u> " . $playerinfo3['name'] . "</u><br>";
echo "Heal = " . $playerhp . "<br>";
echo "Attack = " . $playerattack . "<br>";
echo "Defense = " . $playerdefense . "<br><br><br>";
?>
</div>
<div id="creature">
<?php
///////creature info
echo "<u> " . $creatureinfo3['name'] . "</u><br>";
echo "Heal = " . $creaturehp . "<br>";
echo "Attack = " . $creatureattack . "<br>";
echo "Defense = " . $creaturedefense . "<br><br><br>";
echo "<a href='attack.php'>Attack</a>";
echo "<br><a href='usemagic.php'>Use Magic</a>";
echo "<br><a href='useitem.php'>Use Item</a>";
echo "<br><a href='index.php'>Exit Arena</a>";
?>
</div>
<div id="logout">
<?php
echo "<br><a href='logout.php'><img src='images/logout.gif'>";
?>
</div>
-------------------------------------------------------------------------------------------
3-)I want to add different monster for every map.And you will choose monster in map.How i will do this ?
for example first map have orc and goblin monsters second map have wolf and darkwolf ...
4-)And lastly i need to make Guild System.. is this possible ? or who can share guild.php here ?
for this i think i need new .php for guild system
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: A few problem
you posted the wrong code for first 2 questions and please use the code buttons for your code
right next to the quote button.
3)I already setup 3 in the game, that is what locations are for.
4)it is super easy. Look at Forsaken Sanctum code that I have provided in Free code section or look at the FS video tutorials in my you tube.
right next to the quote button.
3)I already setup 3 in the game, that is what locations are for.
4)it is super easy. Look at Forsaken Sanctum code that I have provided in Free code section or look at the FS video tutorials in my you tube.
- vitinho444
- Posts: 2819
- Joined: Mon Mar 21, 2011 4:54 pm
Re: A few problem
halls saves the day again xD
thanks alot
thanks alot