The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Age count
Author Message
Leonidas
Master
**

Posts: 277
Likes Given: 3
Likes Received: 13 in 12 posts
Joined: May 2013
Reputation: 1



Post: #1
Age count
Got a little script that shows your characters age by days. But I'm wanting to have this script show weeks,months, and years, instead of x amount of days. How would I go about doing that? Thank you


Code:
[EVENTS e_age]

ON=@LOGIN
IF <SRC.TAG0.AGE> =
SRC.TAG0.AGE=0
TIMERF 86400 , f_age // 1 day in seconds

[FUNCTION f_age]
SRC.TAG0.AGE=<EVAL (<SRC.TAG0.AGE>+1)>
SRC.SYSMESSAGE You are now one day older. Type .age to see your current age.
TIMERF 86400 , f_age

[FUNCTION age]
SRC.SYSMESSAGE Your character is <EVAL <SRC.TAG0.AGE>> days old.
ENDIF
11-10-2016 07:34 AM
Find all posts by this user Like Post Quote this message in a reply
Kanibal
Master
**

Posts: 255
Likes Given: 6
Likes Received: 30 in 28 posts
Joined: Jun 2012
Reputation: 0



Post: #2
RE: Age count
(11-10-2016 07:34 AM)Leonidas Wrote:  Got a little script that shows your characters age by days. But I'm wanting to have this script show weeks,months, and years, instead of x amount of days. How would I go about doing that? Thank you

<account.totalconnecttime> did not work anymore?

Grandmaster Localhost Admin
11-10-2016 07:45 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Leonidas
Master
**

Posts: 277
Likes Given: 3
Likes Received: 13 in 12 posts
Joined: May 2013
Reputation: 1



Post: #3
RE: Age count
How does that count? By seconds, hours, days?
11-10-2016 08:15 AM
Find all posts by this user Like Post Quote this message in a reply
Kanibal
Master
**

Posts: 255
Likes Given: 6
Likes Received: 30 in 28 posts
Joined: Jun 2012
Reputation: 0



Post: #4
RE: Age count
(11-10-2016 08:15 AM)Leonidas Wrote:  How does that count? By seconds, hours, days?
Seconds.

Here is PHP function that shows server uptime. MySQL value $row['timeup'] = <serv.timeup>. Rewrite it and be happy
Code:
<?php
    $uptime = $row['timeup'];
    $days = floor($uptime / (60*60*24));
    $uptime = $uptime % (60*60*24);
    $hours = floor($uptime / (60*60));
    $uptime = $uptime % (60*60);
    $minutes = floor($uptime / 60);
    echo $days . ' Days ' . $hours . ' Hours ' . $minutes . ' Minutes';
    ?>

Grandmaster Localhost Admin
11-10-2016 08:23 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Leonidas
Master
**

Posts: 277
Likes Given: 3
Likes Received: 13 in 12 posts
Joined: May 2013
Reputation: 1



Post: #5
RE: Age count
Not really looking for a server uptime. Using this age function as a way to tell players their age, give vet bonuses, noob protection and what not.

The script I have now works fine, I'm just wanting it to show more.

Player plays for 7 days, types .age, "You are now 1 week old."
Player plays for 9 days, types .age, "You are now 1 week and 2 days old."

Same with months and years.


I know that php code will work for a server status, but I'm just looking for a basic in-game command.
(This post was last modified: 11-10-2016 08:30 AM by Leonidas.)
11-10-2016 08:29 AM
Find all posts by this user Like Post Quote this message in a reply
Kanibal
Master
**

Posts: 255
Likes Given: 6
Likes Received: 30 in 28 posts
Joined: Jun 2012
Reputation: 0



Post: #6
RE: Age count
(11-10-2016 08:29 AM)Leonidas Wrote:  I'm just looking for a basic in-game command.
Just one question, 31 days = 1 months, or 31 days = 1 months and 1day, or 31 days = 1 months and 3 days (February)?Devil

Grandmaster Localhost Admin
11-10-2016 08:48 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Leonidas
Master
**

Posts: 277
Likes Given: 3
Likes Received: 13 in 12 posts
Joined: May 2013
Reputation: 1



Post: #7
RE: Age count
I'd probably just use 30 days.
11-10-2016 09:05 AM
Find all posts by this user Like Post Quote this message in a reply
Kanibal
Master
**

Posts: 255
Likes Given: 6
Likes Received: 30 in 28 posts
Joined: Jun 2012
Reputation: 0



Post: #8
RE: Age count
(11-10-2016 09:05 AM)Leonidas Wrote:  I'd probably just use 30 days.

365 days in one year?Devil

Grandmaster Localhost Admin
11-10-2016 09:12 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Leonidas
Master
**

Posts: 277
Likes Given: 3
Likes Received: 13 in 12 posts
Joined: May 2013
Reputation: 1



Post: #9
RE: Age count
Are you trying to be sarcastic?
11-10-2016 03:39 PM
Find all posts by this user Like Post Quote this message in a reply
Kanibal
Master
**

Posts: 255
Likes Given: 6
Likes Received: 30 in 28 posts
Joined: Jun 2012
Reputation: 0



Post: #10
RE: Age count
(11-10-2016 03:39 PM)Leonidas Wrote:  Are you trying to be sarcastic?

I'm trying to tell you that is no "basic in-game command" like this, and i'ts a bad idea. Rolleyes

Grandmaster Localhost Admin
11-10-2016 08:59 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)