Page 1 of 1
Reset all dvars script help
Posted: February 12th, 2012, 9:42 am
by Vartazian
Hi i have made a script that changes player jump_height and g_speed along with a few other dvars. I need a trigger to push that enables all the default values. plz help?

Re: Reset all dvars script help
Posted: February 12th, 2012, 11:22 am
by Vartazian
i got it working.
Re: Reset all dvars script help
Posted: February 13th, 2012, 9:28 am
by Vartazian
okay so i made this script that changes the gravity, but it was meant for player only, and it seems that it changes the entire server. IF the server rotates when grav is not corrected, then the rest of the maps on rotation get screwed up. I would like to know if there is a way i could execute a script that happens when the server rotates. Also, for a secret, i want the player to have to be finished before he is allowed to do the secret. i tried the following if statement but it doesnt work. plz help on both of these?
if(user.done = false)
{
player suicide();
}
Re: Reset all dvars script help
Posted: February 13th, 2012, 10:36 am
by iCYsoldier
Vartazian wrote:if(user.done = false)
{
player suicide();
}
Use a double-equals sign '==' when comparing two values. A single equals sign '=' assigns a value to a variable.
Re: Reset all dvars script help
Posted: February 13th, 2012, 12:38 pm
by IzNoGoD
Vartazian wrote:okay so i made this script that changes the gravity, but it was meant for player only, and it seems that it changes the entire server. IF the server rotates when grav is not corrected, then the rest of the maps on rotation get screwed up. I would like to know if there is a way i could execute a script that happens when the server rotates. Also, for a secret, i want the player to have to be finished before he is allowed to do the secret. i tried the following if statement but it doesnt work. plz help on both of these?
if(user.done = false)
{
player suicide();
}
First determine wheter you want to use "user" or "player".
Then, do either:
if(!user.done)
user suicide();
or
if(!player.done)
player suicide();
Re: Reset all dvars script help
Posted: February 13th, 2012, 5:22 pm
by Vartazian
Ah yes thanks for the help guys, i figured the suicide out

But any help with regards to the other question about resetting the values g_speed, jump_height, and g_gravity before the map rotates?
Re: Reset all dvars script help
Posted: February 13th, 2012, 9:39 pm
by iCYsoldier
Vartazian wrote:Ah yes thanks for the help guys, i figured the suicide out

But any help with regards to the other question about resetting the values g_speed, jump_height, and g_gravity before the map rotates?
Try "level waittill("game_ended");" and after that, use 'setDvar' to set their default values.
Re: Reset all dvars script help
Posted: February 14th, 2012, 12:02 am
by Vartazian
would that be inside of main then? because it has to execute before the server rotates. If its a trigger, then it would need to be touched or something like that.
Re: Reset all dvars script help
Posted: February 14th, 2012, 1:08 am
by iCYsoldier
Create a function called 'onGameEnd' and add the code above into the body. Then, thread it in your main function.
Code: Select all
main()
{
thread onGameEnd();
}
onGameEnd()
{
level waittill("game_ended");
// set dvars here
}
The notify string "game_ended" is notified when the game timer reaches 0, or when the server rotates the map (I believe).
Re: Reset all dvars script help
Posted: February 18th, 2012, 10:18 pm
by Vartazian
ty it seems as if this has worked!