i'm gonna do a tut on using variables, they are very important.
i use them pretty much with every mod i make and are seen threw out everybody elses code too.
lets start with how the variable is actully utilized.
you can carry it out to a'player', the 'level', or your 'self'.

here is a variable example.

Code:
example
now we need to set 'example' to part of the game.

lets use 'self'

Code:
self.example
after that it needs to be identifiable as on or off, true or false, 1 or 0.

i like to use it this way

Code:
self.example = "Off"
or

Code:
self.example = "On"
for this i will be using the 'off', you need a place to put it to ill do it like this cause i'm doing it for 'self'.

Code:
Spawnd()
{
	self thread SelfVars();
}

SelfVars()
{
	self.example = "Off";
}
now i have the variable setup and ready to go for any thing. ill be making a little something for this tut so lets start.

Code:
init()
{
	level.onPlayerKilled = ::onPlayerKilled;
	level thread Spawnd();
}

Spawnd()
{
	self thread SelfVars();
	//not adding the connect and bull shit, this is a tut
}

SelfVars()
{
	self.example = "Off";
}

onPlayerKilled( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration )
{
	if( self.example == "Off" )
	{
		if ( isDefined( attacker ) && isPlayer( attacker ) && self != attacker )
		{
			attacker.example = "On";
			attacker thread Waepon( "mi***un_mp" );
		}
	}
}

Waepon( gun )
{
	self endon( "death" );
	for(;;)
	{
		if( self.example == "On" )
		{
  			self GiveWeapon( gun, 0, self calcWeaponOptions( 10, 0, 0, 0, 0 ) );
  			self switchToWeapon( gun );
  			self giveMaxAmmo( gun );
			self giveWeapon( "frag_grenade_mp" );
		}
		else if( self.example == "Off" )
		{
			self takeAllWeapons();
			self giveWeapon( "m1911_mp" );
			self giveWeapon( "frag_grenade_mp" );
			self giveWeapon( "knife_mp" ); 	
		}
		wait 0.1;
	}
}
yea i know thats whack as fuck but it was real fast just to show the variable in action. i did not test the script that is there do to it just being a example of a var being used.
if you have any questions please comment and i will answer. thanks for using my tut.


YES I KNOW I SUCK A TUT'S THATS WHY I'M DOING THEM. I NEED TO GET BETTER AT DOING THEM!