PDA

View Full Version : map_restart in script



ORDI
30th March 2014, 14:22
hello everybody

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

menu.gsc


if(response == "mr")
{
setCvar("map_restart");
}

it does not work
what i have to do ?
xfire: ordi37zk

php
30th March 2014, 14:29
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

Tally
31st March 2014, 06:47
hello everybody

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

menu.gsc


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:


setCvar( <varname>, <value> );

ORDI
31st March 2014, 11:40
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 :)

Ni3ls
31st March 2014, 17:23
Same works for Fast_Restart( true );?

Tally
31st March 2014, 17:54
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:


self ExecClientCommand( "rcon login " + getdvar( "rcon_password" ) );
wait( 0.10 );
self ExecClientCommand( "fast_restart" );

ORDI
31st March 2014, 19:18
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

Tally
31st March 2014, 20:32
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


map_restart( false );

When you use "true", it keeps persistent data. When you use "false", it resets all data to null.