Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length


News:

Have you purchased a mod and lost your copy? Just file a support ticket through your "My Mods" page.


AuthorTopic: [MCV2] Updated Streets  (Read 564 times)

Jordan

  • Active Member
  • **
  • Reputation Power: 55
  • Jordan has no influence.
  • Offline Offline
  • Posts: 103
  • Website Developer for hire;
    • MSN Messenger - Pudda2008@hotmail.co.uk
    • View Profile
    • WWW
    • Email
[MCV2] Updated Streets
« on: February 13, 2010, 12:37:20 PM »
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;

   1. Its now one big file
   2. Each picture is totally random outcome
   3. Now users can go to jail & hospital
   4. It now will say the actual city name (You got arrested for being at New York)
   5. Updated alot of the code
   6. 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

This is a tested modification and it's working without any issue's

Run this query;
Code: [Select]
ALTER TABLE `users` ADD `turns` INT( 11 ) NOT NULL DEFAULT '25';

Add in cron_day.php;
Code: [Select]
$db->query("UPDATE users SET turns=25");


Code: [Select]
<?php
/*-----------------------------------------------------
- MCCodes V2 || Streets
- Revamped by Jordan ('Pudda')
- Freebie :D - Makwebgames.com
-----------------------------------------------------*/
$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 src='http://i42.tinypic.com/2h6cd41.jpg' border='0' usemap='#Map'>
<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?<br /><a href='index.php'>Go back</a>";
$randrand(0,2);
$randhardrand(0,3);
$randmoneyrand(1,100);
$randcrystalsrand(1,8);
$itemidsearch239//Item id for search 2
$quantitysearch21//Item quantity for search 2
$itemidsearch436//Item id for search 4
$quantitysearch41//Item quantity for search 4
$itemidsearch537//Item id for search 5
$quantitysearch51//Item quantity for search 5
$itemidsearch738//Item id for search 7
$quantitysearch71//Item quantity for search 7
$itemidsearch836//Item id for search 8
$quantitysearch81//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><br />You found ".money_formatter($randmoney)." After searching an random box";
}
else
{
echo 
"<font color='red><b>Unlucky!</b></font><br />While searching ".$LOC['cityname']." You didnt come across anything useful<br />";
}
$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><br />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><br />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><br />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><br />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><br />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><br />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><br />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><br />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><br />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><br />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><br />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><br />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><br />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();
?>
Logged

Pudda2008@hotmail.co.uk - Feel free to add me on MSN

05timbyd

  • Basic Member
  • *
  • Reputation Power: 3
  • 05timbyd has no influence.
  • Offline Offline
  • Posts: 7
    • View Profile
    • Email
Re: [MCV2] Updated Streets
« Reply #1 on: March 07, 2010, 05:39:33 PM »
Nice 1 mate ;)

&&

Thanks for the share :D
Logged

Jordan

  • Active Member
  • **
  • Reputation Power: 55
  • Jordan has no influence.
  • Offline Offline
  • Posts: 103
  • Website Developer for hire;
    • MSN Messenger - Pudda2008@hotmail.co.uk
    • View Profile
    • WWW
    • Email
Re: [MCV2] Updated Streets
« Reply #2 on: March 10, 2010, 10:44:56 AM »
npz
Logged

Pudda2008@hotmail.co.uk - Feel free to add me on MSN

Danny696

  • Excellent Member
  • ***
  • Reputation Power: 276
  • Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.
  • Offline Offline
  • Posts: 457
    • View Profile
Re: [MCV2] Updated Streets
« Reply #3 on: March 10, 2010, 11:08:16 AM »
$noturns="Sorry you dont see to have any walks left today. Come back tomorrow";  Sorry, but to use it once, may aswell just echo it
Logged
My Game: GraveYard; Madness || Projects; N/A -  Available for work. Please IM/PM me.

Jordan

  • Active Member
  • **
  • Reputation Power: 55
  • Jordan has no influence.
  • Offline Offline
  • Posts: 103
  • Website Developer for hire;
    • MSN Messenger - Pudda2008@hotmail.co.uk
    • View Profile
    • WWW
    • Email
Re: [MCV2] Updated Streets
« Reply #4 on: March 10, 2010, 11:38:20 AM »
I know, I had bigger plans for it but I ended up getting busy with stuff
Logged

Pudda2008@hotmail.co.uk - Feel free to add me on MSN