Jump to content
MakeWebGames

Recommended Posts

Posted

Hey, im in need of some help regarding the "criminal.php" file for mccodes V2..

I have made a row called "Nojail" in the "users" table in my database..

What im basically trying to do is to let me turn off the jail for like 24 hours and then it will get turned on again..

I have already made the file that does so when i turn on "No Jail for 24 hours" the row called "Nojail" is set to 1440.. 1440 is for minutes..

But the thing i need help with is to do so when the user has more than 0 in the row called "Nojail" they will not get jailed when doing crimes..

Ive tried adding different things to my "docrime.php" file, but no luck so far.. Thats why im coming here for help now..

My "docrime.php" file looks like this:

 

<?php

$macropage="docrime.php?c={$_GET['c']}";
   include_once "globals.php";
if($ir['jail'] or $ir['hospital']) { die("This page cannot be accessed while in jail or hospital."); }
$_GET['c']=abs((int) $_GET['c']);
if(!$_GET['c'])
{
echo "Invalid crime";
}
else
{
$q=mysql_query("SELECT * FROM crimes WHERE crimeID={$_GET['c']}",$c);
$r=mysql_fetch_array($q);
if($ir['brave'] < $r['crimeBRAVE'])
{
echo "You do not have enough Brave to perform this crime.";
}
else
{
$ec="\$sucrate=".str_replace(array("LEVEL","CRIMEXP","EXP","WILL","IQ"), array($ir['level'], $ir['crimexp'], $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['crystals']+=$r['crimeSUCCESSCRYS'];
$ir['exp']+=($r['crimeXP']);
mysql_query("UPDATE users SET money={$ir['money']}, crystals={$ir['crystals']}, exp={$ir['exp']},crimexp=crimexp+{$r['crimeXP']} WHERE userid=$userid",$c);
if($r['crimeSUCCESSITEM'])
{
 item_add($userid, $r['crimeSUCCESSITEM'], 1);
}
}
else
{
if(rand(1, 2) == 1)
{
print $r['crimeFTEXT'];
}
else
{
 print $r['crimeJTEXT'];
 $db->query("UPDATE `users` SET `jail` = '$r[crimeJAILTIME]', `jail_reason` = '$r[crimeJREASON]' WHERE `userid` = '$userid'");
}
}

echo "<br /><a href='docrime.php?c={$_GET['c']}'>Try Again</a><br />
<a href='criminal.php'>Crimes</a>";
}
}


$h->endpage();
?>
Posted

Hmmm. A solution would be: (I say 'a solution' because there is likely to be a more optimum one lol)

Create a table, "nojail" for example. Now..

For all users:

In the userid field, if 0 this would apply to all users. The next field would have a timestamp that you'd set from staff panel or whatever, which your query would effectively be time() + INPUT_TIME (in seconds.

For individuals:

Same basic theory. If userid is not 0, it applies to an individual. It would be set from the page they buy it, time() + TIME_BOUGHT (in secs)

Posted (edited)

Add an IF statement and add it above the query which is INSERT-ing the time...

if($r['Nojail'] < 1440)

{

$db->query("UPDATE `users` SET `jail` = '$r[crimeJAILTIME]', `jail_reason` = '$r[crimeJREASON]' WHERE `userid` = '$userid'");

}

Edited by lucky3809

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