Jump to content
MakeWebGames

Issue with money/exp


Recommended Posts

I have no idea what is causing this issue, I was wondering if I could get some assitance from you guys.

Anyhow, once a crime is done the moment you refresh the page your exp goes back down to 0. Which is totally unfair and needs to be sorted.

Also peoples money keeps getting a negative - before the ammount.

I was wondering if there is a fix for this?

if you want to see what I mean visit

http://www.glorious-gangsters.co.uk

Please give me a hand,

thanks.

Link to comment
Share on other sites

_crimes.php

<?
$page_url = explode(".", $_SERVER['REQUEST_URI']);
$_SERVER['REQUEST_URI'] = $page_url[0].".php";

if($_SERVER['REQUEST_URI'] == "/_crimes.php"){
exit();
}

$crime_information = explode("-", $crimes);

if(isset($_POST['Commit'])){
if ($button_value == $_POST['userdigit']) {

$payout = rand($crime_min_payout[$_POST['crime']], $crime_max_payout[$_POST['crime']]);

if(empty($_POST['crime'])){
echo "You didn't select the type of crime you wish to do.";
}else{

if((time() <= $crime_information[6]) ) {
$ts=tstotime(($crime_information[6]-time()));
echo "You can do another crime in ".$ts['m']." Minutes And ".$ts['s']." Seconds";
}else{
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
if ($crime_information[($_POST['crime']-2)]<75 && $_POST['crime']>1) {
echo "You don't have enough experience to do this type of crime!";
} else {

if (in_array($_POST['crime'], array(1, 2, 3, 4, 5, 6))) {
if (rand(0, 100) <=$crime_information[($_POST['crime']-1)]) {
$suc="yes";
echo str_replace('{money}', $payout, $crime_success_text[$_POST['crime']]);
} else if (rand(1, 3)==1) {
$jail="yes";
echo "You failed to commit the crime and the cops caught you.";
} else {
echo "You failed to commit the crime.";
}
}



$crime_information[($_POST['crime']-1)] = $crime_information[($_POST['crime']-1)] + rand(1, 3);

if($crime_information[0] > 100 ){ $crime_information[0] = 100;}
if($crime_information[1] > 100 ){ $crime_information[1] = 100;}
if($crime_information[2] > 100 ){ $crime_information[2] = 100;}
if($crime_information[3] > 100 ){ $crime_information[3] = 100;}
if($crime_information[4] > 100 ){ $crime_information[4] = 100;}
if($crime_information[5] > 100 ){ $crime_information[5] = 100;}

$crime_information[6] = time()+$crime_time[$_POST['crime']];

$newrates = implode("-", $crime_information);

$rand_exp = rand($crime_min_exp[$_POST['crime']], $crime_max_exp[$_POST['crime']]);

if($suc == "yes"){

$result = mysql_query("UPDATE login SET crimes='".mysql_real_escape_string($newrates)."', exp=exp+'".mysql_real_escape_string($rand_exp)."', money=money+'".mysql_real_escape_string($payout)."' WHERE id='" .mysql_real_escape_string($_SESSION['user_id']). "'") 
or die(mysql_error());

}else{

if($jail == "yes"){ 

$result = mysql_query("UPDATE login SET crimes='".$newrates."', jail='".(time()+$crime_jail_time[$_POST['crime']])."-1' WHERE id='" .mysql_real_escape_string($_SESSION['user_id']). "'") 
or die(mysql_error());

}else{

$result = mysql_query("UPDATE login SET crimes='".$newrates."' WHERE id='" .mysql_real_escape_string($_SESSION['user_id']). "'") 
or die(mysql_error());
}// if in jail.
}// if no succes.
// new information.
$exp = $exp + $rand_exp;
$money = $money + $payout;
}// crime check.
}// if within timeout.
}// if empty post crime.
                } else {
echo $lang_no_verification;
}// else wrong activation code.

}// if post commit

// dissabling.

if($crime_information[0] < 75 ){$disabled_1 = "disabled='yes'";}
if($crime_information[1] < 75 ){$disabled_2 = "disabled='yes'";}
if($crime_information[2] < 75 ){$disabled_3 = "disabled='yes'";}
if($crime_information[3] < 75 ){$disabled_4 = "disabled='yes'";}
if($crime_information[4] < 75 ){$disabled_5 = "disabled='yes'";}

?>

 

crimes.php

<?php 

if(time() <= $crime_information[6]){
if(!$_POST['Commit']){            
echo "You can do another crime in:<br />".date( "00:i:s", $crime_information[6] - time() );
   }
           }else{      

echo '<form method="post">
<fieldset style="color: #000000; border: 1px solid #000000; width: 300px; text-align: left; padding: 5px;">
<legend style="color: #999999; font-weight: bold;">Crimes.</legend>
<input name="crime" type="radio" value="6" id="crime6"  '.$disabled_5.' onFocus="if(this.blur)this.blur()"/><label for="crime6" >'; 
if($crime_information[4] < 75){echo "<s>";} echo $crime_name[5]; if($crime_information[4] < 75){echo "</s>";} 
echo '</label>
<b>'.$crime_information[5].'% </b><br />
<input name="crime" type="radio" value="5" id="crime5"'.$disabled_4.' onFocus="if(this.blur)this.blur()"/>
<label for="crime5" >';
if($crime_information[3] < 75){echo "<s>";} echo $crime_name[4]; if($crime_information[3] < 75){echo "</s>";} 
echo '</label>
<b>'.$crime_information[4].'%</b><br />
<input name="crime" type="radio" value="4" id="crime4"  '.$disabled_3.' onFocus="if(this.blur)this.blur()"/><label for="crime4" >';
if($crime_information[2] < 75){echo "<s>";} echo $crime_name[3]; if($crime_information[2] < 75){echo "</s>";}
echo '</label>
<b>'.$crime_information[3].'%</b><br />
<input name="crime" type="radio" value="3" id="crime3"  '.$disabled_2.' onFocus="if(this.blur)this.blur()"/><label for="crime3" >';
if($crime_information[1] < 75){echo "<s>";} echo $crime_name[2]; if($crime_information[1] < 75){echo "</s>";} 
echo '</label>
<b> '.$crime_information[2].'% </b><br />
<input name="crime" type="radio" value="2" id="crime2" '.$disabled_1.' onFocus="if(this.blur)this.blur()"/><label for="crime2" >';
if($crime_information[0] < 75){echo "<s>";} echo $crime_name[1]; if($crime_information[0] < 75){echo "</s>";}
echo '</label>
<b> '.$crime_information[1].'%</b><br />
<input name="crime" type="radio" value="1" id="crime1" onFocus="if(this.blur)this.blur()"/><label for="crime1" > 
     '.$crime_name[0].'
     </label><b>'.$crime_information[0].'% </b>
   <table width="295" border="0" cellspacing="0">
     <tr>
       <td width="120" align="center"><img src="files/button.php" alt="Verification." width="120" height="30" /></td>
       <td width="100" align="center"><input name="userdigit" type="text" class="entryfield" style=\'width: 85%;\' size="5" maxlength="5"'.$disabled.'/></td>
       <td width="120" align="center"><input name="Commit" type="submit" class="button" value="Commit." onFocus="if(this.blur)this.blur()"/></td>
     </tr>
     <br>
     <a>Please be aware, more crimes will unlock as you level.</a>
   </table>

</fieldset>';
} 
echo '</form>';
?>

 

*DJK Note: [*CODE][*/CODE] tags please ( remove the asterisk ( * ) )

Edited by Djkanna
Link to comment
Share on other sites

It wont be in crimes if the EXP is been given but after they refresh it is gone. Have you looked in the header/globals/includes? make sure if you have made your own level up system that you have set it to only set 0 exp if they have reached a maximum amount needed for the lvl :)

Link to comment
Share on other sites

:)

 

It wont be in crimes if the EXP is been given but after they refresh it is gone. Have you looked in the header/globals/includes? make sure if you have made your own level up system that you have set it to only set 0 exp if they have reached a maximum amount needed for the lvl :)

What file should I look in?

Thanks!

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