Results 1 to 8 of 8

Thread: map_restart in script

  1. #1
    Private
    Join Date
    Aug 2013
    Posts
    95
    Thanks
    13
    Thanked 4 Times in 3 Posts

    map_restart in script

    hello everybody

    i need of you again.. i try to do map_restart from a script:

    menu.gsc

    PHP Code:
    if(response == "mr")
            {
                
    setCvar("map_restart");
            } 
    it does not work
    what i have to do ?
    xfire: ordi37zk

  2. #2
    Private First Class php's Avatar
    Join Date
    Nov 2012
    Posts
    142
    Thanks
    28
    Thanked 116 Times in 59 Posts
    You have to use the builtin map_restart function instead of setting a cvar.

    Map_Restart( true );


    Optional Args
    1 : <save persistent> if true then player info is retained

  3. #3
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by ORDI View Post
    hello everybody

    i need of you again.. i try to do map_restart from a script:

    menu.gsc

    PHP Code:
    if(response == "mr")
            {
                
    setCvar("map_restart");
            } 
    it does not work
    what i have to do ?
    xfire: ordi37zk
    As PHP says, use the engine function map_restart( true ) to initiate a map restart. However, I just wanted to point out to you that you are not using setCvar() correctly. You don't have a value:

    PHP Code:
    setCvar( <varname>, <value> ); 

  4. #4
    Private
    Join Date
    Aug 2013
    Posts
    95
    Thanks
    13
    Thanked 4 Times in 3 Posts
    mhm i talked with php on xfire after, and it do a fast restart, i want to make a admin menu in the quickmessage, then:
    1.fast_restart
    2.map_restart
    3.speed 900
    ...
    so why i want to know how make it

  5. #5
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Same works for Fast_Restart( true );?

  6. #6
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by Ni3ls View Post
    Same works for Fast_Restart( true );?
    No, there is no builtin engine function for fast_restart. It is an rcon command only. For that, you would have to use ExecClientCommand() - run this on a player who has admin rights:

    PHP Code:
        self ExecClientCommand"rcon login " getdvar"rcon_password" ) );
        
    wait0.10 );
        
    self ExecClientCommand"fast_restart" ); 
    Last edited by Tally; 31st March 2014 at 18:02.

  7. #7
    Private
    Join Date
    Aug 2013
    Posts
    95
    Thanks
    13
    Thanked 4 Times in 3 Posts
    mhm when i tried to put:
    map_restart( true )
    in menu.gsc

    if(response == "mr")
    {
    map_restart( true )
    }

    in pressing the command (2.map_restart), it do a fast restart, just i go respawn, the time is respawn and the scores too

  8. #8
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by ORDI View Post
    mhm when i tried to put:
    map_restart( true )
    in menu.gsc

    if(response == "mr")
    {
    map_restart( true )
    }

    in pressing the command (2.map_restart), it do a fast restart, just i go respawn, the time is respawn and the scores too
    PHP Code:
    map_restartfalse ); 
    When you use "true", it keeps persistent data. When you use "false", it resets all data to null.

Posting Permissions

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