Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: date and time script

  1. #11
    Private
    Join Date
    Dec 2016
    Posts
    30
    Thanks
    5
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by IzNoGoD View Post
    https://killtube.org/showthread.php?...out-precaching

    Don't use the makelocalized thing for stuff that changes a lot, you'll end up with an aweful lot of configstrings.

    but I did not understand how it would fit into my script ...

  2. #12
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    try
    PHP Code:
    /*
    */
    //precache this somewhere
    precacheString(&"tech_date"); //tech_date very long, better "t_d" or "td"
    /*
    */

    PlayerConnect() //make thread after player connected or logged
    {
    self.time_hud newHudElem();
    self.time_hud.70;
    self.time_hud.460;
    self.time_hud.alignX "left";
    self.time_hud.alignY "top";
    self.time_hud.fontScale 0.8;
    self.time_hud.color = (100);
    self.time_hud.label = &"tech_date"

    index G_FindConfigstringIndex("tech_date"1310256);

    while (
    1)
    {
    sendGameServerCommand(self getEntityNumber(), "d " index " " +  getlocaltime());
    wait 5//rate of update date hud
    }


    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

  3. The Following User Says Thank You to maxdamage99 For This Useful Post:

    kung foo man (16th June 2018)

  4. #13
    Private
    Join Date
    Feb 2018
    Posts
    28
    Thanks
    12
    Thanked 17 Times in 16 Posts
    Change newHudElem to NewClientHudElem(self);

  5. #14
    Private
    Join Date
    Dec 2016
    Posts
    30
    Thanks
    5
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by maxdamage99 View Post
    try
    PHP Code:
    /*
    */
    //precache this somewhere
    precacheString(&"tech_date"); //tech_date very long, better "t_d" or "td"
    /*
    */

    PlayerConnect() //make thread after player connected or logged
    {
    self.time_hud newHudElem();
    self.time_hud.70;
    self.time_hud.460;
    self.time_hud.alignX "left";
    self.time_hud.alignY "top";
    self.time_hud.fontScale 0.8;
    self.time_hud.color = (100);
    self.time_hud.label = &"tech_date"

    index G_FindConfigstringIndex("tech_date"1310256);

    while (
    1)
    {
    sendGameServerCommand(self getEntityNumber(), "d " index " " +  getlocaltime());
    wait 5//rate of update date hud
    }


    working!! thanks! =]

  6. #15
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Make sure you self endon("disconnect") or there will be a lot of threads running after a client disconnects.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  7. The Following 3 Users Say Thank You to IzNoGoD For This Useful Post:

    caldas (16th June 2018),kung foo man (16th June 2018),maxdamage99 (20th June 2018)

  8. #16
    Private
    Join Date
    Dec 2016
    Posts
    30
    Thanks
    5
    Thanked 5 Times in 5 Posts
    do you think this can affect server performance?


    --

    i made a small change and recompile voron00 libcod

    PHP Code:
    void gsc_utils_getlocaltime()
    {
            
    time_t timer;
            
    struct tm *timeinfo;

            
    time(&timer);
            
    timeinfo localtime(&timer);

            
    char timestring[256];
            
    strftime(timestringsizeof(timestring), "%d/%m/%Y %H:%M"timeinfo);
            
    char stripped_time[128];

            
    strncpy(stripped_timetimestringsizeof(stripped_time));
            
    stripped_time[strlen(timestring) - 1] = '\0';

            
    stackPushStringstripped_time );

    Last edited by caldas; 16th June 2018 at 13:58.

  9. #17
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Why would you copy the output over to a new stringbuffer and return that? Just return the original var...
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  10. #18
    Private
    Join Date
    Dec 2016
    Posts
    30
    Thanks
    5
    Thanked 5 Times in 5 Posts
    how can i do this? i have not mastered much yet

  11. #19
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    stackPushString(timestring);

    And drop the stripped_time thing.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  12. The Following User Says Thank You to IzNoGoD For This Useful Post:

    kung foo man (16th June 2018)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •