Setting Client DVAR's
-
Absolute noob coder here. Wrote welcome scripts with what I've gathered from the modding community. So far everything has gone great, except for setting client DVAR's. Here's what I got so far:
#include maps\_utility; #include common_scripts\utility; #include maps\_zombiemode_utility; init() { level.clientid = 0; level.perk_purchase_limit = 9; level thread onPlayerConnect(); } onPlayerConnect() { for(;;) { level waittill("connecting", player); player thread onPlayerSpawned(); player.clientid = level.clientid; level.clientid++; // Is this safe? What if a server runs for a long time and many people join/leave } } onPlayerSpawned() { level endon( "game_ended" ); self endon( "disconnect" ); for(;;) { self waittill( "spawned_player" ); self.num_perks = -5; //Remove perk limit, must be a negative number wait ( 10 ); self iPrintLnBold("Welcome to ^1Rimmy's Server^7!"); wait ( 5 ); self iPrintLnBold("^5Perk Limit ^1Removed"); wait ( 5 ); } }
For setting DVAR's, I've tried adding:
onPlayerConnect() { for(;;) { level waittill("connecting", player); player thread onPlayerSpawned(); player.clientid = level.clientid; level.clientid++; // Is this safe? What if a server runs for a long time and many people join/leave self SetClientDvars( "cg_deadChatWithDead", "1", "cg_deadChatWithTeam", "1", "cg_deadHearTeamLiving", "1", "cg_deadHearAllLiving", "1", "cg_everyoneHearsEveryone", "1", "r_fog", "0", "cg_drawSpectatorMessages", "1", "r_lodbiasrigid", "-1000", "r_lodbiasskinned", "-1000" ); } }
Along with:
init() { level.clientid = 0; level.perk_purchase_limit = 9; level thread onPlayerConnect(); level.reset_clientdvars = ::onPlayerConnect_clientDvars; }
and using a function to define (think that's the right word)
level.reset_clientdvars = ::onPlayerConnect_clientDvars;
using the client DVAR's, along with a few other syntax variations. So far no luck. If anyone wouldn't giving a few tips on this it would be much appreciated. -
self SetClientDvars( "cg_deadChatWithDead", "1", ... )
you call that on self instead of player, self is level in that place.
-
Sorex Worked like a charm! Thank you very much!