-
Posts
2,921 -
Joined
-
Last visited
-
Days Won
48
Content Type
Profiles
Forums
Events
Everything posted by KyleMassacre
-
You could look into caching your site, use minified, etc to give a bit of a boost.
-
Not to burst your bubble haha but that's not the problem. The problem was his hierarchy of where his functions, includes, and objects were placed in the script. Not to mention aade up function name called mysql_escape(). He placed the event_add function at the very top using the global variable/object $db which wasn't defined yet, and all he needed to do was include global_func.php. The quotes in the queries you place are to kind of inform MySQL that it's a string but the columns are casted as ints which MySQL will convert those to an int anyway. What [MENTION=68406]-BRAIDZ-[/MENTION] needs to understand is that you can use a variable without creating it. Doing that is like going to a country club you are not a member of. event_add(), and $db were trying to show up before being on the guest list
-
Is there stuff in the tables it's supposed to be updating? <?php include "config.php"; include "language.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; include_once('global_func.php'); $random_select = $db->query("SELECT `user` FROM `lottery_players` ORDER BY RAND() LIMIT 1"); $rs = $db->fetch_row($random_select); echo $rs['user']." Was selected<br/>"; $lotto_config = $db->query("SELECT `ticketprice` FROM `lottery_config`"); $lc = $db->fetch_single($lotto_config); echo $lc." Is the ticket price<br/>"; $winnings = $db->query("SELECT COUNT(`user`) FROM `lottery_players`"); $win = $db->fetch_single($winnings); echo $win." Is the winnings<br/>"; $gain = $lc * $win; $db->query("UPDATE `users` SET `money` = `money` + {$gain} WHERE `userid` = {$rs['user']}"); echo "Users table updated<br/>"; event_add($rs['user'], "You have won ".money_formatter($gain)." on the lottery."); echo "Event sent<br/>"; $db->query("TRUNCATE TABLE `lottery_players`"); echo "lottery table truncated<br/>"; $db->query("UPDATE `users` SET `tickets` = 0"); echo "Tickets set to 0"; ?> Copy/Paste what is shown on your screen
-
Ok this should work and this is the last time I am posting a full script for you, you really need to learn yourself or you will get nowhere: <?php include "config.php"; include "language.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; include_once('global_func.php'); /*Remove the comment when this works, change your cron URL to add ?code=enter config code found in config.php if(!isset($_GET['code']) || isset($_GET['code']) != $_CONFIG['code']) { return; } */ $random_select = $db->query("SELECT `user` FROM `lottery_players` ORDER BY RAND() LIMIT 1"); $rs = $db->fetch_row($random_select); $lotto_config = $db->query("SELECT `ticketprice` FROM `lottery_config`"); $lc = $db->fetch_single($lotto_config); $winnings = $db->query("SELECT COUNT(`user`) FROM `lottery_players`"); $win = $db->fetch_single($winnings); $gain = $lc * $win; $db->query("UPDATE `users` SET `money` = `money` + {$gain} WHERE `userid` = {$rs['user']}"); event_add($rs['user'], "You have won ".money_formatter($gain)." on the lottery."); $db->query("TRUNCATE TABLE `lottery_players`"); $db->query("UPDATE `users` SET `tickets` = 0"); ?>
-
If that is the entire cron then there is no cron code so we can probably rule that out. I think at least one problem would be his event_add function which is declared at the top of his file before any of his includes so it doesn't understand his global variables. Also, there is no function called mysql_escape() unless it's a custom function you create inside your event add function that should be changed to $db->escape. Bottom line I think you should remove that event_add function from your cron since it is in one of your included files.
-
I'm sorry but I am going to sound like an ass here but I feel it's for your own good. i don't see what is so confusing about this, coly and sniko have helped you immensely and have pretty much given you almost a fully functional system here. If you understood the way PHP works regardless of Framework/Script you would have this done by now. The reason you are not understanding what is being offered to you is because you refuse to try to learn, expect people to do it for you so you can copy/paste and expect it to work. But guess what? It's not going to happen. You can't troubleshoot because you have no clue to what is actually going on in your script. This is all basic stuff and nothing out of the ordinary. Please se take the time to read the documentation that has been provided to you and learn it
-
mccode-v2 Simple game tutorial for new players
KyleMassacre replied to dnenb's topic in Free Modifications
include_once("tutorial.php"); like so -
Its probably due to an undefined function brew_beer() the function doesnt exist so try removing that case
-
I just did and you quoted it
-
That right there is false advertisement and grounds for why anyone shouldnt use it.
-
Do you know what requests are? If not there are a few types of requests but you will mostly be dealing with GET and POST. POST requests are mostly used in forms and GET requests are generally used in URLs. In your case your GET is action i.e. $_GET['action'] so you could do something like: $action = isset($_GET['action']) ? $db->escape($_GET['action']) : null; //Yeah I know, escape() isnt the best so sue me. Its just a standard mres() if($action) { echo "You are currently brewing ".ucfirst($action); } So if you clicked on the beer link it would say: "You are currently brewing Beer."
-
You should focus on trying to create dynamic content and not static content something like this: <?php include_once "globals.php"; print "<h3>Your Home Brewery</h3 <p>You are sitting in your shed.</br>What would you like to brew?</p></br> <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'> <tr> <th colspan='3'>Brewery Options</th> </tr>"; $results = $db->query("SELECT brewery_name, brewery_action FROM brewery"); if!($db->num_rows($results)) { echo "<tr> "<td colspan='2' align='center'>There are no results</td> </tr>"; } else { while($r = $db->fetch_row($results)) { echo "<tr> <td>".$r['brewery_name']."</td> <td><a href='brewery.php?action=".$r['brewery_action']."'>Brew</a></td> </tr>" } } </table><hr width=85%>"; print "This module is a working progress.Should be up and running in a few weeks."; ?> Now you can create a staff panel with stuff to credit people and make stuff on the fly
-
What editor do you use? You keep getting asterisks in your code. Whatever it is uninstal it and get something better like sublime text, PHPStorm, NetBeans, or hell even NotePad++. I would prefer you get PHPStorm if you have the money or get NetBeans, that way you get some IDE functionality like code completion and better error handling inside the text editor. Also, look into logging errors or create your own error handler, you only say you get a blank screen but we can't help you unless you tell us your error
-
Then you have no visible errors and everything is running like a dream as far as i can tell. At the end of all your queries before the semi colon put in or die(mysql_error()) Similar to this: $random_select= $db->query("SELECT `user` FROM `lottery_players` ORDER BY RAND() LIMIT 1") or die(mysql_error());
-
When you type in your crons url in your address bar what does it say?
-
Did you edit the cron?
-
I haven't opened up attack logs in quite some time but doesn't that track it? You can just query up the sum in the table.
-
You may want to anyway because the R&iP since this is in production and technically a request
-
Lottery Mod This was brought over from the GRPG section found here: http://makewebgames.io/showthread.php/44573-Lottery-Mod
-
That's what I am talking about. And the only other business mod I can think of is Richards from a while back. I don't know if it's the same mod though because all Raven did was take free and I think some laid mods from here and put them into MCC and sold it as Raven. But as Adam has said by default MCC doesn't have businesses so we don't even know what to use it for. If it's an addon for an existing module, great and thanks but at least let us know what it goes too
-
True, no? It's just like creating a template for any other framework. It's best to follow their pattern to get the same functionality
-
I am still lost on this one though [MENTION=68406]-BRAIDZ-[/MENTION]. Is there more to this mod? Why does staff members need to create a new business class? Plus, if this is something for Raven script only, this forum doesn't support it. I know Raven will port to MCC and the other way around but MCC doesn't have the other file(s) that I think are missing. So in short, this mod is pretty useless
-
Well I think no one can really say he didn't create it until someone can post the source for which it came from. Can people have their suspicions? Sure
-
Maybe I'm completely missing something here but is there more to this?
-
I actually don't see how this is accurate. I by no means any good at templating but HTML/CSS is HTML/CSS. I just don't understand how an engine or a framework limits you on a template design. Sure NWE has its quirks if you want to keep some of the engines js functional without having to rewrite it you have to keep class and id names the same but that's a draw back of having a community oriented modular system. With any other system you still have to edit your files to do the same but at least with NWE it's only like 1 or 2 files you have to edit since the templates come with a functions file and all the client side stuff is rendered in the main.php file. NWE just requires a structure is all I'm trying to get at here