Hey all.
Well I got bored and fancied coding something or atleast updating something for free =)
About this mod:
A few month's ago ''Ishmell'' made this, However he did alot of things wrong and well the mod was good but it did suck, So I decided I'd recode it to what I want it and change a few things and add a few things. Make things more interesting ;). It's not the best but it's free, And if you ask me It's pretty good :D & It don't use die(); so you're footer will show :D
All the code should run pretty fast, However I'm not speed optimizer so I could off used some slow functions.
What I've done;
Its now one big file
Each picture is totally random outcome
Now users can go to jail & hospital
It now will say the actual city name (You got arrested for being at New York)
Updated alot of the code
Changed a few queries :D
Thanks Too;
Magictallguy - Helped me figure out I'd defined $hb instead off $db - LOL
Ishmell - For Creating the modification :D
[align=center]This is a tested modification and it's working without any issue's
[align=left]Run this query;
[/align][align=left][mysql]ALTER TABLE `users` ADD `turns` INT( 11 ) NOT NULL DEFAULT '25';
[/mysql]
Add in cron_day.php;
[mysql]$db->query("UPDATE users SET turns=25");
[/mysql]
[/align][align=left]
<?php
/*-----------------------------------------------------
- MCCodes V2 || Streets
- Revamped by Jordan ('Pudda')
- Freebie :D
-----------------------------------------------------*/
$noturns="Sorry you dont see to have any walks left today. Come back tomorrow";
include(DIRNAME(__FILE__) . '/globals.php');
if($ir['turns'] <= 0)
{
echo $noturns;
$h->endpage();
exit;
}
$_GET['act'] = isset($_GET['act']) && is_string($_GET['act']) ? trim($_GET['act']) : "";
switch($_GET['act'])
{
case 'search': search_streets(); break;
default: index(); break;
}
function index()
{
global $db,$ir,$userid,$h;
$LOC1 = mysql_query("SELECT cityid, cityname FROM cities WHERE cityid = ".$ir['location']) or die(mysql_error());
$LOC = mysql_fetch_assoc($LOC1);
$Type=mt_rand('1', '8');
echo "<h2><center>".$LOC['cityname']." Streets</center></h2>";
Print "[img=http://i42.tinypic.com/2h6cd41.jpg]
<map name='Map'>
<area shape='rect' coords='205,274,270,339' href='?act=search&search=".$Type."'>
<area shape='rect' coords='273,3,338,68' href='?act=search&search=".$Type."'>
<area shape='rect' coords='138,138,203,203' href='?act=search&search=".$Type."'>
<area shape='rect' coords='274,138,339,203' href='?act=search&search=".$Type."'>
<area shape='rect' coords='204,137,269,202' href='?act=search&search=".$Type."'>
<area shape='rect' coords='2,138,67,203' href='?act=search&search=".$Type."'>
<area shape='rect' coords='3,69,68,134' href='?act=search&search=".$Type."'>
<area shape='rect' coords='273,207,338,272' href='?act=search&search=".$Type."'>
<area shape='rect' coords='275,70,340,135' href='?act=search&search=".$Type."'>
<area shape='rect' coords='205,70,270,135' href='?act=search&search=".$Type."'>
<area shape='rect' coords='2,274,67,339' href='?act=search&search=".$Type."'>
<area shape='rect' coords='69,274,134,339' href='?act=search&search=".$Type."'>
<area shape='rect' coords='340,342,405,407' href='?act=search&search=".$Type."'>
<area shape='rect' coords='341,409,406,474' href='?act=search&search=".$Type."'>
<area shape='rect' coords='273,410,338,475' href='?act=search&search=".$Type."'>
<area shape='rect' coords='206,410,271,475' href='?act=search&search=".$Type."'>
<area shape='rect' coords='138,410,203,475'href='?act=search&search=".$Type."'>
<area shape='rect' coords='70,408,135,473' href='?act=search&search=".$Type."'>
<area shape='rect' coords='3,407,68,472' href='?act=search&search=".$Type."'>
<area shape='rect' coords='3,341,68,406' href='?act=search&search=".$Type."'>
<area shape='rect' coords='138,342,203,407' href='?act=search&search=".$Type."'><area shape='rect' coords='68,341,133,406' href='?act=search&search=".$Type."'>
<area shape='rect' coords='206,342,271,407' href='?act=search&search=".$Type."'><area shape='rect' coords='274,342,339,407' href='?act=search&search=".$Type."'>
<area shape='rect' coords='272,272,337,337' href='?act=search&search=".$Type."'>
</map>
</center>";
}
function search_streets()
{
global $db,$ir,$userid,$h;
$LOC1 = mysql_query("SELECT cityid, cityname FROM cities WHERE cityid = ".$ir['location']) or die(mysql_error());
$LOC = mysql_fetch_assoc($LOC1);
/*-----------------------------------------------------
# Start Config #
-----------------------------------------------------*/
$nonrecorded="What you doing here?
[url='index.php']Go back[/url]";
$rand= rand(0,2);
$randhard= rand(0,3);
$randmoney= rand(1,100);
$randcrystals= rand(1,8);
$itemidsearch2= 39; //Item id for search 2
$quantitysearch2= 1; //Item quantity for search 2
$itemidsearch4= 36; //Item id for search 4
$quantitysearch4= 1; //Item quantity for search 4
$itemidsearch5= 37; //Item id for search 5
$quantitysearch5= 1; //Item quantity for search 5
$itemidsearch7= 38; //Item id for search 7
$quantitysearch7= 1; //Item quantity for search 7
$itemidsearch8= 36; //Item id for search 8
$quantitysearch8= 1; //Item quantity for search 8
/*-----------------------------------------------------
# End Config #
-----------------------------------------------------*/
$_GET['search'] ===abs(@intval($_GET['search']));
if(!$_GET['search'])
{
echo $nonrecorded;
$h->endpage();
exit;
}
else if($_GET['search'] == '1')
{
$db->query("UPDATE `users` SET `turns`=`turns`-1 WHERE `userid`=$userid") or die(mysql_error());
if ($rand == '1')
{
$db->query("UPDATE `users` SET `money`=`money`+".$randmoney." WHERE `userid`=$userid") or die(mysql_error());
echo "<font color='green'>[b]Sucess[/b]</font>
You found ".money_formatter($randmoney)." After searching an random box";
}
else
{
echo "<font color='red>[b]Unlucky![/b]</font>
While searching ".$LOC['cityname']." You didnt come across anything useful
";
}
$h->endpage();
exit;
}
else if($_GET['search'] == '2')
{
$db->query("UPDATE `users` SET `turns`=`turns`-1 WHERE `userid`=$userid") or die(mysql_error());
if ($rand == '1')
{
$db->query("INSERT INTO `inventory` VALUES('',$itemidsearch2,$userid,$quantitysearch2)") or die(mysql_error());
echo "<font color='green'>[b]Success[/b]</font>
While searching ".$LOC['cityname']." You found an mysterious item. Go to your inventory to find out what";
}
else
{
$Time = mt_rand('20', '100');
echo "<font color='red>[b]Unlucky![/b]</font>
While searching ".$LOC['cityname']." a police officer arrested you.";
$db->query(sprintf("UPDATE `users` SET `jail`='%u', `jail_reason`='Arrested for hanging around %s' WHERE `userid`='%u'", $Time, $LOC['cityname'], $userid)) or die(mysql_error());
}
$h->endpage();
exit;
}
else if($_GET['search'] == '3')
{
$db->query("UPDATE `users` SET `turns`=`turns`-1 WHERE `userid`=$userid") or die(mysql_error());
if ($rand == '1')
{
$db->query("UPDATE `users` SET `money`=`money`+".$randmoney." WHERE `userid`=$userid") or die(mysql_error());
echo "<font color='green'>[b]Sucess[/b]</font>
You found ".money_formatter($randmoney)." After robbing an random old man";
}
else
{
$Time = mt_rand('20', '100');
echo "<font color='red>[b]Unlucky![/b]</font>
While searching ".$LOC['cityname']." you got shot.";
$db->query(sprintf("UPDATE `users` SET `hospital`='%u', `hospreason`='While searching %s they got shot' WHERE `userid`='%u'", $Time, $LOC['cityname'], $userid)) or die(mysql_error());
}
$h->endpage();
exit;
}
else if($_GET['search'] == '4')
{
$db->query("UPDATE `users` SET `turns`=`turns`-1 WHERE `userid`=$userid") or die(mysql_error());
if ($randhard == '1')
{
$db->query("INSERT INTO inventory VALUES('',$itemidsearch4,$userid,$quantitysearch4)");
echo "<font color='green'>[b]Success[/b]</font>
While searching ".$LOC['cityname']." You found an mysterious item. Go to your inventory to find out what";
}
else
{
echo "<font color='red>[b]Unlucky![/b]</font>
While searching ".$LOC['cityname']." you found NOTHING!";
}
$h->endpage();
exit;
}
else if($_GET['search'] == '5')
{
$db->query("UPDATE `users` SET `turns`=`turns`-1 WHERE `userid`=$userid") or die(mysql_error());
$db->query("INSERT INTO inventory VALUES('',$itemidsearch5,$userid,$quantitysearch5)");
echo "<font color='green'>[b]Success[/b]</font>
While searching ".$LOC['cityname']." You found an mysterious item. Go to your inventory to find out what";
$h->endpage();
exit;
}
else if($_GET['search'] == '6')
{
$db->query("UPDATE `users` SET `turns`=`turns`-1 WHERE `userid`=$userid") or die(mysql_error());
if ($rand == '1')
{
$db->query("UPDATE users SET `crystals`=`crystals`+".$randcrystals." WHERE userid=$userid");
echo "<font color='green'>[b]Success[/b]</font>
While searching ".$LOC['cityname']." You fell down a hole and found ".number_format($randcrystals)."";
}
else
{
$Time = mt_rand('20', '100');
echo "<font color='red>[b]Unlucky![/b]</font>
While searching ".$LOC['cityname']." a police officer arrested you.";
$db->query(sprintf("UPDATE `users` SET `jail`='%u', `jail_reason`='Arrested for hanging around %s' WHERE `userid`='%u'", $Time, $LOC['cityname'], $userid)) or die(mysql_error());
}
$h->endpage();
exit;
}
else if($_GET['search'] == '7')
{
$db->query("UPDATE `users` SET `turns`=`turns`-1 WHERE `userid`=$userid") or die(mysql_error());
if ($rand == '1')
{
$db->query("INSERT INTO inventory VALUES('',$itemidsearch7,$userid,$quantitysearch7)");
echo "<font color='green'>[b]Success[/b]</font>
While searching ".$LOC['cityname']." You found an mysterious item. Go to your inventory to find out what";
}
else
{
$Time = mt_rand('20', '100');
echo "<font color='red>[b]Unlucky![/b]</font>
While searching ".$LOC['cityname']." a police officer arrested you.";
$db->query(sprintf("UPDATE `users` SET `jail`='%u', `jail_reason`='Arrested for hanging around %s' WHERE `userid`='%u'", $Time, $LOC['cityname'], $userid)) or die(mysql_error());
}
$h->endpage();
exit;
}
else if($_GET['search'] == '8')
{
$db->query("UPDATE `users` SET `turns`=`turns`-1 WHERE `userid`=$userid") or die(mysql_error());
if ($randhard == '1')
{
$db->query("INSERT INTO inventory VALUES('',$itemidsearch8,$userid,$quantitysearch8)");
echo "<font color='green'>[b]Success[/b]</font>
While searching ".$LOC['cityname']." You found an mysterious item. Go to your inventory to find out what";
}
else
{
$Time = mt_rand('20', '100');
echo "<font color='red>[b]Unlucky![/b]</font>
While searching ".$LOC['cityname']." a police officer arrested you.";
$db->query(sprintf("UPDATE `users` SET `jail`='%u', `jail_reason`='Arrested for hanging around %s' WHERE `userid`='%u'", $Time, $LOC['cityname'], $userid)) or die(mysql_error());
}
$h->endpage();
exit;
}
}
$h->endpage();
?>
[/align][/align]