-
Posts
182 -
Joined
-
Last visited
-
Days Won
2
Content Type
Profiles
Forums
Events
Everything posted by TheMasterGeneral
-
MCCv2, correct? I believe if you add users by the staff panel, it doesn't give an default IP to one of the fields. Check the panel, and your database and input a default IP (127.0.0.1 or whatever)
-
Well, shoot! I could have used that! :D haha. Yeah, that would have made things a lot easier. Thanks Kyle!
-
Hi! I made a timezone dropdown for timezone selection. Did basic testing. Its a rather small list of cities/places. I only included one city/option per time-zone. I'm not responsible for inaccuracies or daylight savings time. *Shrugs* SQL ALTER TABLE `users` ADD `timezone`ENUM('Pacific/Wake','Pacific/Apia','America/Adak','America/Anchorage','America/Los_Angeles','America/Denver','America/Chicago','America/New_York','America/Halifax','America/Godthab','America/Noronha','Atlantic/Cape_Verde','Europe/London','Europe/Berlin','Europe/Bucharest','Europe/Moscow','Asia/Tehran','Asia/Muscat','Asia/Kabul','Asia/Karachi','Asia/Calcutta','Asia/Katmandu','Asia/Novosibirsks','America/Godthab','Asia/Rangoon','Asia/Bangkok','Australia/Perth','Asia/Tokyo','Australia/Darwin','Australia/Sydney','Asia/Magadan','Pacific/Auckland','Pacific/Tongatapu')NOT NULL DEFAULT 'Europe/London' ; preferences.php //This goes in the switch at the top! case 'timezone': timezone_change(); break; //This goes at the bottom, above the $h->endpage(); function timezone_change() { global $db,$userid,$h,$ir; $DefaultTimeZone=('(GMT) Greenwich Mean Time'); //Set to whatever timezone is default. echo "<h3>Timezone Change</h3>"; // Much thanks to Tamas Pap from Stack Overflow for the list <3 // https://stackoverflow.com/questions/4755704/php-timezone-list if (!isset($_POST['timezone'])) { echo"Here, you may change your timezone. This will change all dates on the game for you. This won't speed up any processes. The default timezone is <u>{$DefaultTimeZone}</u>. All game-wide announcements and features will be based on this timezone. <br /> <form method='post'> <select name='timezone' type='dropdown'> <option value='Pacific/Tongatapu'>(GMT+13:00) Nuku'alofa</option> <option value='Pacific/Auckland'>(GMT+12:00) Auckland</option> <option value='Asia/Magadan'>(GMT+11:00) Magadan</option> <option value='Australia/Sydney'>(GMT+10:00) Sydney</option> <option value='Australia/Darwin'>(GMT+9:30) Darwin</option> <option value='Asia/Tokyo'>(GMT+9:00) Tokyo</option> <option value='Australia/Perth'>(GMT+8:00) Perth</option> <option value='Asia/Bangkok'>(GMT+7:00) Bangkok</option> <option value='Asia/Rangoon'>(GMT+6:30) Rangoon</option> <option value='Asia/Novosibirsk'>(GMT+6:00) Novosibirsk</option> <option value='Asia/Katmandu'>(GMT+5:45) Kathmandu</option> <option value='Asia/Calcutta'>(GMT+5:30) Chennai</option> <option value='Asia/Karachi'>(GMT+5:00) Karachi</option> <option value='Asia/Kabul'>(GMT+4:30) Kabul</option> <option value='Asia/Muscat'>(GMT+4:00) Muscat</option> <option value='Asia/Tehran'>(GMT+3:30) Tehran</option> <option value='Europe/Moscow'>(GMT+3:00) Moscow</option> <option value='Europe/Bucharest'>(GMT+2:00) Bucharest</option> <option value='Europe/Berlin'>(GMT+1:00) Berlin</option> <option value='Europe/London'>(GMT) Greenwich Mean Time</option> <option value='Atlantic/Cape_Verde'>(GMT-1:00) Cape Verde Islands</option> <option value='America/Noronha'>(GMT-2:00) Mid-Atlantic</option> <option value='America/Godthab'>(GMT-3:00) Greenland</option> <option value='America/St_Johns'>(GMT-3:30) Newfoundland</option> <option value='America/Halifax'>(GMT-4:00) Atlantic Time</option> <option value='America/New_York'>(GMT-5:00) Eastern Time</option> <option value='America/Chicago'>(GMT-6:00) Central Time</option> <option value='America/Denver'>(GMT-7:00) Mountain Time</option> <option value='America/Los_Angeles'>(GMT-8:00) Pacific Time</option> <option value='America/Anchorage'>(GMT-9:00) Alaska</option> <option value='America/Adak'>(GMT-10:00) Hawaii</option> <option value='Pacific/Apia'>(GMT-11:00) Midway Island</option> <option value='Pacific/Wake'>(GMT-12:00) International Date Line West</option> </select> <br /> <input type='submit' value='Change Timezone'>"; } else { $TimeZoneArray=[ "Pacific/Wake", "Pacific/Apia", "America/Adak", "America/Anchorage", "America/Los_Angeles", "America/Denver", "America/Chicago", "America/New_York", "America/Halifax", "America/Godthab", "America/Noronha", "Atlantic/Cape_Verde", "Europe/London", "Europe/Berlin", "Europe/Bucharest", "Europe/Moscow", "Asia/Tehran", "Asia/Muscat", "Asia/Kabul", "Asia/Karachi", "Asia/Calcutta", "Asia/Katmandu", "Asia/Novosibirsks", "America/Godthab", "Asia/Rangoon", "Asia/Bangkok", "Australia/Perth", "Asia/Tokyo", "Australia/Darwin", "Australia/Sydney", "Asia/Magadan", "Pacific/Auckland", "Pacific/Tongatapu" ]; if (!in_array($_POST['timezone'],$TimeZoneArray)) { echo "You specified an invalid timezone. Go back and try again."; } else { echo "You have successfully updated your timezome from {$ir['timezone']} to {$_POST['timezone']}."; $db->query("UPDATE `users` SET `timezone` = '{$_POST['timezone']}' WHERE `userid` = {$userid}"); } } } //This goes on the home function, with the links <a href='?action=timezone'>Change Timezone</a><br /> header.php //Inside the startheaders() function after the EOF; right before the userdata function date_default_timezone_set($ir['timezone']); Anyway, I hope you like it. Took a good hour just trying to find the timezones. Lol!
-
mccode-v2 Crimes (Players Can Go To Hospital)
TheMasterGeneral replied to jamboy1's topic in Free Modifications
IIRC, MCCodes's staff panel is setup weirdly. Change the "empty" to "isset" and it should work. -
In development - Backpack
TheMasterGeneral replied to boionfire81's topic in Requests & In Production
Yeah, get rid of the user={$ir['userid']}. You can call the user's ID using {$userid} inside the code itself. Basic troubleshooting tells me that you should first echo out the variables you're testing for at the top of the page after they're sanitized. echo $_GET['ID']; echo $_GET['user']; If any of those return nothing, that means you need to recheck your link you setup. I do believe its 100% how you have your conditional setup. Change: if (!empty($_POST['qty']) && !empty($_GET['user'])) To: if ((!empty($_POST['qty'])) && (!empty($_GET['user']))) Let me know the results. -
Welcome back, you old coot! :D
-
mccode-v2 Hospital Explore Updated **TESTED**
TheMasterGeneral replied to boionfire81's topic in Free Modifications
//Probably really dirty. Should work though. $MinimumRand=10; //Change to whatever the minimum amount of cash the player needs. if ($ir['money'] < $MinimumRand) { //Execute action without using money. Perhaps another get knocked out? } elseif ($ir['money'] < $MaximumRand) { $MaximumRand=$ir['money']; //Do rest } else { //Do normal action } Thanks for the read, [uSER=65530]Coly010[/uSER] ! Very informing. I kinda thought the same, [uSER=68711]KyleMassacre[/uSER], haha. :D -
mccode-v2 Hospital Explore Updated **TESTED**
TheMasterGeneral replied to boionfire81's topic in Free Modifications
Looks good, but, $result 6 does not check for if the player has enough cash on them for the bribe. They'll go negative cash if they have none. Someone can correct me if I'm wrong, but I think its a better idea to use mt_rand() over rand(). Also, in $result == 2, I think it may be smart to resolve the item_id to a variable, for easier editing. I understand you were only fixing bugs from an existing mod, but, still, a little advice might help you when it comes to your own mods. :D -TMG -
I'd rate that 4 stars. The upload isn't mirrored and its not even a full gigabit! Shame on you, DO!
-
mccode-v1 User Description
TheMasterGeneral replied to TheMasterGeneral's topic in Free Modifications
Did you get this working? I can reupload the code if needed. -
mod_sec for cpanel & session errors
TheMasterGeneral replied to boionfire81's topic in Engine Support
I don't think so, Kyle. With how MCCv2 is setup, the $macropage variable is called before globals.php His issue makes me think he has <header> set twice in his code. -
If you're looking for a game that's live and has a player base, that price you're asking for isn't going to get much offers. You might be able to get a super small game for that price.
-
Since its that time of the year again, I tend to have fun with these. What happens is on each page load, a random number is pulled out of a magic hat chosen, and if you get the lucky number, you get redirected to a seperate page where you get greeted by a ghost and a deathly scream. :P Execute the SQL: CREATE TABLE IF NOT EXISTS `scared` ( `userid` int(11) NOT NULL, `isscared` tinyint(4) NOT NULL, `scaredamount` tinyint(4) NOT NULL, PRIMARY KEY (`userid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; Open headers.php and find: if (!$ir['email']) Add above: if (($time >= 1446264000) && ($time <= 1446350400)) //This is the unix timestamp for halloween day on Eastern Time. { $scared=mt_rand(1,50); //Can be changed as you see fit if ($scared == 1) { $rname=$db->query("SELECT * FROM `scared` WHERE `userid` = {$userid}"); if(!$db->num_rows($rname)) { $db->query("INSERT INTO `scared` (`userid`, `isscared`, `scaredamount`) VALUES ('{$userid}', '1', '0');"); } $db->query("UPDATE `scared` SET `isscared` = 1 WHERE `userid` = {$userid}"); header("Location: scared.php"); } } Now create a file called scared.php with the code: <?php require("globals.php"); $item=164; $Scared=$db->query("SELECT `isscared` FROM `scared` WHERE `userid` = {$userid}"); $Scared=$db->fetch_single($Scared); if ($Scared == 1) { ?> <script> var sound = new Audio("sounds/file.ogg"); sound.load(); sound.play(); </script> <div class="scared"> <img class=ghost src="images/ghost_pic.png" alt="A picture of a scary ghost!"> </div> <br />Ooooh! Spooky ghost!!! Don't worry, he's gonna leave you alone for now! It also appears he left a ghostly fibre behind. Maybe if you hold onto it, you could create something cool out of it?<br /> <?php item_add($userid,$item,1); $db->query("UPDATE `scared` SET `isscared` = 0, `scaredamount` = `scaredamount` + 1 WHERE `userid` = {$userid}"); } else { echo "You're not scared..."; } Please note that on my page, it gives the player an item which can be used in a crafting recipe later to create a halloween themed armor. You don't have to do this. You can replace the item_add(); function with whatever you like. There's two files you need as well. A sound file and a ghost image! Conveniently, I've put them into a friendly little zip file for you. You can access them here. In case you couldn't figure it out... upload the image to a folder called images, and the sound to a folder called sounds. Alright! Should work! Did some basic testing of it on my WAMP Server. Let me know if any issues arise! Happy Halloween!
-
Hey there, MWG. I've spent a little bit of time doing this. Jail/Hospital times are now set via timestamp, instead of countdown timer. Edit in global_func.php (Add before the functions) require("lib/tmg/functions.php"); Save, upload. Now, create a file in lib/tmg called functions.php and paste in: <?php /* Functions for the new hospital/dungeon countdown systems. TheMasterGeneral File lib/tmg/functions.php 2015 */ $time=time(); function hospitalize($user,$time,$reason) { global $db; $currenttime=time(); $user = (isset($user) && is_numeric($user)) ? abs(intval($user)) : 0; $time = (isset($time) && is_numeric($time)) ? abs(intval($time)) : 0; //Time is in minutes. However, timestamps are based on seconds. So, multiplication is needed. $TimeGiven=$time*60; //Gotta figure if the user is in the infirmary or not... $q=$db->query("SELECT `hospital` FROM `users` WHERE `userid` = {$user}"); $userhosptime=$db->fetch_single($q); if ($userhosptime > $currenttime) { $db->query("UPDATE `users` SET `hospital` = `hospital` + {$TimeGiven}, `hospreason` = '{$reason}' WHERE `userid` = {$user}"); } else { $db->query("UPDATE `users` SET `hospital` = {$currenttime} + {$TimeGiven}, `hospreason` = '{$reason}' WHERE `userid` = {$user}"); } } function lockup($user,$time,$reason) { global $db; $currenttime=time(); $user = (isset($user) && is_numeric($user)) ? abs(intval($user)) : 0; $time = (isset($time) && is_numeric($time)) ? abs(intval($time)) : 0; //Time is in minutes. However, timestamps are based on seconds. So, multiplication is needed. $TimeGiven=$time*60; //Gotta figure if the user is in the infirmary or not... $q=$db->query("SELECT `jail` FROM `users` WHERE `userid` = {$user}"); $userhosptime=$db->fetch_single($q); if ($userhosptime > $currenttime) { $db->query("UPDATE `users` SET `jail` = `jail` + {$TimeGiven}, `jail_reason` = '{$reason}' WHERE `userid` = {$user}"); } else { $db->query("UPDATE `users` SET `jail` = {$currenttime} + {$TimeGiven}, `jail_reason` = '{$reason}' WHERE `userid` = {$user}"); } } function escape($user,$time) { global $db; $currenttime=time(); $user = (isset($user) && is_numeric($user)) ? abs(intval($user)) : 0; $time = (isset($time) && is_numeric($time)) ? abs(intval($time)) : 0; $TimeGiven=$time*60; $db->query("UPDATE `users` SET `jail` = `jail` - {$TimeGiven} WHERE `userid` = {$user}"); removejail(); } function heal($user,$time) { global $db; $currenttime=time(); $user = (isset($user) && is_numeric($user)) ? abs(intval($user)) : 0; $time = (isset($time) && is_numeric($time)) ? abs(intval($time)) : 0; $TimeGiven=$time*60; $db->query("UPDATE `users` SET `hospital` = `hospital` - {$TimeGiven} WHERE `userid` = {$user}"); removehosp(); } function removehosp() { global $db; $time=time(); $db->query("UPDATE `users` SET `hospital` = 0 WHERE `hospital` < {$time}"); } function removejail() { global $db; $time=time(); $db->query("UPDATE `users` SET `jail` = 0 WHERE `jail` < {$time}"); } Save, upload! Open globals.php and add in under check_level(); removejail(); removehosp(); Open header.php and replace the statement: if ($ir['jail']) with: if ($ir['jail']) { $jailtime=(($ir['jail']-$time)/60); $jailtime=round($jailtime, 2, PHP_ROUND_HALF_UP); echo "<b>NB:</b> You are currently in the dungeon for {$jailtime} minutes."; } Now look for the if statement with the hospital and replace with: if ($ir['hospital']) { $hospitaltime=(($ir['hospital']-$time)/60); $hospitaltime=round($hospitaltime, 2, PHP_ROUND_HALF_UP); echo "<b>NB:</b> You are currently in the infirmary for {$hospitaltime} minutes."; } Now everywhere you have a user be put into the hospital, use hospitalize($user,$time,$reason); //$user is the user getting hosptialized. //$time is the amount of time (in minutes) //$reason is the hospitalize reason Same for jailing.. lockup($user,$time,$reason); //Same structure as before. Now, finally, where-ever you have a query to remove/substract players jail/hospital time, use: escape($user,$time); and heal($user,$time); If its set up correctly, you should now be all set for timestamp hospital/jail times! Pages that need adjusting off the top of my head: Anything attack oriented Crimes Hospital Jail Staff Users If you run into issues, please drop a reply and I'll get back to you ASAP! I also highly suggest disabling access to your game while you're rolling this change out, because it'll cause some weird issues if someone receives a hospital visit while the code isn't 100% implemented yet. ;P Cheers!
-
mccode-v2 50/50 Chance Mod. Free Version
TheMasterGeneral replied to UCC's topic in Free Modifications
Three times the charm, eh? Necros like crazy :( -
I really think that many Text RPGs are just rehashed versions of each other. From my personal experience (from both a player and developer POV), most games have the same core mechanics, just tweaked slightly, if at all. Attack, train, lucky boxes, repeat. Innovation is needed, imho.
-
Well, this was, I really don't know.
-
If I post this reply, I'll feel part of the conversation!! :D
-
239496, or roughly 234KB. What made me chuckle a little bit about the script, was, about halfway scrolling right, the page was like "nope, i'm done showing you sh*t" :P
-
Memory: 240440, in about 3 seconds doiwin? [/obvious sarcasm]
-
-Register page seems broken? I have no forms to enter. -Text and background clash horribly. -White colored text is actually difficult to read on some parts. -Login page links are broken? (Register, Contact Us, etc...)
-
I'm well aware, Coly, hence the joke. .-.
-
Right click, inspect element. :P Was it ever stated what was powering this game?
-
My apologies! That was something else I added into the game. Its used to track how many thanks/likes/dislikes a player has received. Yeah. I see the error of my ways. I'm not a(n) 1337 PHP'er/MySQLi'er From the POV of my WAMP server, $h->endpage(); was already called outside all the functions. Yeah. Quite stupid of me. Coding at midnight, like a freaking boss. >_> I'll clean it up a little bit! Stay tuned. ^^
-
Pretty simple. Allows players to rate other players' posts. I haven't made a staff panel for it, just because its super simple, haha. This mod contains some javascript too! :D Things to note: -An individual player may only rate a single post once! -A player cannot rate their own posts! The SQL: CREATE TABLE IF NOT EXISTS `forum_ratings` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `user` int(11) unsigned NOT NULL, `postid` int(11) unsigned NOT NULL, `rating` tinyint(1) unsigned NOT NULL COMMENT '1=thanks, 2=dislike, 3=like', `poster` int(11) unsigned NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; forums.php FIND: case 'pin': pin(); break; UNDERNEATH PASTE: case 'rating': rating(); break; FIND NEXT: {$memb['forums_signature']} UNDER THAT, PASTE: <br /> -------------------<br />"; $thanks=$db->query("SELECT * FROM `forum_ratings` WHERE `postid` = {$r['fp_id']} AND `rating` = 1"); $thanks=$db->num_rows($thanks); $dislikes=$db->query("SELECT * FROM `forum_ratings` WHERE `postid` = {$r['fp_id']} AND `rating` = 2"); $dislikes=$db->num_rows($dislikes); $likes=$db->query("SELECT * FROM `forum_ratings` WHERE `postid` = {$r['fp_id']} AND `rating` = 3"); $likes=$db->num_rows($likes); echo" <b>Post Thanks / Like - {$thanks} Thanks, {$likes} Likes, {$dislikes} Dislikes.</b>"; $queryforme=$db->query("SELECT * FROM `forum_ratings` WHERE `postid`={$r['fp_id']} AND `user` = {$userid}"); if ($db->num_rows($queryforme) == 0 && $r['fp_poster_id'] != $userid) { echo" <br />[<a href='?act=rating&fpid={$r['fp_id']}&rating=1'>Thank for this post</a>] [<a href='?act=rating&fpid={$r['fp_id']}&rating=2'>Like this Post</a>] [<a href='?act=rating&fpid={$r['fp_id']}&rating=3'>Dislike this Post</a>]"; } else { echo"<br />"; } Now, outside of a function. Paste in: function rating() { global $userid,$db,$h; $_GET['fpid'] = (isset($_GET['fpid']) && is_numeric($_GET['fpid'])) ? abs(intval($_GET['fpid'])) : '0'; $_GET['rating'] = (isset($_GET['rating']) && is_numeric($_GET['rating'])) ? abs(intval($_GET['rating'])) : '1'; ?> <script> var count=3; var counter=setInterval(timer, 1000); //1000 will run it every 1 second function timer() { count=count-1; if (count <= 0) { clearInterval(counter); window.history.back(); return; } document.getElementById("timer").innerHTML=count + " seconds."; //Do code for showing the number of seconds here }</script> <?php $TestForAlreadyRated=$db->query("SELECT * FROM `forum_ratings` WHERE `postid` = {$_GET['fpid']} AND `user` = {$userid}"); if ($_GET['rating'] > 3) { echo "Invalid Rating. Redirecting you back in "; echo "<span id='timer'>3 seconds.</span>"; exit; } elseif ($_GET['rating'] < 1) { echo "Invalid Rating. Redirecting you back in "; echo "<span id='timer'>3 seconds.</span>"; exit; } elseif ($db->num_rows() > 0) { echo "You have already rated this post! You can only rate a single post once! Redirecting you back in "; echo "<span id='timer'>3 seconds.</span>"; exit; } else { $poster=$db->query("SELECT `fp_poster_id` FROM `forum_posts` WHERE `fp_id` = {$_GET['fpid']}"); $poster=$db->fetch_single($poster); if ($_GET['rating'] == 1) { $db->query("INSERT INTO `forum_ratings` (`id`, `user`, `postid`, `rating`, `poster`) VALUES ('', '{$userid}', '{$_GET['fpid']}', '1', '{$poster}');"); echo "You have successfully thanked this post. Redirecting you back in "; echo "<span id='timer'>3 seconds.</span>"; exit; } elseif ($_GET['rating'] == 2) { $db->query("INSERT INTO `forum_ratings` (`id`, `user`, `postid`, `rating`, `poster`) VALUES ('', '{$userid}', '{$_GET['fpid']}', '3', '{$poster}');"); echo "You have successfully liked this post. Redirecting you back in "; echo "<span id='timer'>3 seconds.</span>"; exit; } elseif ($_GET['rating'] == 3) { $db->query("INSERT INTO `forum_ratings` (`id`, `user`, `postid`, `rating`, `poster`) VALUES ('', '{$userid}', '{$_GET['fpid']}', '2', '{$poster}');"); echo "You have successfully disliked this post. Redirecting you back in "; echo "<span id='timer'>3 seconds.</span>"; exit; } else { echo "You have successfully not rated this post! Maybe you should specify a valid rating? Redirectring you back in "; echo "<span id='timer'>3 seconds.</span>"; exit; } } } Should work fine. I tested it against basic SQL injections. If you liked it, like my post or thank it. ^^ Screenies: [ATTACH]2158[/ATTACH] [ATTACH]2159[/ATTACH]