Jump to content
MakeWebGames

Simple Free mod to start off---Would anyone use?


Joshua

Recommended Posts

So i'm thinking about making a Christmas Mod for users to Open Presents from Santa.

Users will receive items, money, crystals, or a Random chance to receive rare items you have in your game.

Will only be able to open on a set date.

Anyone use this?

If so i'll get it done and post it up

Link to comment
Share on other sites

Ah hell he did didnt he ><

Oh well, i just spent 2 hours making this po-dunk one so I'm gonna post it :p

This basically gives users 5 presants to open. They can only open Each present one time.

2 of them give random money/points but have a slim chance they can go to jail or hospital.

the other 3 give random items from your inventory

Hope someone uses this >,<

 

ALTER TABLE users ADD xmas tinyint(4) default '0';

Make file called

xmas.php

<?php
include_once (DIRNAME(__FILE__) . '/globals.php');


if($ir['xmas'] > 4)
{
echo "You have already opened your presents from Santa";
       $h->endpage();
}
echo "<h4>Merry Christmas, Open your presents from Santa.</h4>";




switch($_GET['option'])
{


  case 'xmas_1':
  xmas_1();
  break;

  case 'xmas_2':
  xmas_2();
  break;

  case 'xmas_3':
  xmas_3();
  break;

  case 'xmas_4':
  xmas_4();
  break;

  case 'xmas_5':
  xmas_5();
  break; 

  default:
  index();
  break;
}

function index()
{
  global $ir;
  echo sprintf("

Merry Christmas %s Santa has left you 5 presents to open under your christmas tree.</p>", htmlspecialchars($ir['username']));;
  echo "[url='?option=xmas_1']First Present[/url]
";
 echo "[url='?option=xmas_2']Second Present[/url]
";
  echo "[url='?option=xmas_3']Third Present[/url]
";
  echo "[url='?option=xmas_4']Fourth Present[/url]
";
echo "[url='?option=xmas_5']Last Present[/url]
";

}
function xmas_1()
{
  global $db, $ir, $userid, $h;
if($ir['xmas'] !=0)
{
echo "Sorry, you have already opened this present from santa.";
$h->endpage();
}


$cr=rand(1,10);
if($cr == 2)
{
     echo "Santa gave you just what you always wanted!  An elite computer for your household.  Unfortunately when you plug it in, the computer short circuits and gives you one heck of a jolt! 

The ambulance is called and you must spend some time in the hospital";
$db->query(sprintf("UPDATE users SET hp = %d, hospital =%d, hospreason = '%s', xmas=%d WHERE (userid=%u)",1,5,'Electricuted from faulty merchandise',1,$ir['userid']));
$h->endpage();
exit;
}
else
{
$xm=$db->query("SELECT * FROM items WHERE itmbuyable=1 ORDER BY rand() LIMIT 1");
$r=$db->fetch_row($xm);
$xmasitem=$r['itmid'];
$name=$r['itmname'];
$userid=$ir['userid'];
echo "Merry Xmas, You have received a $name from Santa Claus[url='xmas.php']Back to Christmas Tree[/url]";
$db->query(sprintf("INSERT INTO inventory VALUES ('', %u, %u, %d)",$xmasitem,$userid,1));
$db->query(sprintf("UPDATE users SET xmas=%d WHERE userid=%u",1,$ir['userid']));

}
}

function xmas_2()
{
 global $db, $ir, $userid,$h;
if($ir['xmas'] !=1)
{
echo "You must open your presents in order! You missed the first one!";
$h->endpage();
exit;
}

$jail=rand(1,10);
if($jail=7)// If Random Number is 7--User is Jailed
{
echo "After opening your 2nd package from Santa you are interrupted by a Knock on the front door.  As you approach the front door you are taken back when the it is kicked in and agents swarm your house. 

Turns out the presents Santa gave you were hot merchandise and you have to pay the time.  You're hauled off to jail.";
$db->query(sprintf("UPDATE users SET jail = %u, jail_reason = '%s', xmas=%d WHERE (userid=%u)",5,'Holding stolen merchandise',2,$ir['userid']));
$h->endpage();
exit;
}

else
{
$money = mt_rand(100, 1000);
  $crystals = mt_rand(10, 50); 
  echo sprintf("Instead of gifts this year you find %u money %u crystals in a small envelope.  Merry Xmas!", "\$". number_format($money), number_format($crystals));
  $db->query(sprintf("UPDATE users SET money = money + %u, crystals = crystals + %u, xmas = %d WHERE userid = %d", $money, $crystals, 2, $userid));

}
}

function xmas_3()
{
global $db, $ir, $userid, $h;



if($ir['xmas'] !=2)
{
echo "You must open your presents in order.  You missed the first 2!";
$h->endpage();
exit;
}
else
{
$xm=$db->query("SELECT * FROM items WHERE itmbuyable=1 ORDER BY rand() LIMIT 1");
$r=$db->fetch_row($xm);
$xmasitem=$r['itmid'];
$userid=$ir['userid'];
$item=$r['itmname'];
echo "Merry Xmas, You have received a $item from Santa Claus[url='xmas.php']Back to Christmas Tree[/url]";
$db->query(sprintf("INSERT INTO inventory VALUES ('', %u, %u, %d)",$xmasitem,$userid,1));
$db->query(sprintf("UPDATE users SET xmas=%d WHERE userid=%u", 3,$ir['userid']));
}
}
function xmas_4()
{
global $db, $ir, $userid,$h;
if($ir['xmas'] != 3)
{
echo "You must open your presents in order! You missed the first 3!";
$h->endpage();
exit;
}
else
{
$xm=$db->query("SELECT * FROM items WHERE itmbuyable=1 ORDER BY rand() LIMIT 1");
$r=$db->fetch_row($xm);
$xmasitem=$r['itmid'];
$userid=$ir['userid'];
$item=$r['itmname'];
echo "Merry Christmas, Santa Claus has given you a $item for christmas.  Happy Holidays!";
$db->query(sprintf("INSERT INTO inventory VALUES ('', %u, %u, %d)",$xmasitem,$userid,1));
$db->query(sprintf("UPDATE users SET xmas=%d WHERE userid=%u", 4,$ir['userid']));

}
}

function xmas_5()
{
global $db, $ir, $userid,$h;
if($ir['xmas'] != 4)
{
echo "You must open your presents in order! You missed the first 4!";
$h->endpage();
exit;
}
else
{
$xm=$db->query("SELECT * FROM items WHERE itmbuyable=1 ORDER BY rand() LIMIT 1");
$r=$db->fetch_row($xm);
$xmasitem=$r['itmid'];
$userid=$ir['userid'];
$item=$r['itmname'];
echo "Merry Christmas, To celebrate the New Year Santa Claus has given you an $item.  Happy Holidays!";
$db->query(sprintf("INSERT INTO inventory VALUES ('', %u, %u, %d)",$xmasitem,$userid,1));
$db->query(sprintf("UPDATE users SET xmas=%d WHERE userid=%u", 5,$ir['userid']));
}
}
$h->endpage();
?>
Link to comment
Share on other sites

All ready fails that mod.

require("sqlpro.php");

Will not secure you one bit.

$cr=abs(@intval(rand(1,10)));

Not needed.

if($ir['xmas'] !=0)
{
echo "Sorry, you have already opened this present from santa.";
$h->endpage();
}

Shesh no exit? You will be displaying your footer twice.

Link to comment
Share on other sites

Quite the contrary it does not "fail"

Proper use of clean functions, strip tags, htmlentities, Plus the sql.pro i have, is just extra security.

And it's not the "original" off cronwerks, it's been heavily modified.

Thanks for trying tho :D

Original Post updated, didnt think to remove that><

Link to comment
Share on other sites

lol well i loaded it on my local host and it works, so.... it just needs a little tweaking.

but its still a nice mod. hell i have barely just now managed to make a three in one bank. lmao

and yes no exit get the page repeated at the bottom of the page.

either way its a nice little thing for your users. just add a few things and an image or 6 and its all good.

Link to comment
Share on other sites

Quite the contrary it does not "fail"

Proper use of clean functions, strip tags, htmlentities, Plus the sql.pro i have, is just extra security.

And it's not the "original" off cronwerks, it's been heavily modified.

Thanks for trying tho :D

Original Post updated, didnt think to remove that><

Thanks for trying? I can tell you that sqlpro crap will not secure you.

Link to comment
Share on other sites

lol try and redeem yourself child.

When you hit adult hood come talk to an adult and let me welcome you.

 

You tried, you failed, get over it.

rtfm? I have. Maybe you should re-educate yourself on it instead of trying to hack people's sites all the time or use bots. Get a girlfriend, maybe you'd be better off.

But then I doubt a female would go for a 12 year who can't pry himself off the computer.

Copying another games layout? really now? Lmao.

Why don't you ask around and see what i'm doing with a purchased layout.

Noob.

Link to comment
Share on other sites

  • 2 weeks later...

I updated this with images in the place of text for the gifts.

screen shot http://img199.imageshack.us/img199/7413/treeandgifts.jpg and http://img20.imageshack.us/img20/7413/treeandgifts.jpg

[mysql]<?php

include_once (DIRNAME(__FILE__) . '/globals.php');

 

if($ir['xmas'] > 4)

{

echo "You have already opened your presents from Santa";

$h->endpage();

}

echo "<h4>Merry Christmas, Open your presents from Santa.</h4>";

 

 

switch($_GET['option'])

{

 

case 'xmas_1':

xmas_1();

break;

case 'xmas_2':

xmas_2();

break;

case 'xmas_3':

xmas_3();

break;

case 'xmas_4':

xmas_4();

break;

case 'xmas_5':

xmas_5();

break;

default:

index();

break;

}

function index()

{

global $ir;

echo sprintf("

Merry Christmas %s Santa has left you 5 presents to open under your christmas tree.</p>

tree.JPG

", htmlspecialchars($ir['username']));;

echo "giftone.JPG

 

";

echo "gifttwo.jpg

";

echo "giftthree.JPG

";

echo "giftfour.JPG

";

echo "giftfive.JPG

";

}

function xmas_1()

{

global $db, $ir, $userid, $h;

if($ir['xmas'] !=0)

{

echo "Sorry, you have already opened this present.";

$h->endpage();

}

 

$cr=rand(1,10);

if($cr == 2)

{

echo "Santa gave you just what you always wanted! An elite computer for your household. Unfortunately when you plug it in, the computer short circuits and gives you one heck of a jolt!

The ambulance is called and you must spend some time in the hospital";

$db->query(sprintf("UPDATE users SET hp = %d, hospital =%d, hospreason = '%s', xmas=%d WHERE (userid=%u)",1,5,'Electricuted from faulty merchandise',1,$ir['userid']));

$h->endpage();

exit;

}

else

{

$xm=$db->query("SELECT * FROM items WHERE itmbuyable=1 ORDER BY rand() LIMIT 1");

$r=$db->fetch_row($xm);

$xmasitem=$r['itmid'];

$name=$r['itmname'];

$userid=$ir['userid'];

echo "Merry Xmas, You have received a $name from SantaBack to Christmas Tree";

$db->query(sprintf("INSERT INTO inventory VALUES ('', %u, %u, %d)",$xmasitem,$userid,1));

$db->query(sprintf("UPDATE users SET xmas=%d WHERE userid=%u",1,$ir['userid']));

}

}

function xmas_2()

{

global $db, $ir, $userid,$h;

if($ir['xmas'] !=1)

{

echo "You must open your presents in order! You missed the first one!";

$h->endpage();

exit;

}

$jail=rand(1,10);

if($jail=7)// If Random Number is 7--User is Jailed

{

echo "After opening your 2nd package from Santa you are interrupted by a Knock on the front door. As you approach the front door you are taken back when the it is kicked in and agents swarm your house.

Turns out the presents Santa gave you were hot merchandise and you have to pay the time. You're hauled off to jail.";

$db->query(sprintf("UPDATE users SET jail = %u, jail_reason = '%s', xmas=%d WHERE (userid=%u)",5,'Holding stolen merchandise',2,$ir['userid']));

$h->endpage();

exit;

}

else

{

$money = mt_rand(100, 1000);

$crystals = mt_rand(10, 50);

echo sprintf("Instead of gifts this year you find %u money %u crystals in a small envelope. Merry Xmas!", "\$". number_format($money), number_format($crystals));

$db->query(sprintf("UPDATE users SET money = money + %u, crystals = crystals + %u, xmas = %d WHERE userid = %d", $money, $crystals, 2, $userid));

}

}

function xmas_3()

{

global $db, $ir, $userid, $h;

 

if($ir['xmas'] !=2)

{

echo "You must open your presents in order. You missed the first 2!";

$h->endpage();

exit;

}

else

{

$xm=$db->query("SELECT * FROM items WHERE itmbuyable=1 ORDER BY rand() LIMIT 1");

$r=$db->fetch_row($xm);

$xmasitem=$r['itmid'];

$userid=$ir['userid'];

$item=$r['itmname'];

echo "Merry Xmas, You have received a $item from Santa ClausBack to Christmas Tree";

$db->query(sprintf("INSERT INTO inventory VALUES ('', %u, %u, %d)",$xmasitem,$userid,1));

$db->query(sprintf("UPDATE users SET xmas=%d WHERE userid=%u", 3,$ir['userid']));

}

}

function xmas_4()

{

global $db, $ir, $userid,$h;

if($ir['xmas'] != 3)

{

echo "You must open your presents in order! You missed the first 3!";

$h->endpage();

exit;

}

else

{

$xm=$db->query("SELECT * FROM items WHERE itmbuyable=1 ORDER BY rand() LIMIT 1");

$r=$db->fetch_row($xm);

$xmasitem=$r['itmid'];

$userid=$ir['userid'];

$item=$r['itmname'];

echo "Merry Christmas, Santa Claus has given you a $item for christmas. Happy Holidays!";

$db->query(sprintf("INSERT INTO inventory VALUES ('', %u, %u, %d)",$xmasitem,$userid,1));

$db->query(sprintf("UPDATE users SET xmas=%d WHERE userid=%u", 4,$ir['userid']));

}

}

function xmas_5()

{

global $db, $ir, $userid,$h;

if($ir['xmas'] != 4)

{

echo "You must open your presents in order! You missed the first 4!";

$h->endpage();

exit;

}

else

{

$xm=$db->query("SELECT * FROM items WHERE itmbuyable=1 ORDER BY rand() LIMIT 1");

$r=$db->fetch_row($xm);

$xmasitem=$r['itmid'];

$userid=$ir['userid'];

$item=$r['itmname'];

echo "Merry Christmas, To celebrate the New Year Santa Claus has given you an $item. Happy Holidays!";

$db->query(sprintf("INSERT INTO inventory VALUES ('', %u, %u, %d)",$xmasitem,$userid,1));

$db->query(sprintf("UPDATE users SET xmas=%d WHERE userid=%u", 5,$ir['userid']));

}

}

$h->endpage();

?>[/mysql]

Link to comment
Share on other sites

  • 1 month later...

.

This has gotta be the suckiest mod in the world. Not becuz its not coded well or anything, but why in the hell would a user wanna get hospitilized or thrown in the slammer for christmas. that would suck :(

Link to comment
Share on other sites

$xm=$db->query("SELECT * FROM items WHERE itmbuyable=1 ORDER BY rand() LIMIT 1");

... guess what im going to say lol

ok so your using 2 columns but pulling 15 (depends on items table) you have to be kidding me

$xm = $db->query("SELECT `itmid`, `itmname` FROM `items` WHERE `itmbuyable`=1 ORDER BY rand() LIMIT 1");

maybe better?

I know alot of you will think "oh its small who cares" think global not local, if that's in many places then it's a issue specially with 1000 users online im sure it would be.

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