Jump to content
MakeWebGames

Add Jail Time to Crimes!


Absolute Zero

Recommended Posts

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();
?>
Link to comment
Share on other sites

  • 1 year later...

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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();
?>
Link to comment
Share on other sites

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...