ok, i didnt like the orignal copy of luck box due to you can only box 5 times a day.

This mod allows you to open a box every 15 minutes.
Enjoy.
You might need to edit the lucky.php to suit your game abit more.
ok First make a Page called cron-15.php and place this into it
<?php
include "config.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db=new database;
$db->configure($_CONFIG['hostname'],
$_CONFIG['username'],
$_CONFIG['password'],
$_CONFIG['database'],
$_CONFIG['persistent']);
$db->connect();
$c=$db->connection_id;
$db->query("UPDATE users SET boxes_opened=0");
?>
Add the cron to your server
0/15 0 0 0
http://www.yourgame.com/cron-15.phpNext update lucky.php with the file located below.
<?php
include "globals.php";
global $db,$ir,$r,$c,$userid,$h,$li;
print "
<br />
<img src='fusion_icon.png' height='200' width='200'>
<br />
<h3>Lucky Boxes</h3><hr />";
if($_GET['open'])
{
if($ir['boxes_opened'] >= 1)
{
die("Sorry, you have already opened the box.<br />");
}
$num=rand(1, 9);
$db->query("UPDATE users SET boxes_opened=boxes_opened+1 WHERE userid=$userid");
$db->query("UPDATE users SET totalopened=totalopened+1 WHERE userid=$userid");
$ir['money']-=0;
switch($num)
{
case 1:
$tokens=rand(5,50);
print "You Gained {$tokens} Crystals";
$db->query("UPDATE users SET crystals=crystals+{$tokens} WHERE userid={$userid}");
break;
case 2:
$money=rand(330, 3300);
print "You Gained \${$money}";
$db->query("UPDATE users SET money=money+{$money} WHERE userid={$userid}");
break;
case 3:
$ex=rand(250, 7500);
print "You Gained {$ex} XP";
$db->query("UPDATE users SET exp=exp+{$ex} WHERE userid={$userid}");
break;
case 4:
$tokens=rand(5,50);
print "You Gained {$tokens} Gold";
$db->query("UPDATE users SET crystals=crystals+{$tokens} WHERE userid={$userid}");
break;
case 5:
$tokens=rand(5,50);
print "You Gained {$tokens} Gold";
$db->query("UPDATE users SET crystals=crystals+{$tokens} WHERE userid={$userid}");
break;
case 6:
$money=rand(330, 3300);
print "You Gained \${$money}";
$db->query("UPDATE users SET money=money+{$money} WHERE userid={$userid}");
break;
case 7:
$ex=rand(250, 7500);
print "You Gained {$ex} XP";
$db->query("UPDATE users SET exp=exp+{$ex} WHERE userid={$userid}");
break;
case 8:
$money=rand(330, 3300);
print "You Gained \${$money}";
$db->query("UPDATE users SET money=money+{$money} WHERE userid={$userid}");
break;
case 9:
$ex=rand(250, 7500);
print "You Gained {$ex} XP";
$db->query("UPDATE users SET exp=exp+{$ex} WHERE userid={$userid}");
break;
}
print "<hr />
<a href='explore.php'>Back to Town</a>";
}
else
{
print "A man comes up to you and whispers, <br />
\"I have magical box, I let you open one every 15 Minutes.\"<br />
Deal or no deal?<hr />
<a href='lucky.php?open=1'>Okay, open one.</a><br />
<a href='explore.php'>No thanks.</a>";
}
$h->endpage();
?>
save that, add this into your database
totalopened int 11 default 0
Open your viewuser.php
Find
User Level: $userl<br />
add either before or after
Opened {$r['totalopened']} Boxes<br />
Next Open header.php
add this
if($ir['boxes_opened'] == 0)
{
$box = "<img src='box.png' title='Lucky Box' height='12' width='12' />";
}
else
{
$box = "";
}
Add this where you want this to show, i placed this under Username
<a href='lucky.php' target='_parent'><b>Achievments:</b>$d $box</a>
and finally Upload the Attached image.
and finally, let me know what you think, enjoy.