Absolute Zero Posted August 11, 2007 Share Posted August 11, 2007 Could someone show me how to add jail time in the "docrime.php" file? Heres what I got so far...Trying to learn php. Help would be much appreciated. <?php /*----------------------------------------------------- -- Mono Country v1.0 BETA -- A product of DBS-entertainment -- Copyright held 2005 by Dabomstew -- INDEX.php -----------------------------------------------------*/ session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); $_GET['c']=abs((int) $_GET['c']); if(!$_GET['c']) { print "Invalid crime"; } else { $q=mysql_query("SELECT * FROM crimes WHERE crimeID={$_GET['c']}",$c); $r=mysql_fetch_array($q); if($ir['brave'] < $r['crimeBRAVE']) { print "You do not have enough Brave to perform this crime."; } else { $ec="\$sucrate=".str_replace(array("LEVEL","EXP","WILL","IQ"), array($ir['level'], $ir['exp'], $ir['will'], $ir['IQ']),$r['crimePERCFORM']).";"; eval($ec); print $r['crimeITEXT']; $ir['brave']-=$r['crimeBRAVE']; mysql_query("UPDATE users SET brave={$ir['brave']} WHERE userid=$userid",$c); if(rand(1,100) <= $sucrate) { print str_replace("{money}",$r['crimeSUCCESSMUNY'],$r['crimeSTEXT']); $ir['money']+=$r['crimeSUCCESSMUNY']; $ir['exp']+=(int) ($r['crimeSUCCESSMUNY']/8); mysql_query("UPDATE users SET money={$ir['money']},exp={$ir['exp']} WHERE userid=$userid",$c); } else { print $r['crimeFTEXT']; } print " [url='docrime.php?c={$_GET[']Try Again[/url] [url='criminal.php']Crimes[/url]"; } } $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
Absolute Zero Posted August 12, 2007 Author Share Posted August 12, 2007 Re: Add Jail Time to Crimes! Thread can be closed. I took it upon myself to fix it unlike some people that always ask for help :P Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted October 25, 2008 Share Posted October 25, 2008 Re: Add Jail Time to Crimes! can you post this then please Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted October 25, 2008 Share Posted October 25, 2008 Re: Add Jail Time to Crimes! jail time is added in the staff panel. Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted October 25, 2008 Share Posted October 25, 2008 Re: Add Jail Time to Crimes! it isnt for v1 Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted October 27, 2008 Share Posted October 27, 2008 Re: Add Jail Time to Crimes! well this is what i got <?php /*----------------------------------------------------- -- Mono Country v1.0 BETA -- A product of DBS-entertainment -- Copyright held 2005 by Dabomstew -- INDEX.php -----------------------------------------------------*/ session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); $_GET['c']=abs((int) $_GET['c']); if(!$_GET['c']) { print "Invalid crime"; } else { $q=mysql_query("SELECT * FROM crimes WHERE crimeID={$_GET['c']}",$c); $r=mysql_fetch_array($q); if($ir['brave'] < $r['crimeBRAVE']) { print "You do not have enough Brave to perform this crime."; } else { $ec="\$sucrate=".str_replace(array("LEVEL","EXP","WILL","IQ"), array($ir['level'], $ir['exp'], $ir['will'], $ir['IQ']),$r['crimePERCFORM']).";"; eval($ec); print $r['crimeITEXT']; $ir['brave']-=$r['crimeBRAVE']; mysql_query("UPDATE users SET brave={$ir['brave']} WHERE userid=$userid",$c); if(rand(1,100) <= $sucrate) { print str_replace("{money}",$r['crimeSUCCESSMUNY'],$r['crimeSTEXT']); $ir['money']+=$r['crimeSUCCESSMUNY']; $ir['exp']+=(int) ($r['crimeSUCCESSMUNY']/8); mysql_query("UPDATE users SET money={$ir['money']},exp={$ir['exp']} WHERE userid=$userid",$c); } else { if(rand(1, 2) == 1) { print $r['crimeFTEXT']; } else { print $r['crimeJTEXT']; mysql_query("UPDATE `users` SET `jail` = '$r[crimeJAILTIME]', `jail_reason` = '$r[crimeJREASON]' WHERE `userid` = '$userid'",$c); } } print " [url='docrime.php?c={$_GET[']Try Again[/url] [url='criminal.php']Crimes[/url]"; } } $h->endpage(); ?> i will post all of this mod when it is fixed but this is correct i think Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted October 27, 2008 Share Posted October 27, 2008 Re: Add Jail Time to Crimes! from what i see....its in the Database Not in that page... mysql_query("UPDATE `users` SET `jail` = '$r[crimeJAILTIME]', `jail_reason` = '$r[crimeJREASON]' WHERE `userid` = '$userid'",$c); This is the part that is your jail Time... `jail` = '$r[crimeJAILTIME]' Now if you can do any type of coding you know this... That it is updating the uses jail time to whatever "$r[crimeJAILTIME]" is... Now look in your code and find that.... "$r[crimeJAILTIME]" $q=mysql_query("SELECT * FROM crimes WHERE crimeID={$_GET['c']}",$c); $r=mysql_fetch_array($q); tahts what $r is calling...SO its in your Database NOT this page.......Take what i ahve said and Learn from it..If you LOOK at the code you will find what your looking for...VERY simple. Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted October 28, 2008 Share Posted October 28, 2008 Re: Add Jail Time to Crimes! ok for some reason the docrime.php isnt putting anyone in jail Quote Link to comment Share on other sites More sharing options...
Michael Posted October 28, 2008 Share Posted October 28, 2008 Re: Add Jail Time to Crimes! All you gotta do for V1 is go to crimes table in the DB and add after crimefailtext, crimejail. Then in docrime.php find the place where it says blah blah blah {crimefailtext} add a query that will update a users jailtime to {crimejail} Thats not exactly right but if you have any coding knowledge at all you will be able to simply copy and paste to do it, i did mine in about 2 minutes. Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted October 31, 2008 Share Posted October 31, 2008 Re: Add Jail Time to Crimes! there is a lot more to it than that Quote Link to comment Share on other sites More sharing options...
Michael Posted October 31, 2008 Share Posted October 31, 2008 Re: Add Jail Time to Crimes! Well how come i did exactly what i just said ( well not exactly but the same steps ) and it works on my game ? And on all the games i have ever done it on ? Seriusly, that is a very basic, very easy thing to do, if you cant do it yourself maybe you should be a game PLAYER instead of a game CREATOR Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted October 31, 2008 Share Posted October 31, 2008 Re: Add Jail Time to Crimes! i have tryed this and dosnt work for me add you docrime here then i will try it to see if it is me Quote Link to comment Share on other sites More sharing options...
Michael Posted October 31, 2008 Share Posted October 31, 2008 Re: Add Jail Time to Crimes! I will add the bit that puts them in jail ok ? Quote Link to comment Share on other sites More sharing options...
Michael Posted October 31, 2008 Share Posted October 31, 2008 Re: Add Jail Time to Crimes! <code> if(rand(1,100) <= $sucrate) { print str_replace("{money}",$r['crimeSUCCESSMUNY'],$r['crimeSTEXT']); $ir['money']+=$r['crimeSUCCESSMUNY']; $ir['exp']+=(int) ($r['crimeSUCCESSMUNY']/8); mysql_query("UPDATE users SET crimes=crimes+1 WHERE userid={$ir['userid']}",$c); mysql_query("UPDATE users SET money={$ir['money']},exp={$ir['exp']} WHERE userid=$userid",$c); } else { print $r['crimeFTEXT']; $jailtime=(int) rand(10,30); mysql_query("UPDATE users SET jail=$jailtime WHERE userid=$userid", $c); mysql_query("UPDATE users SET jailreason='Failed a crime' WHERE userid=$userid", $c); } </code> Then all you gotta do is add : jailreason and jail to users table. make jailreason like name, and make jail like cash ie int11. Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted October 31, 2008 Share Posted October 31, 2008 Re: Add Jail Time to Crimes! should this code work as .co.cc is down so i cant see <?php /*----------------------------------------------------- -- Mono Country v1.0 BETA -- A product of DBS-entertainment -- Copyright held 2005 by Dabomstew -- docrime.php edited by Shaved92Bravada -----------------------------------------------------*/ session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); $_GET['c']=abs((int) $_GET['c']); if(!$_GET['c']) { print "Invalid crime"; } else { $q=mysql_query("SELECT * FROM crimes WHERE crimeID={$_GET['c']}",$c); $r=mysql_fetch_array($q); if($ir['brave'] < $r['crimeBRAVE']) { print "You do not have enough Brave to perform this crime."; } else { $ec="\$sucrate=".str_replace(array("LEVEL","EXP","WILL","IQ"), array($ir['level'], $ir['exp'], $ir['will'], $ir['IQ']),$r['crimePERCFORM']).";"; eval($ec); print $r['crimeITEXT']; $ir['brave']-=$r['crimeBRAVE']; mysql_query("UPDATE users SET brave={$ir['brave']} WHERE userid=$userid",$c); if(rand(1,100) <= $sucrate) { print str_replace("{money}",$r['crimeSUCCESSMUNY'],$r['crimeSTEXT']); $ir['money']+=$r['crimeSUCCESSMUNY']; $ir['exp']+=(int) ($r['crimeSUCCESSMUNY']/8); mysql_query("UPDATE users SET crimes=crimes+1 WHERE userid={$ir['userid']}",$c); mysql_query("UPDATE users SET money={$ir['money']},exp={$ir['exp']} WHERE userid=$userid",$c); } else { print $r['crimeFTEXT']; $jailtime=(int) rand(10,30); mysql_query("UPDATE users SET jail=$jailtime WHERE userid=$userid", $c); mysql_query("UPDATE users SET jailreason='Failed a crime' WHERE userid=$userid", $c); } } print " [url='docrime.php?c={$_GET[']Try Again[/url] [url='criminal.php']Crimes[/url]"; } } $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
Hash-Op Posted October 31, 2008 Share Posted October 31, 2008 Re: Add Jail Time to Crimes! Thread can be closed. I took it upon myself to fix it unlike some people that always ask for help :P Yeah keep talking about others... :x Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted October 31, 2008 Share Posted October 31, 2008 Re: Add Jail Time to Crimes! Thread can be closed. I took it upon myself to fix it unlike some people that always ask for help :P Please Dont Untill I Have Mine Fixed Please Quote Link to comment Share on other sites More sharing options...
Michael Posted October 31, 2008 Share Posted October 31, 2008 Re: Add Jail Time to Crimes! Yeah i think it should work, dont have time atm to check. Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted November 1, 2008 Share Posted November 1, 2008 Re: Add Jail Time to Crimes! ok it puts me in jail but no reason Quote Link to comment Share on other sites More sharing options...
Michael Posted November 1, 2008 Share Posted November 1, 2008 Re: Add Jail Time to Crimes! Do you have a jailreason in your users table in the DB ?? Seriusly mate this is simple shite.. Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted November 1, 2008 Share Posted November 1, 2008 Re: Add Jail Time to Crimes! seriously i done it my self sorry thanks though Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.