Results 1 to 8 of 8

Thread: [Tutorial] Time Left Script

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sergeant EvoloZz's Avatar
    Join Date
    Sep 2012
    Location
    Helsinki, Finland
    Posts
    360
    Thanks
    314
    Thanked 167 Times in 120 Posts

    [Tutorial] Time Left Script

    Hey lads, this is my tutorial about time left showing in the server's name, its super easy, but many people need it on their servers
    Lets start by calling the thread, call only on start of gametype.
    So go and find Callback_StartGameType() and add new line
    Code:
    thread maps\mp\gametypes\_time::TimeLeft();
    Then make new .gsc file, and add something like this:
    Code:
    TimeLeft()
    {
        level.timeleft = 30; // change this to how long is one map, for example scr_tdm_timelimit "30", its really important
    
        setCvar("sv_hostname", "My Server Time Left: " + level.timeleft + " minutes");
    
        while(1)
        {
    
             wait 60;
             level.timeleft = level.timeleft - 1; // probably easier just level.timeleft--;
             setCvar("sv_hostname", "My Server Time Left " + level.timeleft + " minutes");
        }
    }
    Explanation:
    level.timeleft = 30 / defines that counter starts from 30
    setCvar / changes the stuff in your config
    while(1) / infinite loop, so it never breaks, can also use for(;;)
    wait 60 / waits 1 minute (in seconds)
    level.timeleft--; / just -1 every minute :>

    Thats it for my first tut :P

  2. The Following User Says Thank You to EvoloZz For This Useful Post:

    kung foo man (22nd January 2013)

Posting Permissions

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