wannabe_god Posted December 9, 2006 Share Posted December 9, 2006 hi, im making a php mmorpg.The player already is able to register and log in, and walk though my world, seeing other players.Now as just walking quite boring, i am busy with the attack code.Let me first explain how the walking works:We search in the database the position from the player named [name]Then we search the names of all players in the positions around the player and generate a minimap and gamefield.If the player moves, the x and y are updated.Now for the attack script, i wanted to make something like:clicking on a player positioned on (-53,34) makes you go to the url index.php?attack=-53|34now we check if -53,34 is not too far away, 'couse we dont want players to be able just to type something and have huge siege weapons So if there is something on that postion, we check what it is (a tree, a player, an AI monster, ...)And then the attacking script with losing lifepoints etc. will be executed but it is not yet complete. I have a little problem first.Internet Explorer saves the adresses, and when i succesfully attacked another player, and walk away, i can select the url where i attacked him, and now my player moves to the position where i attacked that player the last time. He doesnt change any other thing in the database, the x and y stay normal.In opera everything works fine (microsoft )here's my attack script: //update settings$users=mysql_fetch_row(mysql_query("select * from users where name='".$name."'"));$char=mysql_fetch_row(mysql_query("select * from settings where name='".$name."'"));//attackif (isset($_GET["attack"])){ $canx=0; $cany=0; $x1=$char[1]; $y1=$char[2]; $fightpos=explode("|",$_GET["attack"]); //check if can attack x $x2=$fightpos[0]; if($x2-$x1<=$char[17]) {//$char[17] is the max range $canx=1; } //check if can attack y $y2=$fightpos[1]; if($y2-$y1<=$char[17]) { $cany=1; } //the actual attacking if($canx && $cany){ $attack_object=mysql_fetch_row(mysql_query("select * from map where x='$x2' and y='$y2'")); if ($attack_object){//if there is SOMETHING on the position we want to attack $isplayer=mysql_fetch_row(mysql_query("select * from settings where x='$x2' and y='$y2'")); if($isplayer){//if its a player $attacking=1; } } }} after that i just echo "attack" on top if attack is succesful (as this is before the body part) Link to comment Share on other sites More sharing options...
justsomeguy Posted December 11, 2006 Share Posted December 11, 2006 It's probably a cache issue. Is IE just displaying the cached page, or does it actually send a request to the server and update something in the database? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now