Reset all dvars script help

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
Vartazian
CJ Worshipper
CJ Worshipper
Posts: 286
Joined: June 10th, 2011, 9:14 pm

Reset all dvars script help

Post by Vartazian » February 12th, 2012, 9:42 am

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? :)

Vartazian
CJ Worshipper
CJ Worshipper
Posts: 286
Joined: June 10th, 2011, 9:14 pm

Re: Reset all dvars script help

Post by Vartazian » February 12th, 2012, 11:22 am

i got it working.

Vartazian
CJ Worshipper
CJ Worshipper
Posts: 286
Joined: June 10th, 2011, 9:14 pm

Re: Reset all dvars script help

Post by Vartazian » February 13th, 2012, 9:28 am

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();
}

User avatar
iCYsoldier
CJ Worshipper
CJ Worshipper
Posts: 289
Joined: December 5th, 2009, 7:12 am
Location: Australia

Re: Reset all dvars script help

Post by iCYsoldier » February 13th, 2012, 10:36 am

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.

IzNoGoD
CJ Worshipper
CJ Worshipper
Posts: 343
Joined: January 6th, 2009, 8:39 pm
Location: Netherlands/Holland

Re: Reset all dvars script help

Post by IzNoGoD » February 13th, 2012, 12:38 pm

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();
LMGTFY!

Its not a glitch... Its the future!

Vartazian
CJ Worshipper
CJ Worshipper
Posts: 286
Joined: June 10th, 2011, 9:14 pm

Re: Reset all dvars script help

Post by Vartazian » February 13th, 2012, 5:22 pm

Ah yes thanks for the help guys, i figured the suicide out :D But any help with regards to the other question about resetting the values g_speed, jump_height, and g_gravity before the map rotates?

User avatar
iCYsoldier
CJ Worshipper
CJ Worshipper
Posts: 289
Joined: December 5th, 2009, 7:12 am
Location: Australia

Re: Reset all dvars script help

Post by iCYsoldier » February 13th, 2012, 9:39 pm

Vartazian wrote:Ah yes thanks for the help guys, i figured the suicide out :D 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.

Vartazian
CJ Worshipper
CJ Worshipper
Posts: 286
Joined: June 10th, 2011, 9:14 pm

Re: Reset all dvars script help

Post by Vartazian » February 14th, 2012, 12:02 am

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.

User avatar
iCYsoldier
CJ Worshipper
CJ Worshipper
Posts: 289
Joined: December 5th, 2009, 7:12 am
Location: Australia

Re: Reset all dvars script help

Post by iCYsoldier » February 14th, 2012, 1:08 am

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).

Vartazian
CJ Worshipper
CJ Worshipper
Posts: 286
Joined: June 10th, 2011, 9:14 pm

Re: Reset all dvars script help

Post by Vartazian » February 18th, 2012, 10:18 pm

ty it seems as if this has worked!

Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests