Jump to content

StormTheGates

Members
  • Posts

    170
  • Joined

  • Last visited

Everything posted by StormTheGates

  1. I made this topic sorta here once before. Basically I am having a problem with my game. I have a bank feature, players can add and withdraw money ect ect. What it seems people are doing is quickly when the server is under a load to add their money to it and buy something at the same time. So the money goes in the bank while they get the item they bought as well. Is there anyway you guys can think of to stop people from submitting 2 forms at the same time? All ideas are welcome.
  2. Ahhhhhhh I see, is there any way to get it to reindex?
  3. Can someone explain to me why this dosnt work? $cards = array("2h", "4d", "1s", "5c", "8d"); natsort($cards); echo "$cards[0]-$cards[1]-$cards[2]-$cards[3]"; You would think that it would sort them into 1s-2h-4d-5c But it dosnt, it dosnt seem to sort at all. It just prints out 2h-4d-1s-5c Any ideas why? Its driving me insane.
  4. Yea that formula would work. What you didnt get about the agility is that you put it before the loop, that way it only sets the $whosturn variable once. The loop will never reach outside of itself so you would get that turn rotation. So for armor and weapons I would have something in the database like this Table Weapons |----------------------------| |Username | Weapon | Power| |----------------------------| |PersonOne | Dagger | 4 | |----------------------------| Then do a query to select the power from the table like this mysql_query("SELECT power FROM weapons WHERE username='$attacker'"); Then assign that to a variable called $attackpower and incorporate it into your formula You could do the same with defense and armor.
  5. Erm for a formula thats sorta complicated as to how you want to balance. Heres a basic one. $damage = $attackerstrength - $defenderdefense; Thats a very basic one, you can throw in your own stuff. And yes its very easy, basically all you need to do before the loop is something like this. if($defenderagility > $attackeragility){ $whosturn = defender ; } else { $whosturn = attacker; }
  6. I can not for the life of me get my php to report any erros. Ive tried editing the .ini, and manually setting on run time. Here is a test script I whipped up to make it throw an error to see if it reports: <?php error_reporting(8191); echo "text" ?> Now it should obviously say compile error for the lack of a ;. But it dosnt. Any ideas why?
  7. Hey, I run a mafia game and code stuff like this every day. What I have done is have all variables(strength, stamina ect) in the database in the users table, then when theres a battle it calls it out, throws them into a formula, and then computes for damage. The formula youll have to do yourself to your own specifications. But then you can just loop through until one person is dead. For instance while($attackerhealth > 0 OR $defenderhealth > 0){ if($whosturn == attacker){ //some formula to get damage $whosturn = defender; $defenderhealth = $defenderhealth - $damage; if($defenderhealth <= 0){ $winner = attacker; } else { echo "You did $damage to $defender!"; } } else { //some formula to get damage $whosturn = attacker; $attackerhealth = $attackerhealth - $damage; if($attackerhealth <= 0){ $winner = defender; echo "$defender did $damage to you and killed you!"; } else { echo "$defender did $damage to you!"; } if($winner == attacker){ //some mysql query for winning } else { //some mysql query for defender } } } Or something like this. Youll have to work it to your specifications and bug test and whatnot, but thats the overall premise of it I think.
  8. The things that define the text area, meaning rows, cols, name ect.
  9. Either remove the "s that are in the text area definitions or put \s before them.
  10. Ah I figured it out myself. For future reference to anyone having this problem, I believe that natsort() Works for sorting naturally .
  11. Do you want an actual popup? Because you might need to use Javascript or Ajax for that.
  12. Hello everyone. I am aware of the sort() function, however its not doing what I want it to do. I have an array for cards, and need to sort them. For instance I have this array: array("1s","4d","13h","7d","8c"); The problem is that when it sorts it sees 13 lower than 1. Or it notices the 1 before anything so I get a sort like this 13h 1s 4d 7d 8c When I really need this 1s 4d 7d 8c 13h Any ideas how this could be achieved? Thanks
  13. Why not just use the PHP header("Location: ") function?
  14. Alas then they will just make their own forms, and strip out all the stuff that has to do with JS, and then redirect the form to go to my bank page. :(
  15. One of the users came forward and told me. Plus I keep bank logs. And Iam trying to avoid JS usage because it can be turned off/seen/edited/not on and I dont want the retards that turn it off for some reason to not be able to use it.
  16. My game is www.ny-mafia.com Bank is down atm. The problem I have encountered with sessions is that the sessions are shared between the browser windows. So if I set something as a variable on one, it is still in play on the other.
  17. Hey all. I run a PHP Game and have been wracking my brain as to how to fix the newest exploit on it. What the people are doing is opening 2 windows, going to the bank page and simultaneously pressing the Input button(or close to it) What happens is that the input goes so fast their money essentially doubles and clones. They wind up with 2x in the bank while only loosing what they put in. Any ideas as to how I could stop this?
×
×
  • Create New...

Important Information

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.