weapons change triggered by RCON/.cfg? syntax question

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
unmonitrd
Lance Corporal
Posts: 14
Joined: Fri Dec 26, 2003 5:47 pm

weapons change triggered by RCON/.cfg? syntax question

Post by unmonitrd »

I think this can be done, but I've just got the syntax wrong. The idea is to allow the standard weapons on all maps...BUT thru rcon to change what weapons are allowed on the following maps by changing a variable I create in the cfg.

So for example...server boots with a variable "snipes" set to 0. With snipes set to zero regular weapons are available. I realize there is a way to set this globally, but I would like it to be available ONLY on certain maps. So for "snipes" == 1, only the sniper rifles would be enabled (I already know how to alter a map script so that certain weapons are given, in this case the sniper, and how to take any/all weapons away.) The key is I want to be able to change the variable in rcon, and then on the next map or after the current map is restarted, have it take effect right then.

in the cfg I have the default set as:

Code: Select all

set snipes "0"
^^^^^^^^^^^^^^^
This is probably where my syntax is wrong

And then in each individual map script I have added:

Code: Select all

	if (level.snipes == "1")
	{
		thread snipes_only //Removes all but snipers
	}
right after waittillspawn

This way, for the upcoming map if everyone wants snipes, rcon can alter the variable. And when they'd like to return to their regularly scheduled shooting...rcon can change the var back to 0.

Any suggestions? advice? corrections on syntax?
Rindog
Corporal
Posts: 29
Joined: Wed Sep 24, 2003 6:34 pm

Post by Rindog »

I think you just need to set "level.snipes" before your "if" statement.

e.g. level.snipes = getcvar (snipes)

And the map will have to be restarted after settting "snipes" to a new value.
Post Reply