Page 1 of 1

how to add stuff

Posted: April 26th, 2009, 9:30 pm
by IrishStorm
hi there,
i'm just wondering how i would set stuff for allies but not axis
say like setting the r_filmTweakBrightness to 1 etc
maybe its in _teams.gsc or do you make them spawn with it?

this is what i have but it doesn't work :(

Code: Select all

init()
{

    thread Onplayerconnect();

}

OnSpawnPlayer()
{

           while(1)
           {
           self waittill("spawned");
           self thread allies();
           }

}

allies()
{
    self endon("game_ended");
    self endon("disconnect");

    team = GetAssignedTeam( player );

    wait 1;
        
    If ( team == 2);
        {
        setDvar( "r_filmUseTweaks", "1" );
        setDvar( "r_filmTweakEnable", "1" );
        setDvar( "r_filmTweakBrightness", "-0.23" );
        }
        wait 0.05;
    
}

anyhelp

Re: how to add stuff

Posted: April 26th, 2009, 9:41 pm
by Soviet
The if statement shouldn't have a semicolon after it, although I doubt that is your issue.

Re: how to add stuff

Posted: April 26th, 2009, 10:08 pm
by waywaaaard
can I apply an dvar to 1 person, I would loop through all allies and apply the dvar then or get the player array and check if he is allies or axis and then apply

Re: how to add stuff

Posted: April 26th, 2009, 10:36 pm
by Drofder2004
For CoD4 (not sure about others with out checking the exact notify commands.

Code: Select all

main()
{
	thread onPlayerConnect();
}

onPlayerConnect() // This function will wait for a player to connect to the server
{
	for(;;)
	{
		level waittill("connected", player);
		player thread onPlayerSpawned();
	}
}

onPlayerSpawned() // This function will wait for a player to spawn on a team
{
	for(;;)
	{
		self waittill("spawned_player", player);	
		if(self.pers["team"] == "allies")
		{
			self setclientdvar("r_filmTweakBrightness", 1);
			self setclientdvar("r_filmTweakEnable", 1);
			self setclientdvar("r_filmTweakBrightness", "-0.23");
		}
		/*Else
		{
			//Enter all dvars again and their default values to stop players joining allies then axis and gaining the above DVARS
		}*/
	}
}