Jump to content
MakeWebGames

Jail Bust That Requires 5 brave


HITMAN 17
 Share

Recommended Posts

this is my jail bust please can someone add it requires 5 brave and takes 5 brave away

<?php
include "globals.php";
if($ir['energy'] < 10)
{
 die("Sorry, it costs 10 energy to bust someone. You only have {$ir['energy']} energy. Come back later.");
}
if($ir['jail'])
{
 die("You cannot bust out people while in jail.");
}
$_GET['ID']=abs((int) $_GET['ID']);
$r=$db->fetch_row($db->query("SELECT * FROM users WHERE userid={$_GET['ID']}"));
if(!$r['userid'])
{
 die("Invalid user");
}
if(!$r['jail'])
{
 die("That user is not in jail!");
}
$mult=$r['level']*$r['level'];
$chance=min(($ir['crimexp']/$mult)*50+1, 95);
if(rand(1,100) < $chance)
{
 $gain=$r['level']*5;
 print "You successfully busted {$r['username']} out of jail.

 > [url='jail.php']Back[/url]";
 $db->query("UPDATE users SET crimexp=crimexp+{$gain} WHERE userid=$userid");
 $db->query("UPDATE users SET jail=0 WHERE userid={$r['userid']}");
 $db->query("UPDATE users SET busts=busts+1 WHERE userid=$userid");
 event_add($r['userid'], "[url='viewuser.php?u={$ir[']{$ir['username']}[/url] busted you out of jail.", $c);
}
else
{
 print "While trying to bust out your friend, a guard spotted you and dragged you into jail yourself. Unlucky!

 > [url='jail.php']Back[/url]";
 $time=min($mult, 20);
 $db->query("UPDATE users SET jail=$time, jail_reason='Caught trying to bust out {$r['username']}' WHERE userid=$userid");
 event_add($r['userid'], "[url='viewuser.php?u={$ir[']{$ir['username']}[/url] was caught trying to bust you out of jail.", $c);
}
$h->endpage();
?>
Link to comment
Share on other sites

Re: Jail Bust That Requires 5 brave

Am pretty sure you need to look at this bit of script:

 

if($ir['energy'] < 10)
{
 die("Sorry, it costs 10 energy to bust someone. You only have {$ir['energy']} energy. Come back later.");
}

 

Have a look at some of your crime scripts and get the info you need

Link to comment
Share on other sites

Re: Jail Bust That Requires 5 brave

 

<?php

/*-------------------
-- Free Jail Bust
-- By AlabamaHit
-------------------*/

require ("globals.php");

if($ir['brave'] < 5)
{
	echo "Sorry, it cost 5 Brave to Bust someone. All You have is ".$ir['brave']." brave.


	[url='index.php']> Go Home[/url]";
	$h->endpage();
	exit;
}

if($ir['jail'])
{
	echo "You cannot bust out people while in jail.


	[url='index.php']> Go Home[/url]";
	$h->endpage();
	exit;
}

if($ir['hospital'])
{
	echo "You cannot bust out people while in the hosptial.


	[url='index.php']> Go Home[/url]";
	$h->endpage();
	exit;
}

$_GET['ID']=abs((int) $_GET['ID']);

$getinfo = sprintf("SELECT * FROM users WHERE userid = '%u' ",
($_GET['ID']));
	$doinfo = mysql_query($getinfo);
		$r = mysql_fetch_array($doinfo);

if(!$r['userid'])
{
	echo "There is no user with this ID.


	[url='index.php']> Go Home[/url]";
	$h->endpage();
	exit;
}

if(!$r['jail'])
{
	echo "That user is not in jail.


	[url='index.php']> Go Home[/url]";
	$h->endpage();
	exit;
}

$mult = $r['level'] * $r['level'];
$chance = min(($ir['crimexp']/$mult) * 50 + 1, 95);
if(rand(1,100) < $chance)
{
	$gain = $r['level'] * 5;
	echo "Congradulations you busted ".$r['username']." out of jail.


	[url='jail.php']> Go Back[/url]";

$update = sprintf("UPDATE users SET brave = brave - '%d', crimexp = crimexp + '%u', busts = busts + '%d' WHERE userid = '%u' ",
(5),
($gain),
(1),
($userid));
	mysql_query($update);

$getout = sprintf("UPDATE users SET jail = '%d' WHERE userid = '%u' ",
(0),
($r['userid']));
	mysql_query($getout);

event_add($r['userid'], "[url='viewuser.php?u=".$ir[']".$ir['username']."[/url] busted you out of jail.", $c);
}
else
{
echo "Opps....You got caught while trying to bust someone out of jail....So, they place you in there to.


[url='jail.php']> Go to Jail[/url]";

$time = min($mult, 20);
$reason = "Caught trying to bust out ".$r['username']."";

$update = sprintf("UPDATE users SET brave = brave - '%d', jail = '%u', jail_reason = '%s' WHERE userid = '%u' ",
(5),
($time),
($reason),
($userid));
	mysql_query($update);

event_add($r['userid'], "[url='viewuser.php?u=".$ir[']".$ir['username']."[/url] was caught trying to bust you out of jail.", $c);
}
$h->endpage();
?>
Link to comment
Share on other sites

  • 1 year later...

Curious

 

$mult = $r['level'] * $r['level'];
$chance = min(($ir['crimexp']/$mult) * 50 + 1, 95);
if(rand(1,100) < $chance)
{
	$gain = $r['level'] * 5;

 

I'm curious as to how other game owners have adjusted these formulas for easier or harder busts. Is there another way to do this? Any Ideas, suggestions, input, would be greatly appreciated.

Thanks

Link to comment
Share on other sites

$mult = $r['level'] * $r['level'];

$chance = min(($ir['crimexp']/$mult) * 50 + 1, 95);

if(rand(1,100) < $chance)

{

$gain = $r['level'] * 5;

Basically,

My Level: 2

Crime Exp: 50

So,

$mult = 2 * 2; //4

$chance = min((50/4) * 50 + 1, 95); //~626

So, if the random generated number is below ~626 they succeed (The random generated number would be between 1 and 100)

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.

 Share

×
×
  • Create New...