Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 40
  1. #11
    Senior Member
    Join Date
    Mar 2014
    Location
    Russia, Moscow
    Posts
    479
    I will try soon

  2. #12
    Senior Member
    Join Date
    Mar 2014
    Location
    Russia, Moscow
    Posts
    479
    Quote Originally Posted by Ike View Post
    I'm willing to bet that there is a very good reason for the between round time, such as stats tracking and map loading on the server side.

    Forcing the server out of preround could have some unintended side effects.
    It has long been tested and works perfectly! Statistics for players to come when round complete, the server behaves perfectly!

  3. #13
    Senior Member
    Join Date
    Mar 2014
    Location
    Russia, Moscow
    Posts
    479
    Quote Originally Posted by LCARSx64 View Post
    You could add the delay if you use Insane Limits to do it.
    In the following limit, change the value 30 in the red highlighted line to the number of seconds delay you want.


    Delayed Skip Round

    Create a new limit to evaluate OnRoundOver. Set action to None.

    Set first_check to this Code:
    // Delayed Skip Round

    int iDelay = 30; // Delay in seconds

    System.Threading.Thread.Sleep(iDelay * 1000);
    plugin.ServerCommand("mapList.runNextRound");

    return false;


    End of post!
    Works fine, but I'm not a fan of Insane Limits
    Last edited by PapaCharlie9; 20-07-2014 at 16:49.

  4. #14
    Never, never put a Thread.Sleep in plugin code in the main Procon thread. You are putting Procon to sleep also, so that it can't handle anything else!


    Quote Originally Posted by LCARSx64 View Post
    DO NOT USE THIS CODE! (PapaCharlie9)

    You could add the delay if you use Insane Limits to do it.
    In the following limit, change the value 30 in the red highlighted line to the number of seconds delay you want.


    Delayed Skip Round

    Create a new limit to evaluate OnRoundOver. Set action to None.

    Set first_check to this Code:
    // Delayed Skip Round

    int iDelay = 30; // Delay in seconds

    System.Threading.Thread.Sleep(iDelay * 1000);
    plugin.ServerCommand("mapList.runNextRound");

    return false;


    End of post!
    Don't send me private messages (PMs) unless you really need privacy, like your game server password. If you just have a question or need help, post in one of the threads. It's extra work for me to answer questions and give help in private messages and no one else gets the benefit of the answer.

  5. #15
    Senior Member
    Join Date
    Mar 2014
    Location
    Russia, Moscow
    Posts
    479
    Quote Originally Posted by PapaCharlie9 View Post
    Never, never put a Thread.Sleep in plugin code in the main Procon thread. You are putting Procon to sleep also, so that it can't handle anything else!
    What? Then how correctly?

  6. #16
    Senior Member
    Join Date
    Dec 2013
    Location
    Sydney, Australia
    Posts
    496
    Quote Originally Posted by PapaCharlie9 View Post
    Never, never put a Thread.Sleep in plugin code in the main Procon thread. You are putting Procon to sleep also, so that it can't handle anything else!
    I never knew that, thanks Papa. Would the following code work?
    Code:
    // Delayed Skip Round
    
    Thread ender = new Thread(
        new ThreadStart(
            delegate
            {
                try
                {
                    int iDelay = 30; // Delay in seconds
                    Thread.Sleep(iDelay * 1000);
                    plugin.ServerCommand("mapList.runNextRound");
                }
                catch (Exception e)
                {
                    plugin.ConsoleException(e.ToString());
                }
            }
        )
    );
    
    ender.Name = "RoundEnder";
    ender.Start();
    
    return false;

  7. #17
    Quote Originally Posted by LCARSx64 View Post
    I never knew that, thanks Papa. Would the following code work?
    Code:
    // Delayed Skip Round
    
    Thread ender = new Thread(
        new ThreadStart(
            delegate
            {
                try
                {
                    int iDelay = 30; // Delay in seconds
                    Thread.Sleep(iDelay * 1000);
                    plugin.ServerCommand("mapList.runNextRound");
                }
                catch (Exception e)
                {
                    plugin.ConsoleException(e.ToString());
                }
            }
        )
    );
    
    ender.Name = "RoundEnder";
    ender.Start();
    
    return false;
    Yes. That is the correct way to do timers in plugin code.

    EDIT: I should qualify my comment: that is the correct way to do timers in plugin code AS LONG AS you know that only one thread will be created at a time. If that limit evaluates OnRoundOver, that's safe, because only one of those events happens a time.

    You would NOT use that code for OnKill or OnSpawn. That could create so many threads that Procon will crash -- this has happened in the past.

    It would be even safer to set some kind of bear trap flag in the thread that prevents other threads from starting if there is already one in place. Using a class member flag, or in the case of Insane Limits, plugin.Data.setBool(), reset inside the thread code and set and tested outside of the thread code, to decide whether or not to make a new thread, is the typical way to do this.
    Last edited by PapaCharlie9; 20-07-2014 at 18:38.
    Don't send me private messages (PMs) unless you really need privacy, like your game server password. If you just have a question or need help, post in one of the threads. It's extra work for me to answer questions and give help in private messages and no one else gets the benefit of the answer.

  8. #18
    Senior Member
    Join Date
    Mar 2014
    Location
    Russia, Moscow
    Posts
    479
    Quote Originally Posted by LCARSx64 View Post
    I never knew that, thanks Papa. Would the following code work?
    Code:
    // Delayed Skip Round
    
    Thread ender = new Thread(
        new ThreadStart(
            delegate
            {
                try
                {
                    int iDelay = 30; // Delay in seconds
                    Thread.Sleep(iDelay * 1000);
                    plugin.ServerCommand("mapList.runNextRound");
                }
                catch (Exception e)
                {
                    plugin.ConsoleException(e.ToString());
                }
            }
        )
    );
    
    ender.Name = "RoundEnder";
    ender.Start();
    
    return false;
    Good job! Works fine!

  9. #19
    I should qualify my comment: that is the correct way to do timers in plugin code AS LONG AS you know that only one thread will be created at a time. If that limit evaluates OnRoundOver, that's safe, because only one of those events happens a time.

    You would NOT use that code for OnKill or OnSpawn. That could create so many threads that Procon will crash -- this has happened in the past.

    It would be even safer to set some kind of bear trap flag in the thread that prevents other threads from starting if there is already one in place. Using a class member flag, or in the case of Insane Limits, plugin.Data.setBool(), reset inside the thread code and set and tested outside of the thread code, to decide whether or not to make a new thread, is the typical way to do this.
    Last edited by PapaCharlie9; 20-07-2014 at 18:38.
    Don't send me private messages (PMs) unless you really need privacy, like your game server password. If you just have a question or need help, post in one of the threads. It's extra work for me to answer questions and give help in private messages and no one else gets the benefit of the answer.

  10. #20
    Senior Member
    Join Date
    Mar 2014
    Location
    Russia, Moscow
    Posts
    479
    I use Insane Limits only for Next Round

 

 

Posting Permissions

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