ewcreators
Members-
Content Count
60 -
Joined
-
Last visited
About ewcreators
-
Rank
Member [Level 1]
Contact Methods
-
Website URL
http://revolutions.ifastnet.com
-
Best way is your own way.Everybody has their own way to learn something.PHP isn't a language which you will get in a snap of a finger by reading a whole bunch of books.Learn one thing, practice, move onto the next.Best way.A good site is tizag.com .----------------------------------
-
I'm going to go ahead and jump in here, its quite easy actually. As long as you understand how to use $_SESSION,$_GET,$_POST,$_REQUEST(optional, not necessary) but for profiles, concentrate on $_GET. Jmb was partially correct, but instead of doing that, why not just directly take the details from the user database rather than creating one more with duplicate fields and values? Follow this,itssame : For example, your database has a table called 'users' and its fields are username,rank,email. Code : <?php//call in your connection filerequire('connection2.php'); //Select from the database, the row which has the username of $_GET[profile] as give in the url. Example : url.com?a=account&s=session&profile=Test$query=mysql_query("SELECT * FROM users WHERE username='$_GET[profile]'");//Check the number of rows that are there in the database with the username of $_GET[profile], in this case Test is the account.$count_rows=mysql_num_rows($query);if ($count_rows >= 1) {$r=mysql_fetch_array($query);//above, we set $r to all the fields main display variable .echo "Username : $r[username] \n";echo "Email : $r[email] \n";echo "Rank : $r[rank] \n";}else {echo "No records of user.";}mysql_close(connection_variable);?> Thats the most basic script. You can modify it to your needs.
-
i just used a while loop to display the images, cool cat. And i set the images to the backround of the table data cell. And during the while loop, if the current image x,y co-ords being generated == to the current player's co-ordinates, it places a small image to show where the player is.And alex , ill try out your code.
-
Sure. well, ive only allowed it to be seen by my website staff . Details : Database : Table `map` x(int),y(int),image(varchar), Main Image : http://forums.xisto.com/no_longer_exists/404.png Sliced it into 225 small images. The map is a 15x15 square grid. But here's the code so far : $select3=mysql_query("SELECT * FROM map_user WHERE username='$_GET[a]'");$us=mysql_fetch_array($select3);$xu=$us['x'];$yu=$us['y'];$select222=mysql_query("SELECT * FROM ships_users WHERE user='$_GET[a]' && status='roam'");$coun1t=mysql_num_rows($select222);if ($coun1t < 1) {echo "YOU CANNOT ENTER SPACE WITHOUT A SPACE-SUITED AIRCRAFT!";}else {echo "<table cellpadding=0 cellspacing=0><tr>";$select111=mysql_query("SELECT * FROM map WHERE x >=1 && y <=15");while($map=mysql_fetch_array($select111)) {$x=$map['x'];$y=$map['y'];//if ($xu==$x && $yu==$y) {//if ($x==15) {//echo "<td><img src='$map[image]' border=1></td></tr>";//}//else {//echo "<td><img src='$map[image]' border=1></td>";//}//}if ($x==15) {echo "<td><img src='$map[image]'></td></tr>";}else {echo "<td><img src='$map[image]'></td>";}}echo "</tr></table>";}
-
Quick question, i have everything setup , i am now coding some advanced stuff for my map,so far for now the map displays its entire self, and i want to set the viewable grid/area of the map to like howyou said. So how do i execute my query? I mean what query? SHould i just add x>=..etc because i tried it and my map comes all messed up then.
-
You nailed it <3 Thanks, I wanted to do it that way but never knew how. Everyone, thanks for your feedback Although , don't "resolve" this thread yet, im going to try it out. Ok, I took a portion of a cleared out map from a game i play (using the map to test only), so now im just trying to code it in a square sort of way, like a graph with a x-axis and a y-axis i already made the database and the table , filled it with the co-ords..etc. Using a while loop doesn't look to promising, so im trying with a for loop. Ok, i did it with a for loop : <?php//connection detailsecho "<table cellpadding=0 cellspacing=0><tr>";$select=mysql_query("SELECT * FROM map WHERE x >=1 && y <= 6");while($map=mysql_fetch_array($select)) {$x=$map['x'];$y=$map['y'];if ($x==5) {echo "<td><img src='$map[image]'></td></tr>";}else {echo "<td><img src='$map[image]'></td>";}}echo "</tr></table>";mysql_close($conn);?>
-
Well, i was just wondering if something simple and basic could be made (like a small map where you could move around on, like you click up, and your position moves up and reports it to the database..etc) with co-ordinates in php . Taking the x-axis and the y-axis into consideration. Things like maps which online games have such as web-based space games or legacy-game.net.Thanks for any feedback,~Aldo
-
----------------------- Game Making ::Simple Attack Script:: Ok, When making my first, ok well second ..ok , my current and third one (first 2 were really bad, but then i found out my own way on how to make an idea script), I would always first write down or think of the stats of the character. For the purpose of this tut, i will be using space-ship kinda stats(since my first proper attack script was a space battle script) : The Attack Stats : -Accuracy(Aim) -Hull Damage(Main Dmg.) Defense Stats : -Shield Power(Armor) -Speed(dodge/swiftness) ATTACK/DAMAGE STATS Now , the main thing is that you visualize a real fight or fights on other games. Usually, the attacker gets the first blow, giving him an edge/incentive in attacking. The stat used for this is Hull Damage and its factor is Accuracy. Well, usually in my attack scripts, i don't find a way to make "Accuracy" do its purpose, so instead, i just add it to the Main Damage equation. I'm not gonna reveal some actual attack equations, ill just give a base simple one like most games have. //create the equation for the attacker$hit_1 =round(rand(1,$damage_1) * $accuracy_1 + $level_1 ) / $ level_1 / $accuracy_1 + 1);//create the equation for the defender$hit_2 =round(rand(1,$damage_2) * $accuracy_2 + $level_2 ) / $ level_2 / $accuracy_2); $hit_1 is the attack equation for the person who attacks aka the Attacker.$hit_2 is the attack equation for the person who is being attacked aka the Defender. You may notice, that in the second equation, there is no +1 at the end. this is because, the defender doesn't gain an incentive like the attacker. The attacker is the one who starts the fight thus taking the first blow which gives + 1 damage. Then the defender retaliates giving +0 bonus when he attacks back. This is not so much, its barely little, but I have some other work right now, so I will continue this tomorrow, or possibly a little more later on today if i can. The next part will be on how to utilize the defense stats and how to make the dodge stat "dodge" and the shield stat "defend". After that, we will lay out the entire structure and go through how it all fits in into 1 thing. ~Ewcreators aka Aldo
-
There are some errors in your echo : echo "<tr><td>" [b]'<a href="login.php?sid='.$d['spot_id'].'" </td><td> ".$d['name']."</a> <br> [/b]. "</td></tr>";Number of mistakes : 1.You didn't close the <a href tag. 2.You used quotes INSIDE a link. You shouldn't use '. inside, and also, you have a double-quoted echo ( echo " "), and in the sid=, you used '. instead of ". , even though its still wrong. There are a few more, but lets look at some things here : Before i tell you the correct code, you can use double quotes in a php echo which starts and ends with already existing double quotes. Meaning, in echo, whatever you want to embed, should be either in single quotes , or no quotes(for variables only and for extra things). Example : <?php//connectionecho "Hi, my name is $name, and my friend's name in the database is $friend[from_db]";?>^^this method is called Concatenation Using html stuff in php echos. <?php//connectionecho "Hello, my website is <a href='link.filetype'>";?>See, i used single quotes. -- Your correct code now, would be : echo "<tr> <td> <a href='login.php?sid=$d[spot_id]'> </td> <td> $d[name] </a> <br /> </td></tr>"; Someone correct me if im wrong anywhere, just had a hard time reading his code. Anyways,heres your anwser.
-
well, a site i play (been on it for almost 2 years), legacy-game.net has an sms billing system for subscription payment. And the game is coded in php. Its owner is zorg@legacy-game.net From what he had said,he had to set it up with a phone company and then do the coding through his server. Im guessing that the phone company must've made a static-ip which gets re-directed to the phone company's servers and the phone company does the rest.
-
you can do it with javascript. Just create code for no right clicks.but on the topic of php,use $_SERVER[HTTP_ADDRESS](i am not sure if its this) to verify the ip adress. If its yours, then allow editing..etc, if its not, only allow displaying.
-
Mimic Cronjobs... Is there a way?Please help
ewcreators replied to ewcreators's topic in Programming
while thats good, ill stick to mine XDThanks though, im keeping that as a template just incase i have any problems.Helpful as always alex