Jump to content
xisto Community

ewcreators

Members
  • Content Count

    60
  • Joined

  • Last visited

Everything posted by ewcreators

  1. 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 .----------------------------------
  2. 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.
  3. tried it out, didn't work as expected . Thanks for the help alex, but tis' okay. I'll show the map as an entire .
  4. 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.
  5. 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>";}
  6. 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.
  7. 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);?>
  8. the site i play it on )which is a mega hit( , it refreshes..etc and uses co-ords. *waits for alex to butt in
  9. 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
  10. ----------------------- 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
  11. 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.
  12. 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.
  13. 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.
  14. but shouldn't it actually be ("file.xml",variable=0,"GET"); for get? otherwise, how can we give it a name when using method post?Also, how do we send strings then using loadVariablesNum
  15. 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
  16. So, my free cpanel account (not on this server, another one) doesn't support cronjob among its awesome features. Now i had read a post online for alternative to cron jobs, that : Now depending on the actual functionality of the script (if its just a php page that needs to be executed). You could create a simple database that holds the last time executed, and a script included on your website that checks to see the last time it was executed and if its longer then X amount of time, execute it again. (use some ajax or something to do it behind the scenes) Now its not the first time ive heard this. A popular, unique online web based game i play (legacy-game.net) uses this method of cron jobs. Can anyone post a script or help for this? Is there any online script for this sort of thing? And if you could , could you please list a proper step-by-step way to mimic cron jobs. I sort of understand how to do it, but i dont get the part on how to manipulate time..etc. I mean to check the time with php with the time in the mysql database. [hr=noshade] [/hr] Nevermind , i got it. Easier then i thought! Anyways, I'm gonna guide all the newbs and people who might need help in the future with this : This script is for running on an hourly basis. How it is to be run, that is upto you. You can use ajax or anything. I have put it on all of my pages(basically ive put it in one page which is required in all pages) and once that page is visited, the page is run. <?phpecho "<Br /> CRONJOB DETAILS : <br />";//create a variable which contains the current hour of the server(from 1 - 12)$timetocheck=date(g);//select the database table which contains the cronjob details$select=mysql_query("SELECT * FROM cron");$time=mysql_fetch_array($select);//setting the variable $timetoadd to the data of $timetocheck$timetoadd=$timetocheck;//echo "Last time executed : $time[last_executed]";//checking if the current time (in hour from 1-12) is not equal to the time given in the database of which the last cron was executed//if it is not, then it will initiate the required cron jobs along with updating the value for last_executed time in the database.if ($timetoadd != $time[last_executed]) {$q=mysql_query("UPDATE cron SET last_executed='$timetocheck'");require('../crons/turns.php');echo "<br/>The Following Crons have been run :</br>";echo "-Turns Update Cron (+200/h)<br />";}else {echo "<br />No cron is currently being run.<br />";}?>
  17. ok nvm that, im usingxml.But how do i send data back to the server?like send("url",variable,method),i dont exactly know how to use this syntax.
  18. http://forums.xisto.com/no_longer_exists/: myVariable=How are you today?&money=10000 Actionscript: var myData:LoadVars=new LoadVars();myData.onLoad = function () { thelist.addItem(this.money);}myData.load("http://revolutions.ifastnet.com/misc/myText1.txt"); Now in my list component on my flash stage, when i run the .swf, where the money variable 10000 should be, it just says undefined,undefined. When i run the .swf from my local home directory, it says undefined and doesn't display the variable. Even when i upload it, it doesnt display the variable. Please help , since i want to display php details of my users of my website in a flash app which i will only do once i test my flash connections.
  19. that may be sorta complex. The easiest way is to use : <?php$line_break=nl2br($_POST['text']);echo $line;?>nl2br() is a function which inserts a <br /> automatically at the end of every line.
  20. How do i change colors or styles of text in c++? like for colors eg. : hello world for styles: Hello World
  21. Yea i know what the problem is coolcat51. I used to have this a lot of times. all codes go here....LOOK IN YOUR prompt CODE..this is the correct one :lottoentry=prompt("enter a number","");you see, in prompts, you have to put ".""or ","" in the ending or whatever mark you want there. "?"" "s"" ..etc i stick to ",""
  22. Well, There is no flash game maker program. What i was saying is that Flash 8 ..etc can be used to design games. You just need to know the language associated with it, actionscript.
  23. Lua===never heard ofPerl & PHP are the languages ive seen used to make ONLINE WEB BASED games...mostly php.
  24. btw, your ORDER BY `id` DESC idea didnt work :Pit just grabbed the rows 1,6 which were desc in id order.meaning id 1,2,3,4,5,6
  25. ok...show me the settimeout part please coz i wont know how to fit it into all this real timey :/ Also, now http://forums.xisto.com/no_longer_exists/ (that is the one i showed) is not coming real timey :/ It loads I mean, when i click on the send text button, it loads the page again :/
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.