Results 1 to 2 of 2

Thread: Little Question :>

  1. #1
    Private
    Join Date
    Nov 2012
    Posts
    15
    Thanks
    3
    Thanked 18 Times in 11 Posts

    Little Question :>

    I need a idea how to solve this

    If the event not happen in 5sec. it breaks :>

    Code:
    timer = 0;
    while(timer < 5)
    {
    
    do i need a if here?
    {
    self waittill("EVENT");
    break;
    }
    timer += 0.05;
    wait 0.05;
    }

  2. #2
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Hi, that should work:

    Code:
    function onlyFiveSeconds()
    {
        self endon("fiveSeconds");
        while (1)
        {
            self waittill("EVENT");
            self iprintlnbold("Hello in less then 5 seconds!");
        }
    }
    
    function killThread()
    {
        wait 5;
        self notify("fiveSeconds");
    }
    
    
    spawnplayer() // some random function
    {
        self onlyFiveSeconds()
        self killThread();
    }
    timescale 0.01

  3. The Following User Says Thank You to kung foo man For This Useful Post:

    KillerBoB (21st December 2012)

Posting Permissions

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