Public paste
Undefined
By: test | Date: Jan 19 2009 18:55 | Format: PHP | Expires: never | Size: 2.77 KB | Hits: 732

  1. <?php
  2.  
  3.  
  4. $sql = mysql_query("SELECT `wapen` FROM `uitrust` WHERE `id`=".ID) or die(mysql_error());
  5. $res = mysql_fetch_assoc($sql);
  6.  
  7. $wapen = $res['wapen'];
  8.  
  9. $wpns = array(
  10.  
  11.     "Mes", "Desert Eagle", "Aka-Beta", "Thompson", "Colt MX 17", "Shotgun", "M-16", "RPG-7"
  12. );
  13.  
  14.  
  15. $time_hoeren = mysql_query("SELECT `wapenervaring` FROM `usertimes` WHERE `id` =".ID." LIMIT 1") or die(mysql_error());
  16. $timeho = mysql_fetch_assoc($time_hoeren);
  17. $tho = $timeho['wapenervaring'];
  18.  
  19.  
  20. $sql = mysql_query("SELECT wapenervaring, wapentraining FROM userstats WHERE id = ".ID." LIMIT 1") or die(mysql_error());
  21. $res = mysql_fetch_assoc($sql);
  22. $w_erv = $res['wapenervaring'];
  23. $w_train = $res['wapentraining'];
  24.  
  25. if(isset($_POST['trainen'])){
  26.        
  27.         if($w_train >= 100){
  28.                 $msg = "Je hebt al 100% wapentraining!";
  29.                 $msg = bad($msg);
  30.         } elseif($tho > time()){
  31.                 $msg = "Je moet nog <b>".($tho - time())."</b> seconden wachten voordat je weer wapentraining kan doen!";
  32.                 $msg = bad($msg);
  33.         } else {
  34.                 $w_percentage = rand(2, 5);
  35.                 $w_train = $w_train + $w_percentage;
  36.                 $msg = "Je hebt <b>" .$w_percentage. "%</b> wapentraining erbij gekregen!";
  37.                 $msg = good($msg);
  38.                 if($w_train > 100){
  39.                         $w_train = 100;
  40.                 }
  41.  
  42.                 mysql_query("UPDATE `userstats` SET `wapentraining`=".$w_train." WHERE `id`=".ID." LIMIT 1") or die(mysql_error());
  43.                
  44.                 // Update de tijd
  45.                 $nieuwetijd = time() + 300;
  46.                 mysql_query("UPDATE `usertimes` SET `wapenervaring`=".$nieuwetijd." WHERE `id`=".ID." LIMIT 1") or die(mysql_error());
  47.                
  48.         }
  49.  
  50. }
  51.        
  52. ?>
  53.  
  54. <table border='0' cellspacing='1' width='96%' bgcolor='#000' align='center'>
  55. <tr><td class='top'>Wapen Ervaring Trainen</td></tr><tr>
  56. <td width='100%' class='container'>
  57.  
  58. <?php  
  59.         if (isset($msg)){
  60.         echo "<center>".$msg. "</center><br><br>";
  61. }
  62. ?>Hier kun je, je wapen ervaring trainen <b>(wapen training)</b> zodat je betere wapens kunt gaan dragen.Je <b>wapen ervaring </b>gaat omhoog door personen aan te vallen met je wapen! Let op! Pas als je beide op 100% hebt schiet je als beste.<br /><br />                         
  63. <table border='0' cellspacing='1' width='90%' bgcolor='#000' align='center'>
  64.  
  65. <tr><td class='subtop' colspan='3'>Status</td></tr>
  66. <tr><td class='inhoud_c' rowspan='3' style='width: 110px;'><img src='images/attack.jpg' alt='' /></td>
  67. <td class='inhoud' style='width: 200px;'><b>Huidige wapen:</b></td>
  68. <td class='inhoud'><?=$wpns[$wapen];?></td></tr>
  69.  
  70. <tr><td class='inhoud' style='width: 200px;'><b>Wapen ervaring:</b></td><td class='inhoud'><?php echo createBalk($w_erv); ?></td></tr>
  71. <td class='inhoud' style='width: 200px;'><b>Wapen trainen:</b></td><td class='inhoud'><?php echo createBalk($w_train); ?></td></tr></table>
  72.  
  73. <br><form method="post" action="game.php?pagina=wapenervaring"><input type="submit" name="trainen" value="Trainen"><br></td></tr></table>