Thanks Hellsonix. EagleEye - you'll want to add a couple lines to the bottom of spawnPlayer() , which is in the _globallogic script.
This will initiate the dvar, then thread them to a monitoring function.
Here is the code that i've made:
bottom of spanwplayer:
Code:
self setClientDvar("cg_thirdPerson", 1);
self thread thirdPersonADS();
add this function to the _globallogic script:
Code:
thirdPersonADS() // called from spawnePlayer()
{
self endon( "killed_player" );
self endon( "joined_spectators" );
self endon( "disconnect" );
lastAds = false;
while (isPlayer(self) && self.sessionstate == "playing")
{
wait .05;
curAds = self playerAds();
if (curAds && curAds != lastAds)
self setClientDvar("cg_thirdPerson", 0);
else if (!curAds && curAds != lastAds)
{
if (!self meleeButtonPressed())
self setClientDvar("cg_thirdPerson", 1);
}
lastAds = curAds;
}
}