Jump to content
MakeWebGames

Recommended Posts

Posted

Ok I Converted Rehab Mod and it Kinda work but when i press Take drug Nothing Happens it dose to Next page but its blank.

rehab_cron.php

 

        <?php
   include "globals.php";
   if(!$c)
   {
   die("You have an unsecure connection or a failed connection. Please check your connection file and try again.
");
   }
   $q = mysql_query("SELECT * FROM `rehab`",$c);
   while($r=mysql_fetch_array($q))
   {
   $q2 = mysql_query("SELECT * FROM `users` WHERE `userid` = '{$r['user']}'",$c);
   $r2=mysql_fetch_array($q2);
   if($r2['hospital'] > 0 and $r2['rehab'] > 0)
   {
   mysql_query("DELETE FROM `rehab` WHERE `user` = '{$r2['userid']}'",$c);
   }
   }
   print mysql_affected_rows($c)." affected rows during this query.

   Made by $hot.";
   ?>

 

takedrug.php

 

     <?php
   session_start();
   include "globals.php";
   $_GET['ID'] = abs((int)($_GET['ID']));
   if(!$_GET['ID'])
   {
   print "What drug you taking..?";
   $h->endpage(); exit();
   } else if($ir['rehab'] > 0 or $ir['hospital'] > 0)
   {
   print "You cannot take drugs while in rehab or hospital.";
   $h->endpage(); exit();
   }
   $inv_id = $_GET['ID'];
   $q0 = mysql_query("SELECT * FROM inventory WHERE inv_id='$inv_id' AND inv_userid='{$userid}'",$c);
   if(mysql_num_rows($q0) == 0)
   {
   print "You have an invalid item there, please check next time. You may have visited a false link.";
   $h->endpage(); exit();
   }
   $r0=mysql_fetch_array($q0);
   $drug_item=$r0['inv_itemid'];
   $iqq=mysql_query("SELECT * FROM items WHERE itmid='{$drug_item}'",$c);
   $qr=mysql_fetch_array($iqq);
   if($qr['itmtype'] != 10)
   {
   print "That isn't a drug my friend.";
   $h->endpage(); exit();
   }
   $q = mysql_query("SELECT * FROM rehab WHERE user=$userid",$c);
   if(mysql_num_rows($q)> 6)
   {
   print "You have taken your limit of drugs.

   You can next take your drug in the next hour when it wears off.";
   $h->endpage(); exit();
   } else if(mysql_num_rows($q)== 6) {
   if($ir['daysold'] < 2) { $ir['daysold']=2; }
   $rand_percent = rand($ir['level'],$ir['level']*$ir['daysold']);
   if(rand(1,2) == 2)
   {
   //-- effect 1
   $level_what=rand(1,5);
   $rand=rand(1,3);
   if($rand == 1) { $data="level"; } else if($rand == 2) { $data="money"; } else { $data="crystals"; }
   mysql_query("UPDATE users SET `{$data}` = `{$data}` + '{$level_what}' WHERE userid='{$userid}'",$c);
   } else {
   //-- effect 2
   $hosp_time=(int)(rand(1,190));
   $hosp_reason="Sent to Rehab for Overdose of ".$qr['itmname'];
   mysql_query("UPDATE `users` SET `hospital` = `hospital` + '{$hosp_time}', `hospreason` = '{$hosp_reason}' WHERE userid='{$userid}'",$c);
   }
   print "You have taken your drug and have felt a wierd feeling.

   [url='inventory.php']Back to Items.[/url]
";
   if($r0['inv_qty'] > 1) {
   mysql_query("UPDATE inventory SET inv_qty=inv_qty-'1' WHERE inv_id='$inv_id' AND inv_userid='{$userid}' LIMIT 1;",$c);
   } else {
   mysql_query("DELETE FROM inventory WHERE inv_id='$inv_id' AND inv_userid='{$userid}' LIMIT 1;",$c);
   }
   mysql_query("INSERT INTO `rehab` VALUES ('$userid', '$drugitem');",$c);
   }
   $h->endpage();
   ?>

 

Screenshot After pressing Take Drug

untitled-4.jpg

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...