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

Thread: Player can't move for secounds

  1. #11
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts
    What? I have nothing understand. Sorry, can you please add this here what do you mean?
    Code:
    init()
    {
    thread waiting();
    }
    
    waiting()
    {
    if ( ! isDefined(level.waiter))
        level.waiter = spawn("script_origin", (0,0,0)); // you forget the ; here
    self linkTo(level.waiter);
    wait 20;
    self unlink();  
    }

  2. #12
    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
    Dude, you need something like: player waiting();

    Try to understand what "self" means by reading more code in tdm.gsc e.g.

    ATM you are doing: level waiting(); which is bullshit of course
    timescale 0.01

  3. #13
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts
    Hmm i tried that but the error says Unknown Function: players[i] freezeplayer();
    Code:
    init()
    {
    thread waiting();
    }
    
    waiting()
    {
    players = getentarray("player", "classname");
         for (i = 0; i<players.size; i++)
    {
    players[i] freezeplayer();
    wait 20;
    players[i] unfreeze();
    }
    }

  4. #14
    Sergeant EvoloZz's Avatar
    Join Date
    Sep 2012
    Location
    Helsinki, Finland
    Posts
    360
    Thanks
    314
    Thanked 167 Times in 120 Posts
    freezecontrols(true) not freezeplayer()

  5. #15
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by Loveboy View Post
    Hi Guys, i have a question: how i can make that a player can't move for (example) 20 seconds?
    after the 20 seconds he can move?

    If you ask what i want to make:
    The Map is starting, 20 seconds and the game begins
    This works:

    PHP Code:
    main()
    {
        
    level thread onPlayerConnect();
    }

    onPlayerConnect()
    {
        for( ;; )
        {
            
    level waittill"connected"player );
            
            
    player thread onPlayerSpawned();
        }
    }

    onPlayerSpawned()
    {
        
    self endon"disconnect" );
        
        for( ;; )
        {
            
    self waittill"spawned_player" );
            
            
    self thread Freeze();
        }
    }


    Freeze()
    {
        
    self iprintlnbold"frozen" );
        
    self freezeControlstrue );
        
        
    wait10 );
        
        
    self iprintlnbold"unfrozen" );
        
    self freezeControlsfalse );


  6. The Following User Says Thank You to Tally For This Useful Post:

    kung foo man (15th June 2013)

  7. #16
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts
    THANK YOU EVOLLLUZZZ & TALLLY YOU ARE RIGHT!!!!!!!!!!

  8. #17
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts

    Freeze players for 20 seconds at rounderstart

    Ok Guys, that not work, idk really why, i have set it in my mp_sad.gsc, i have run the map and it doesn't work.

    Code:
    main()
    {
        // Map name: mp_sad (test map)
        maps\mp\_load::main();
        maps\mp\_kiste1::main(); // Zufallskiste Nr.1
    
        thread begin(); // Here if map starts then you have to wait 20 secounds
    }
    
    begin()
    {
        wait(1);
        players = getentarray("player", "classname");
        for (i = 0; i<players.size; i++)
        {
            players[i] freezecontrols(true);
            wait 20;
            players[i] freezecontrols(false);
        }
    }
    If map started, then waiting 1 secound, then freeze, that doesnt work.

    And i think because: If you are not in the map, in the exact second 29:59, then it should start but i come too late, and i will be not stuck.

    Somebody know how else i can make it?
    Last edited by kung foo man; 15th June 2013 at 22:49. Reason: Merged with your old thread, dont spam the Scripting-Forum with the same problem

  9. #18
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts
    I must create in Callback_startgametype a timer or in my map.gsc, so that if you connect and it looking for the timer, which secound i am? How long it left now?

    I think this is not easy and i asked my friends, they can't maybe some of killtubers, but would be very nice if somebody is here and can help

  10. #19
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    There are 3 problems with that code:

    1. You must check that the entarray for players exists. If not, then wait for it to be defined;

    2. You aren't waiting for the players to spawn. They cannot move until they are spawned;

    3. You are waiting 20 seconds in the for() loop to search for all players. This will mean the loop will wait 20 seconds before it moves on to the next player. In that time, the player will be able to run around.

    So, try this:

    PHP Code:
    main()
    {
        
    // Map name: mp_sad (test map)
        
    maps\mp\_load::main();
        
    maps\mp\_kiste1::main(); // Zufallskiste Nr.1

        
    thread begin(); // Here if map starts then you have to wait 20 secounds
    }

    begin()
    {
        
    wait(1);
        
        
    players getentarray("player""classname");
        
        while( !
    isDefinedplayers ) )
            
    wait0.05 );
            
        for( 
    0players.sizei++ )
            
    players[ithread FreezePlayer();
    }

    FreezePlayer()
    {
        
    self endon"disconnect" );
        
        
    self waittill"spawned_player" );
        
        
    self freezecontrols(true);
        
    wait20 );
        
    self freezecontrols(false);

    EDIT - the code I just wrote also has a problem - it will only wait until the first player connects, and then run. You really need to detect every connecting player, and run the thread on them. Hence, my original code I posted is much much better because it does exactly that - it detects each and every player and runs the freeze thread on them as they spawn. You need to put that original code in there instead.
    Last edited by Tally; 15th June 2013 at 19:28.

Posting Permissions

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