marvin Posted October 10, 2011 Share Posted October 10, 2011 Is there a way to set it so jail time is measured in minutes instead of days? Quote Link to comment Share on other sites More sharing options...
mixmaster Posted October 10, 2011 Share Posted October 10, 2011 Is there a way to set it so jail time is measured in minutes instead of days? Do you mean fed jail ? Quote Link to comment Share on other sites More sharing options...
marvin Posted October 10, 2011 Author Share Posted October 10, 2011 Do you mean fed jail ? When I go to staff panel under punishments it says jail user. when I click it I have the options USER, DAYS, REASON. Is there another way to jail users for minutes instead of days? Quote Link to comment Share on other sites More sharing options...
mixmaster Posted October 10, 2011 Share Posted October 10, 2011 Why would you want it in minutes , you want people to know how long they are banned from your game from , you dont want them to be confused when they go on your game and it says " you are banned for something like 999674 minutes Quote Link to comment Share on other sites More sharing options...
marvin Posted October 10, 2011 Author Share Posted October 10, 2011 Why would you want it in minutes , you want people to know how long they are banned from your game from , you dont want them to be confused when they go on your game and it says " you are banned for something like 999674 minutes 999674 is equal to 694 days. Im customizing the game to how my members want it played. Minutes works better in my situation. Quote Link to comment Share on other sites More sharing options...
mixmaster Posted October 10, 2011 Share Posted October 10, 2011 So your members anr't smart enough to figure out how many days they are banned for but they are smart enough to know how many minutes ? Quote Link to comment Share on other sites More sharing options...
marvin Posted October 10, 2011 Author Share Posted October 10, 2011 Why are you being so rude? Im trying to customize the game so its more fun for my members. I dont want to ban my members for 2 years. The game gets boring. Quote Link to comment Share on other sites More sharing options...
mixmaster Posted October 10, 2011 Share Posted October 10, 2011 sorry i didn't mean to come across as rude , it's just abit weird they prefer minutes instead of days Quote Link to comment Share on other sites More sharing options...
Neon Posted October 11, 2011 Share Posted October 11, 2011 /** * A function for making time periods readable * * @author Aidan Lister <[email protected]> * @version 2.0.1 * @link http://aidanlister.com/2004/04/making-time-periods-readable/ * @param int number of seconds elapsed * @param string which time periods to display * @param bool whether to show zero time periods */ function time_duration($seconds, $use = null, $zeros = false) { // Define time periods $periods = array ( 'years' => 31556926, 'Months' => 2629743, 'weeks' => 604800, 'days' => 86400, 'hours' => 3600, 'minutes' => 60, 'seconds' => 1 ); // Break into periods $seconds = (float) $seconds; $segments = array(); foreach ($periods as $period => $value) { if ($use && strpos($use, $period[0]) === false) { continue; } $count = floor($seconds / $value); if ($count == 0 && !$zeros) { continue; } $segments[strtolower($period)] = $count; $seconds = $seconds % $value; } // Build the string $string = array(); foreach ($segments as $key => $value) { $segment_name = substr($key, 0, -1); $segment = $value . ' ' . $segment_name; if ($value != 1) { $segment .= 's'; } $string[] = $segment; } return implode(', ', $string); } So if its currently stored as a timestamp in the future then do. time() - $storedTimeStamp. If its stored as seconds, then just use that. Send that to this like time_duration(time,'m'); M means minutes only. Quote Link to comment Share on other sites More sharing options...
marvin Posted October 11, 2011 Author Share Posted October 11, 2011 /** * A function for making time periods readable * * @author Aidan Lister <[email protected]> * @version 2.0.1 * @link http://aidanlister.com/2004/04/making-time-periods-readable/ * @param int number of seconds elapsed * @param string which time periods to display * @param bool whether to show zero time periods */ function time_duration($seconds, $use = null, $zeros = false) { // Define time periods $periods = array ( 'years' => 31556926, 'Months' => 2629743, 'weeks' => 604800, 'days' => 86400, 'hours' => 3600, 'minutes' => 60, 'seconds' => 1 ); // Break into periods $seconds = (float) $seconds; $segments = array(); foreach ($periods as $period => $value) { if ($use && strpos($use, $period[0]) === false) { continue; } $count = floor($seconds / $value); if ($count == 0 && !$zeros) { continue; } $segments[strtolower($period)] = $count; $seconds = $seconds % $value; } // Build the string $string = array(); foreach ($segments as $key => $value) { $segment_name = substr($key, 0, -1); $segment = $value . ' ' . $segment_name; if ($value != 1) { $segment .= 's'; } $string[] = $segment; } return implode(', ', $string); } So if its currently stored as a timestamp in the future then do. time() - $storedTimeStamp. If its stored as seconds, then just use that. Send that to this like time_duration(time,'m'); M means minutes only. do I have to make a new php file for that or where do I put all that? Quote Link to comment Share on other sites More sharing options...
Neon Posted October 11, 2011 Share Posted October 11, 2011 Thats just a function. Post it outside of your current function or class or method, or whatever. Then just reference it. Depending if your in a class file or not simply time_duration() or self::time_duration() or $this->time_duration(). I shouldn't of posted, since I code in a custom framework & I don't know one bit of how the structure of MCCodes is. Quote Link to comment Share on other sites More sharing options...
marvin Posted October 11, 2011 Author Share Posted October 11, 2011 Thats just a function. Post it outside of your current function or class or method, or whatever. Then just reference it. Depending if your in a class file or not simply time_duration() or self::time_duration() or $this->time_duration(). I shouldn't of posted, since I code in a custom framework & I don't know one bit of how the structure of MCCodes is. Im not smart enough to understand what your saying. Quote Link to comment Share on other sites More sharing options...
gurpreet Posted October 12, 2011 Share Posted October 12, 2011 Neon is telling you how to call the function. If that's too complicated, try using this one: function time_format($secs) { $times = array(3600, 60, 1); $time = ''; $tmp = ''; for($i = 0; $i < 3; $i++) { $tmp = floor($secs / $times[$i]); if($tmp < 1) { $tmp = '00'; } elseif($tmp < 10) { $tmp = '0' . $tmp; } $time .= $tmp; if($i < 2) { $time .= ':'; } $secs = $secs % $times[$i]; } return $time; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.